bizz84/SwiftyStoreKit
View on GitHubUser payment is successful, StoreKit return fails "paymentCancelled".
Open
#537 opened on Apr 2, 2020
area: purchase flowsdifficulty: advancedhelp wantedstatus: needs analysistype: bug
Description
Platform
- iOS
- macOS
- tvOS
In-app purchase type
- Consumable
- Non-consumable
- Auto-Renewable Subscription
- Non-Renewing Subscription
Environment
- Sandbox
- Production
Version
0.15.0
Report
Issue summary
When the user tried to re-new subscription In the production environment sometimes it works properly but in some cases, user payment is successful but dramatically StoreKit return error "paymentCancelled" it the SKError class which means user canceled the request but user claims he did not cancel. Also customer proves that they paid.
It failed in production but working in the sandbox.
Here's the method I used for purchase single product :
SwiftyStoreKit.purchaseProduct("com.musevisions.SwiftyStoreKit.Purchase1", quantity: 1, atomically: false) { result in
switch result {
case .success(let product):
// fetch content from your server, then:
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
print("Purchase Success: \(product.productId)")
case .error(let error):
switch error.code {
case .unknown: print("Unknown error. Please contact support")
case .clientInvalid: print("Not allowed to make the payment")
case .paymentCancelled: break
case .paymentInvalid: print("The purchase identifier was invalid")
case .paymentNotAllowed: print("The device is not allowed to make the payment")
case .storeProductNotAvailable: print("The product is not available in the current storefront")
case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
case .cloudServiceNetworkConnectionFailed: print("Could not connect to the network")
case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
default: print((error as NSError).localizedDescription)
}
}
}
Please advise what I'm doing wrong.
Your thoughts and suggestions highly appreciated.
Thanks in advance.