When you purchase an application, SKPaymentTransactionStatePurchased retries

I am implementing in App Purchase and checking receipts on my server.

When I encounter SKPaymentTransactionStatePurchased during paymentQueue:updatedTransactions: I send a receipt to my server for verification. When my server responds OK, I call finishTransaction .

If my server is offline or I cannot otherwise verify receipt, which causes the application to call paymentQueue:updatedTransactions: again, which allows me to retry the check? I noticed that restarting the application does this - is there anything else? Will it be called again at some fixed frequency while the application remains on?

Is there a manual way to enforce a transaction queue?

+4
source share
2 answers

I think TomSwift does not want to restore the purchased payment, but he wants the application to call paymentQueue: updatedTransactions the flag SKPaymentTransactionStatePurchased of non finishTransaction is again added

and only he knows that he is restarting the application

I used to try [[SKPaymentQueue defaultQueue] removeTransactionObserver: mMyStoreObserver]; [[SKPaymentQueue defaultQueue] addTransactionObserver: mMyStoreObserver]; again

but it does not work.

Apple’s Contactless Issue will tell you that it was purchased but never downloaded, and it will enter SKPaymentTransactionStateFailed when it tries to buy the same product ID again.

+1
source

You may have an application call

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

It will send to

paymentQueue: (SKPaymentQueue *) queue updatedTransactions: (NSArray *) Transactions

set of all transactions with:

SKPaymentTransactionStateRestored

but not

SKPaymentTransactionStatePurchased

0
source

Source: https://habr.com/ru/post/1342693/


All Articles