react-native-iap
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?
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)
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();
};
}, []);
After you finish all pending transactions, the user will have the option to resubscribe again.