dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.73k stars 629 forks source link

RNIap.requestSubscription({}) returns cancelled subscription in result for iOS #2745

Open gosis opened 1 month ago

gosis commented 1 month ago

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description

We recently put an iOS app with subscriptions into App store.

We have received reports that users are unable to resubscribe after cancelling their subscription. After looking into the issue we discovered that RNIap.requestSubscription({}) keeps returning previously cancelled subscription and no payment view is presented. While transactionId, transactionReceipt are new with every subscription they have previous subscription expiration_time and pending_renewal_info

Meaning when calling RNIap.requestSubscription({}) no payment screen is presented and a cancelled subscription is returned immediately. After validating the new transactionReceipt we see.. 'pending_renewal_info': [{'expiration_intent': '1', - which means the subscription is cancelled.

And the decoded transactionReceipt has receipt_creation_date of today, but the expires_date in the past

'expires_date': '2024-04-10 18:30:59 Etc/GMT'
'receipt_creation_date': '2024-05-21 08:08:09

Expected Behavior

RNIap.requestSubscription({}) creates a new subscription instead of returning canceled subscription without prompting for payment.

Environment:

To Reproduce Steps to reproduce the behavior:

  1. Buy a subscription in iOS production or sandbox
  2. Cancel subscription (production only) or wait until its expired(sandbox)
  3. Buy the same subscription again
  4. No payment screen is presented and RNIap.requestSubscription({}) returns with result
  5. Validate new subscription result.purchase.transactionReceipt against apple servers
  6. See expires_date is in the past

salsowelim commented 6 days ago

We have the same issue as well

gosis commented 6 days ago

We have added a following workaround for production only

If RNIap.requestSubscription({}) returns an expired subscription, we display an alert to the user saying that he already has a subscription and he has to go to phone settings -> my subscriptions to renew it. There is a renew button there.

After the sub is renewed its expires_date is updated