Question

Handling Purchase After Reddem Coupon Code iOS

  • 11 January 2022
  • 2 replies
  • 134 views

Userlevel 1
Badge +5

Hi there,

I am using Offer Codes on iOS App Store.

So I am using Purchases.shared.presentCodeRedemptionSheet() to trigger redeem coupon view. 

How can I handle the purchase and execute some code after purchase is done?

 

Normally I can handle it inside 

Purchases.shared.purchasePackage(package) { _, purchaserInfo, _, _ in

But I want to know how to handle that case when using presentCodeRedemptionSheet


2 replies

Userlevel 3
Badge +8

Hi @Utku Dalmaz,

`presentCodeRedemptionSheet()` doesn’t have a callback so you’d have to rely on our PurchaserInfo listener to detect when purchases are made through that flow. You can read about it more here:
https://docs.revenuecat.com/docs/purchaserinfo#listening-for-purchaser-info-updates
https://www.revenuecat.com/blog/how-do-apple-offer-codes-work

Userlevel 1
Badge +5

Thanks. When I want to use this with PurchaserInfo

extension AppDelegate: PurchasesDelegate {
func purchases(_ purchases: Purchases, didReceiveUpdated purchaserInfo: Purchases.PurchaserInfo) {
// handle any changes to purchaserInfo
}
}

How can I differentiate the payments whether a normal subscription or offer code?

Reply