bizz84/SwiftyStoreKit

Should I serialize calls to retrieveProductsInfo, verifyReceipt?

Open

#568 opened on 2020年7月27日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Swift (792 forks)batch import
area: purchase flowsarea: receipt-validationdifficulty: advancedhelp wantedtype: bugtype: question

Repository metrics

Stars
 (6,419 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

TL;DR: Should I call verifyReceipt in the completion handler of retrieveProductsInfo? Should I delay a call to purchaseProduct until verifyReceipt has returned? The log files seem to say these are all happening in order, but there could be log buffering issues.

Problem: About 2/3 of attempted purchase, in production, are failing with .paymentCancelled. We don't think they are all cancelling -- some logs show two or three attempts in succession. I'm not calling it a bug, but don't know quite what to call it. It is hard to duplicate in TestFlight/Sandbox.

Details: I am calling completeTransaction, retrieveProductsInfo, verifyReceipt, and purchaseProduct in that order. The first one's completion handler is never called; that's OK. RetrieveProductsInfo always returns (i.e. its completion handler is called) first, and correctly reports my product IDs. VerifyReceipt returns after that, with "not purchased" for all product IDs. The completion handler for purchaseProduct is returning .error about 2/3 of the time, almost always with .paymentCancelled.

コントリビューターガイド