bizz84 / bizz84/SwiftyStoreKit
The dreaded SKErrorDomain Code=2 (Payment cancelled) in 2/3 of all attempts
- Dominant language
- Swift
- Stars
- 6.7k
- Forks
- 801
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
About 2/3 of attempts to purchase a renewable subscription in production are failing with error 2, payment cancelled. This is hard to reproduce in TestFlight/Sandbox. I realize this is both a common symptom and that the details I provide (below) are sketchy. We can't contact the users and ask them "What did you do?" I am collecting log information.
**To Reproduce**
These are the steps I am taking in code
1. SwiftyStoreKit.completeTransactions(atomically: true)
- Never reports anything
2. SwiftyStoreKit.retrieveProductsInfo(productIDs)
- Always returns all 3 of our IAPs
- Always returns before results of step 3 come in.
3. SwiftyStoreKit.verifyReceipt(using:validator, forceRefresh: false)
- Always returns not-purchased for all 3 of our IAPs
- This call is made concurrently with step 2 but always finishes after.
- Should I serialize by calling 3 in the completion handler of 2?
All three of these calls return (i.e. completion handlers run) before purchase attempt is made.
* To purchase, called
4. SwiftyStoreKit.purchaseProduct(productID)
- Returns (via completion handler) Error Domain=SKErrorDomain Code=2
(Payment cancelled)
**Expected behavior**
Expect purchase to succeed more than 1/3 of the time.
## Platform Information
- OS: dozens of different devices and OS versions
- Purchase Type: [auto-renewable subscription
- Environment: production
- SwiftyStoreKit version: 0.16.1
Contributor guide
Assessment
This issue has not been assessed yet.