I'm developing an app with in-app purchase, it is the first time I submit it. Before submitting, I have tested IAP via sandbox and Testflight and they all work fine.
But when the review team test it, purchase failed with "invalid product identifier" error. I also provided a video for the process buying via Testflight, but nothing works. I still got this response
Guideline 2.1 - Performance - App Completeness
We found that your in-app purchase products exhibited one or more bugs which create a poor user experience. Specifically, an error message is displayed when we purchased the in-app purchase products.
Review device details:
- Device type: iPhone
- OS version: iOS 16.1
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.
- How did I using IAP.
I'm using SwiftyStoreKit, and the error is [NSLocalizedDescription: Invalid product id: 2008]". I checked the code, it only happens when SKProductsRequest returns the id '2008' in invalidProductIdentifiers.
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
let retrievedProducts = Set<SKProduct>(response.products)
let invalidProductIDs = Set<String>(response.invalidProductIdentifiers)
performCallback(RetrieveResults(retrievedProducts: retrievedProducts,
invalidProductIDs: invalidProductIDs, error: nil))
}
retrieveProductsInfo(Set([productId])) { result -> Void in
if let product = result.retrievedProducts.first {
self.purchase(product: product, quantity: quantity, atomically: atomically, applicationUsername: applicationUsername, simulatesAskToBuyInSandbox: simulatesAskToBuyInSandbox, completion: completion)
} else if let error = result.error {
completion(.error(error: SKError(_nsError: error as NSError)))
} else if let invalidProductId = result.invalidProductIDs.first {
let userInfo = [ NSLocalizedDescriptionKey: "Invalid product id: \(invalidProductId)" ]
let error = NSError(domain: SKErrorDomain, code: SKError.paymentInvalid.rawValue, userInfo: userInfo)
completion(.error(error: SKError(_nsError: error)))
} else {
let error = NSError(domain: SKErrorDomain, code: SKError.unknown.rawValue, userInfo: nil)
completion(.error(error: SKError(_nsError: error)))
}
}
- Via the document invalidProductIdentifiers, I checked the Agreement, Tax in my account and can't see any problem, and other apps in my account can buy as usual.
- The product in appstoreconnect is as follows
Here is what I encountered, can anyone help?