We have had 3 instances where a user has been charged twice for a Consumable Product
. We have noticed that this happens when the user receives an error (example of error response below) from the API method in React Native await Purchases.purchaseProduct(productId, null, Purchases.PURCHASE_TYPE.INAPP)
. Below is a snippet of how we use the API method in a try/catch block.
try {
setIapLoading(true)
await Purchases.setAttributes(userAttributes)
log.info('Set user attributed', userAttributes)
await Purchases.purchaseProduct(productId, null, Purchases.PURCHASE_TYPE.INAPP)
log.info('Purchase successful')
navigation.navigate(ROUTE_SIGN_UP)
} catch (e: any) {
if (e.code !== '1') {
log.error('IAP Error for Product: ' + productId, JSON.stringify(e))
setIsOpen(true)
}
}
Error Response:
{"code":"2","message":"There was a problem with the App Store.","domain":"RCPurchasesErrorDomain","userInfo":{"readable_error_code":"STORE_PROBLEM","readableErrorCode":"STORE_PROBLEM","NSLo…
When the above error occurs we catch the error in a catch block and allow the user to retry purchasing. However, this is causing the product to be purchased twice. Below is a screenshot of the customer history in the RC dashboard.
