Skip to main content
Solved

Which of these delegate methods *should be* called upon completion of a purchase, or should both be called?


Forum|alt.badge.img+3

Which of these delegate methods are expected to be called upon completion of a purchase, or are both expected to be called? I can’t find any documentation at all on the site for PaywallViewControllerDelegate, am I missing something? I can tell what sometimes happens, but I would really like to know what is the expected/prescribed behavior for these two delegate methods. If I put the same actions in both for a successful purchase, it could cause problems, and I don’t want to have to deal with a race condition.

paywallViewController(_, didFinishPurchasingWith: )

paywallViewController(_, didFinishPurchasingWith: , transaction: )

Best answer by joan-cardona

Hi @AppDev777,

You can use one or another based on your needs since they have extra parameters. Our recommendation is to use the one I pasted before and is the one you can find in the sample apps. You shouldn’t implement both at the same time.

 

Let me know if this helps!

View original
Did this post help you find an answer to your question?
This post has been closed for comments

3 replies

joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 336 replies
  • August 14, 2024

Hi @AppDev777,

Here’s how you should set the delegate method:

extension ViewController: PaywallViewControllerDelegate {

    func paywallViewController(_ controller: PaywallViewController,
                               didFinishPurchasingWith customerInfo: CustomerInfo) {

    }

}


Here you can safely see if customerInfo contains the right entitlement and perform any logic that you require after a successful purchase.

 

Let me know if this helps!


Forum|alt.badge.img+3
  • Author
  • Dedicated Member
  • 17 replies
  • August 14, 2024

Then what is the other method for? Do they both get called? Can you explain all of this to me in detail please?


joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 336 replies
  • Answer
  • August 19, 2024

Hi @AppDev777,

You can use one or another based on your needs since they have extra parameters. Our recommendation is to use the one I pasted before and is the one you can find in the sample apps. You shouldn’t implement both at the same time.

 

Let me know if this helps!


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