Is it possible to cancel in-app-purchase
when iOS app is going to terminate? I'm in a situation where user starts in-app-purchase
process and meanwhile kills the app. Can we revert InApp purchase in below code?
- (void)applicationWillTerminate:(UIApplication *)application
The purchasing process is described in the In-App Purchasing Programming Guide
What happens when you app is killed depends on where you are in the purchasing process.
If a payment request has not been submitted then you don't need to do anything; the user will not be charged and no transaction will be recorded and you do not need to take any further action.
If you have submitted a payment request but the user has not authorised the payment (The prompt to authorise payment via password or TouchID is presented by iOS outside of your app) either no transaction will be recorded or the transaction may be reported to your transaction observer with a "failed" status. Either way, the user is not charged and you do not need to take any further action.
If the user has authorised the transaction but the transaction has either not been presented to your transaction observer, or your app has not called finishTransaction
then the transaction will be re-presented to your transaction observer the next time your app is executed. This is why it is important that your app does not call finishTransaction
until you have completed the purchase in your application logic (unlocked features, increased the user's balance or whatever)
So, in summary, there is no method to cancel a purchase process and if you have implemented your transaction observer and purchase logic correctly there is no need to anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With