ask to buy / deferred transaction not getting finalized

I've got a problems with some few deferred payments not getting finalized. It happens in an app that's live for about 3 years. The problem is very rare and we're unable to reproduce it.

Example: a child want's to get an in app purchase and uses "ask to buy" to ask her parents. Her parents confirm the purchase and can see, that their credit card was billed. The state of the transaction initially is deferred (correct) but never gets updated to purchased or failed (in this case, as the IAP was bought, it should have changed to purchased).

Clicking restore purchases didn't change anything. Nor did reinstalling the app.

It seems, that the transaction never gets finalized and will stay in deferred forever.

Is this a known problem and are there any known fixes?

Replies

I would expect once an Ask To Buy request is approved, that a new transaction is added to the paymentQueue with the .purchased state on the requestors device. When you initially observe a transaction go into the .deferred state, you can mark it as finished (finishTransaction) to clear it from the queue as the successful transaction will be added to the queue or if it is declined no update occurs on device.

As this Ask To Buy transaction can be approved at any time for up to 24hours, our suggestion is to ensure that your app is initializing the TransactionObserver immediately upon app launch to ensure it catches any new transactions. For more info: https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/setting_up_the_transaction_observer_for_the_payment_queue

  • Thank you for the quick answer. I'm a little confused right now, according to the documentation (https://developer.apple.com/documentation/storekit/skpaymenttransactionstate/deferred) the transaction state is not finished when it enters deferred state and I should wait for another callback that indicates the final status.

    However, it won't solve my problem. According to the customer, "ask to buy" was confirmed and money was withdrawn from her account. So either way, the app should have been notified about the purchase. We're always checking for new transactions when starting the app and we also got the "restore purchases" button with which all transactions are getting checked again.

    I will add a timeout to deferred transactions for the next release. Meaning, as soon as a transaction is deferred, I will finalize it and lock re-purchasing the IAP. After 24h, if I got no transaction telling me either the IAP was bought or not, I will unlock the IAP for purchase in the shop again.

  • Hello, we occasionally encountered a similar issue (the parent was charged but we never got a purchase success confirmation). We were wondering if you ever figured out the root cause of the problem? Thank you so much!

Add a Comment