Description
Platform
- iOS
In app purchase type
- Auto-Renewable Subscription
- Non-Renewing Subscription
Environment
- [*] Sandbox
- [*] Production
Hello,
I am using this function to purchase product of in app purchase:
func purchase(_ purchase: RegisteredPurchase) {
SwiftyStoreKit.purchaseProduct(bundleId + "." + purchase.rawValue, atomically: false) { result in
if case .success(let product) = result {
print(product.transaction.transactionIdentifier!)
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
}else{
if let alert = self.alertForPurchaseResult(result) {
self.showAlert(alert)
}
}
}
}
It's working fine when I was testing with test user. But in app review it got rejected with reason:
We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 11.3 on Wi-Fi connected to an IPv6 network.
Specifically, we are unable to complete the in app purchase due to an error.
Next Steps
When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code “Sandbox receipt used in production,” you should validate against the test environment instead.
Please help me how can i change the environment during purchase. Because I will validate the receipt with both the environment once purchase will be successfull but their purchase is failling then how i will validate it with both environment. It gives error of paymentinvalid
Please tell me the solution of it.