Skip to main content
Question

ConsumptionRequest handling by RevenueCat new user

  • December 21, 2024
  • 5 replies
  • 56 views

Forum|alt.badge.img+5

Currently, I am not a RevenueCat user.

I use pure StoreKit2, to handle subscription and in-app purchase, without any issue.

I also do not have a server, to handle any purchase related thingy.

However, due to the frustrated high approved refund rate, I am interested in RevenueCat’s offering - https://www.revenuecat.com/blog/company/handle-apple-refund-requests-automatically/

But, I wish to keep my existing StoreKit2 untouched, because they are working without issue.

    func application(_ application: UIApplication,
                    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        Purchases.configure(
            with: .init(withAPIKey: "<public_sdk_key>")
                .with(purchasesAreCompletedBy: .myApp, storeKitVersion: .storeKit2)
        )
    }
  • Currently, this is our pure StoreKit2 code. Do we need to pass any information to RevenueCat?
    func purchase(_ shop: Shop) async -> Bool {
        if !isProductsReady() {
            // Retry again.
            await postInit()
        }

        guard let product = products.filter({ $0.id == shop.identifier }).first else { return false }

        do {
            //Begin a purchase.
            let result = try await product.purchase()

            switch result {
            case .success(let verification):
                let transaction = try checkVerified(verification)

                //Deliver content to the user.
                await updatePurchasedIdentifiers(transaction)

                //Always finish a transaction.
                await transaction.finish()

                return true
            case .userCancelled, .pending:
                return false
            default:
                return false
            }
        } catch {
            error_log(error)
        }

        return false
    }
  • My concern is the generated data for `ConsumptionRequest`

For instance, how are we going to generate the data for appAccountToken?

Do we need more modify our code from

    let result = try await product.purchase()

to

    let token = createUUID(...)
    let purchaseOption = Product.PurchaseOption.appAccountToken(token)
    let result = try await product.purchase(options: [purchaseOption])
  • Where we can store this token, so that we can respond to CONSUMPTION_REQUEST with the same token?
  • How can we perform sandbox testing for CONSUMPTION_REQUEST case? I guess during the testing, we need server to send us a valid transaction id, so that we can retrieve sandbox purchasing information, via API https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info ?

Sorry for the long question. Thank you for reading.

This post has been closed for comments

5 replies

MarcosC
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 167 replies
  • December 22, 2024

Hi ​@yan-cheng-cheok-107847 

If you are only willing to integrate with RevenueCat to use the consumption request refund handling, an easy way to do it without touching your application is to configure Apple Server to Server notification and turn on track new purchases from server-to-server notifications.

RevenueCat will track all notifications and create users for those purchases and then we would have enough information to reply



​​​​
 

 


Forum|alt.badge.img+5

Hi Marcos,

Can I confirm that, there is no modification required in my iOS app code.

 

Even this code is not required?

 

    func application(_ application: UIApplication,
                    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        Purchases.configure(
            with: .init(withAPIKey: "<public_sdk_key>")
                .with(purchasesAreCompletedBy: .myApp, storeKitVersion: .storeKit2)
        )
    }

Thank you.


MarcosC
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 167 replies
  • December 26, 2024

If you only want to use our refund request logic, then you don’t need to add the SDK.

We can track purchases with only server to server notifications and use that information to reply to Apple.

 


Forum|alt.badge.img+5

Thank you.

 

After server to server notification setup, I can see incoming purchasing information being displayed in RevenueCat dashboard. However, I still not able to verify refund handling, as there is no refund request from real customer yet.

 

May I know, what other import features I will be missing, if I do not modify my client code to integrate with RevenueCat?

 

Currently, we are driving our install traffic using Apple Basic Search Ads and Facebook Ads Manager.


MarcosC
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 167 replies
  • December 26, 2024

If you want to use apple search ads, then you need to add the SDK. The SDK sends that information to our backend.

You would initialise the SDK as you shared in the previous snippet

I don’t have a full list of features that would not work, but basically without the SDK you can get limited use from RevenueCat as we would just rely on data we can get server side from the stores. 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings