I am implementing in app purchase on iOS, where my server will provide access to certain content when the user purchases an item. I have everything working, including having the server able to verify the receipt from the purchase before providing access to the content.
However, if for some reason the app is not able to register the transaction with my server (due to a server outage, for example), I'd like to cancel the transaction so that the user isn't charged by iTunes. Is this possible?
To explain in further detail, the app contacts my server from within the
paymentQueue:updatedTransactions function after the user clicks "buy." Currently, I call:
after contacting my server. However, if there was an error in contacting the server, is there a function I can call to cancel the transaction instead of finishing it?
I see from here that some people just don't call
finishTransaction, so that the transaction gets restored the next time the user starts the app and the transaction observer is added (so the app can try to contact the server again) However, this is less than ideal because the user won't have access to the content until they restart the app and the server is available again, and yet the user will have already paid.