bizz84 / bizz84/SwiftyStoreKit
User payment is successful, StoreKit return fails "paymentCancelled".
- Dominant language
- Swift
- Stars
- 6.7k
- Forks
- 801
- PR merge metrics
- No merged PRs in 30d
Description
## Platform
- [x] iOS
- [ ] macOS
- [ ] tvOS
### In-app purchase type
- [ ] Consumable
- [ ] Non-consumable
- [ ] Auto-Renewable Subscription
- [x] Non-Renewing Subscription
### Environment
- [ ] Sandbox
- [x] 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 :
```swift
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.
Contributor guide
Assessment
This issue has not been assessed yet.