bizz84/SwiftyStoreKit

Should I serialize calls to retrieveProductsInfo, verifyReceipt?

開放

#568 建立於 2020年7月27日

 (1 則留言) (0 個反應) (0 位負責人)Swift (792 個分叉)batch import
area: purchase flowsarea: receipt-validationdifficulty: advancedhelp wantedtype: bugtype: question

倉庫指標

星標
 (6,419 顆星)
PR 合併指標
 (30 天內沒有已合併 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.

貢獻者指南