Buying the same product twice will give an error
See original GitHub issueVersion of react-native-iap
0.3.13
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
Expected to buy a product without an issues
Actual behavior
First time I buy a product_A on a “new” device - it works. Second time I try to buy the same product_A (no matter if I restart the app or not) will not work. The error message is: “An unknown or unexpected error has occurred. Please try again later.”
Steps to reprodue the behabior
1.Implement IAP as in ReadME. Try to buy an item with this code:
try {
const msg = await RNIap.prepare()
const products = await RNIap.getProducts([`${productId}`])
const purchase = await RNIap.buyProduct(productId)
this.props.purchaseCoinsPack(coinsPack)
await RNIap.consumePurchase(purchase.transactionReceipt)
} catch (err) {
alert(err.message);
}
Just in case I have this code in my componentDidMount() and componentWillUnmount():
getPurchases = async () => {
try {
const purchases = await RNIap.getAvailablePurchases();
purchases.forEach(async purchase => {
const boughtPack = R.find(R.propEq('androidStoreId', purchase.productId))(this.props.coinsPacks)
if (boughtPack) {
this.props.purchaseCoinsPack(boughtPack);
await RNIap.consumePurchase(purchase.transactionReceipt);
}
})
} catch (err) {
console.warn(err); // standardized err.code and err.message available
} finally {
this.setState({ isLoading: false })
}
}
async componentDidMount() {
try {
await RNIap.prepare()
} catch (err) {
console.warn(err);
}
this.getPurchases()
}
async componentWillUnmount() {
RNIap.endConnection()
}
2.First buy works ok. Try to buy same product once again Get an alert with "“An unknown or unexpected error has occurred. Please try again later.”
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
What do you do when you accidentally buy the same thing ...
Contact the seller. apologize for your mistake and ask seller to send you a cancel Transaction Request for one of the.. It's important...
Read more >What to do when you're billed twice for the same goods or ...
“If cardholders identify a purchase they didn't authorize, they should immediately contact the bank that issued their card and dispute the ...
Read more >Purchased same item twice - Microsoft Community
If you could make the purchase again, it sounds like you tried it from another account and not the one that made the...
Read more >purchased twice use the same apple id - Apple Developer
when i purchased the same product twice using the same apple id .The second time i recieved SKErrorPaymentCancelled status at first, then i...
Read more >Does anyone know if we can grab the same product twice on ...
You'll get a "you've already requested a version of that item" error msg. There's no need to make up artificial restrictions on yourself....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
latest v0.3.15 will give you the
error code
with a message. So can you please try the latest release again and what the error code is? If the error code is -1001, it might be a temporary sandbox’s issue from Apple. I will look this issue as well.Good to hear that! It may be a temporary issue from Apple since new release did not change anything but the log. There have been so many problems when we test with the sandbox. Most cases do not happen in production released by App Store.