react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

iOS Offer Code Redemption does not trigger purchaseUpdatedListener

Open grxp-charlie opened this issue 2 years ago • 2 comments

Version of react-native-iap: 7.3.0

Version of react-native: 0.66.0

Platforms you faced the error (IOS or Android or both?): IOS

Expected behavior

  1. Trigger Offer Code Redemption flow via either presentCodeRedemptionSheet or AppStoreConnect url https://apps.apple.com/redeem?context=offercodes&id=#######&code=CODE
  2. Successfully redeem Offer Code
  3. Return to app
  4. purchaseUpdatedListener receives event and and the receipt is received for backend validation

Actual behavior

  1. Trigger Offer Code Redemption
  2. Successfully redeem Offer Code
  3. Return to app
  4. purchaseUpdatedListener never receives the event. Force fetching receipt via getReceiptIOS shows a valid receipt

Tested environment (Emulator? Real Device?): Real Device (iPhone and iPad) on TestFlight build pointed to Production environment

Steps to reproduce the behavior

Using react-native-iap v7.3.0 on React Native v0.66.0 with the new iOS Offer Code redemption flow via a TestFlight build pointed to production. We have tested redeeming offer codes via both the presentCodeRedemptionSheet method and also using the link from App Store Connect (https://apps.apple.com/redeem?context=offercodes&id=#######&code=CODE). The Offer Code is redeemed successfully and the user is charged but our purchaseUpdatedListener never receives an event after returning to the app or even restarting the app. I added some logs to try fetching different information before and after the offer code redemption happens (with a brand new user):

  • getAvailablePurchases: Errors out with The operation couldn’t be completed. (SKErrorDomain error 2.) during the first couple minutes after login and then resolves to an empty array.
  • getPurchaseHistory: Errors out with The operation couldn’t be completed. (SKErrorDomain error 2.) during the first couple minutes after login and then resolves to an empty array.
  • getPromotedProduct: Always resolves null
  • getReceiptIOS: Resolves with some encoded receipt data. Passing the receipt data to the validator API does show us the latest receipt object in the latest_receipt_info array has the offer_code_ref_name field that we expect to see on successful offer code redemption.

We set up our purchaseUpdatedListener soon after app start in the same function where we call getSubscriptions to setup the app for IAP. Our promoted product listener is mounted even earlier in the app's lifecycle but receives no event either.

I have already reviewed the following issues #400 #450 #490 #1276 but I am still having this problem. Are there any investigations currently underway or solutions in any later versions? At this point we are left having to hack around the lack of a purchase signal. Any help would be greatly appreciated!

grxp-charlie avatar Jun 13 '22 23:06 grxp-charlie

Have you tried with the latest @grxp-charlie ?

andresesfm avatar Jun 14 '22 17:06 andresesfm

Got the same issue in version 5.2.14 is annoying offer codes can only be tested on production builds of the apps makes debugging this hellish.

aidan-doherty avatar Jul 12 '22 13:07 aidan-doherty

Seem to still be having this issue, while we're reviewing to try to figure this out on our end (exact same scenario and issues reviewed as original issue above) if anyone here has had success getting this to work, would love to know what your solution was.

bperlman avatar Dec 27 '22 16:12 bperlman

I'm still having this issue, can anyone help out?

The modal shows, I hit redeem code, the apple prompt shows where it does face ID to redeem, then the modal never hides and the purchase does not go through

ahunter135 avatar Apr 06 '23 18:04 ahunter135

@grxp-charlie @bperlman Did anyone manage to get it working?

Pingou avatar Jan 17 '24 09:01 Pingou

Same question, did anyone figure this out?

grp06 avatar Feb 23 '24 14:02 grp06