Skip to main content

Hello, I’m trying to get App Store Promotions for In-App Purchases working through RevenueCat. I feel like I must be missing a permission or some important setup call somewhere, because I just can’t seem to get the delegate purchases method containing readyForPromotedProduct to ever be called when opening an App Store Promotions link (e.g. itms-services://?action=purchaseIntent&bundleId=<BUNDLE_ID_HERE>&productIdentifier=<PRODUCT_ID_HERE>).

 

I’ve confirmed that the normal purchases method (func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo)) gets called every start, but not the one I want.

 

I’ve tried all the following sources:

 

Here is my Swift code:

 

final class PurchasesDelegateHandler: NSObject, Sendable {

    static let shared = PurchasesDelegateHandler()

}

 

extension PurchasesDelegateHandler: PurchasesDelegate {

    /// Whenever the `shared` instance of Purchases updates the CustomerInfo cache, this method will be called.

    ///

    /// - Note: CustomerInfo is not pushed to each Purchases client, it has to be fetched.

    /// This delegate method is only called when the SDK updates its cache after an app launch, purchase, restore, or fetch.

    /// You still need to call `Purchases.shared.customerInfo` to fetch CustomerInfo regularly.

    func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo) {

        /// - Update our published customerInfo object

        SGSnackBar().show(text: "Normal purchases method", duration: 10)

    }

 

    /// - Note: this can be tested by opening a link like:

    /// itms-services://?action=purchaseIntent&bundleId=<BUNDLE_ID>&productIdentifier=<SKPRODUCT_ID>

    func purchases(

        _ purchases: Purchases,

        readyForPromotedProduct product: StoreProduct,

        purchase startPurchase: @escaping StartPurchaseBlock)

    {

        SGSnackBar().show(text: "Secondary purchases method!", duration: 10)

    }

}

 

// Inside my PurchasesManager class…

Purchases.configure(withAPIKey: PurchasesStrings.Manager.Key.providerAPI, appUserID: userID)

Purchases.shared.delegate = PurchasesDelegateHandler()

Hi,

Happy to help here. Just wanted to double check, you said “called when opening an App Store Promotions link”—are you completing the purchase before returning to the app?

Thanks!


@Ryan Glanz,

I have yet to actually experience the full App Store Promotion flow, so I’m not entirely sure when I should see the purchase screen. My understanding is it should progress as follows:

Browsing in App Store → Sees our app → App listing displays an IAP as a promotion → User selects promotion → Our app is downloaded → IAP prompt appears

Is this not the proper flow? Should the purchase occur before the app is even installed?


In the "Testing promoted in-app purchase" link, it says:

Send this URL to yourself in an email or iMessage, and open it from your device. You’ll know the test is running when your app opens automatically. You can then test how your app handles the promoted in-app purchase.

... which I am doing. It is successfully opening my app. But then what? It's that second part I'm unsure about. Does it actually simulate a purchase, and engage the methods related to that (such as the purchases method with readyForPromotedProduct)? Or do I have to actually test that portion once the promo is active in the store?


After seeing how the flow should properly progress in another app (after some tinkering there too), I finally managed to get it working. Between creating a new App Store Promotion and then using that product ID in my testing link, it started to work. 


Reply