Skip to main content
Solved

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

  • 10 August 2024
  • 3 replies
  • 23 views

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: )

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!


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


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!