bizz84/SwiftyStoreKit

Should I serialize calls to retrieveProductsInfo, verifyReceipt?

Open

#568 建立於 2020年7月27日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Swift (6,419 star) (792 fork)batch import
area: purchase flowsarea: receipt-validationdifficulty: advancedhelp wantedtype: bugtype: question

描述

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.

貢獻者指南