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

In the sandbox environment, is it possible to renew a subscription from the app after the user has canceled the subscription via their iPhone settings?

Open MuneebQureshi1 opened this issue 1 year ago • 2 comments

Description

Initially, first-time in-app subscriptions are functioning as expected. However, when I cancel the subscriptions through iPhone settings within the sandbox environment, subsequent attempts to use the requestSubscription function retrieve the previous transaction history or receipt. I am seeking clarification on whether it's possible to renew a subscription within my app following the completion of the cancellation process.

Expected Behavior Following the cancellation of a subscription, I aim to reopen the iOS system modal in order to initiate the payment process again

Environment:

  • SandBox
  • react-native-iap:"^12.10.5"
  • react-native: "0.71.3"
  • Platforms (iOS, Android, emulator, simulator, device): IOS (Real Device)

MuneebQureshi1 avatar Aug 24 '23 13:08 MuneebQureshi1

You need to add transaction listener and finish each transaction after each update. Take a look at the method FinishTransaction() and the next listener:

useEffect(() => { const subscription = transactionListener((transactionOrError) => { if(transactionOrError.transaction){ console.log("There's an update to a transaction", transactionOrError.transaction); }else{ console.log("There's been an error with a received transaction") } //TO DO SOME WHAT AND FINISH TRANSACTION });

return () => {
  subscription.remove();
};

}, []);

khrulev avatar Sep 11 '23 15:09 khrulev

After you finish all pending transactions, the user will have the option to resubscribe again.

khrulev avatar Sep 11 '23 15:09 khrulev