Question

readyForPromotedProduct not called

  • 25 September 2022
  • 5 replies
  • 596 views

Badge +2

Hi all,

I’ve implemented readyForPromotedProduct (former shouldPurchasePromoProduct) method of PurchasesDelegate so that the user can select a promoted subscription straight from the App Store and be redirected to in-app payment sheet.

I’m trying to test the implementation using the link as per the documentation:

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

The link redirects me to the app, but no payment sheet appears. The console shows me an error:

Tried to send purchase intent: <SKPRODUCT_ID> to delegate, delegate does not respond to method paymentQueue:shouldAddStorePayment:forProduct

By the way, Purchases.configure has already been called and Purchases.shared.delegate = self set before, I’m basically opening the link with the app already being active. Another method of PurchaseDelegate func purchases(_ purchases: Purchases, receivedUpdated purchaserInfo: RevenueCat.CustomerInfo) is working with no issues. 

Any ideas what’s going on?

RevenueCat 4.12.1, iOS 16.0, testing on a physical device


5 replies

Badge +3

I have the same issue.

Userlevel 4
Badge +6

Hi @Kate and @dgt!

There have been some reports of functionality issues with this in SDK version 4.12.x - this should be fixed in our latest version of the SDK: https://github.com/RevenueCat/purchases-ios/releases/tag/4.13.1. Are you able to try upgrading to the latest SDK to see if this gets readyForPromotedProduct working for you?

Badge +3

Hey @kaitlin ,

Thanks for the reply. I actually used StoreKit 1 for the job by setting a config flag and I got promoted products working. But I will be sure to test if it works on the latest SDK without this workaround.

Badge +2

Hi @kaitlin,

It didn’t work for me with the latest 4.13.1 version, though it says “This version does not support promoted purchases initiated directly from the App Store when StoreKit 2 is enabled.”? 

After downgrading to 4.11.0 it did work even with StoreKit 2 🎉

Badge +2

So I have implemented the PurchaseDelegate in the SceneDelegate class but I am not sure why its not refreshing the UI after I make a purchase using the Purchases.shared.purchase function. Only when I close the app and reopen it, it then triggers the change.

M I missing something ?

 

Note: I have added the Purchases.shared.delagate = self in the SceneDelegate

 

extension SceneDelegate:PurchasesDelegate{

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

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

        /// - If necessary, refresh app UI from updated PurchaserInfo

        let rootStoryboard = customerInfo.entitlements.all[Configs.Keys.entitlement_id]?.isActive == false ? Configs.Storyboard.splash_journey.instantiateInitialViewController() :

            Configs.Storyboard.main.instantiateInitialViewController()

      

        if let rootStoryboard  = rootStoryboard{

    

            if window?.rootViewController?.isKind(of: UITabBarController.self) == true, rootStoryboard.isKind(of: AppController.self){

            window?.rootViewController = rootStoryboard

            window?.makeKeyAndVisible()

                

            }

        }

     

    

    }

}

Reply