The user loss money, but on the side of the application, he does not receive a reward
Hi! I have a problem. Now payment process looks like that
try {
await RNIap.clearTransaction();
} catch (error) {
this.ahoy.track('Clear transaction', { error });
}
try {
// start transaction with out finished
const purchase = await RNIap.buyProductWithoutFinishTransaction(productId);
this.ahoy.track('Init purchases info:', { purchase });
// add user points
__onPurchase(productId, purchase, null);
// validation purchase
await this.isValid(purchase);
// try to finish transaction
try {
await RNIap.finishTransaction();
} catch (error) {
this.ahoy('Transaction not finished:', { purchase });
}
} catch (error) {
clearTimeout(this.closeDelay);
this.closeDelay = setTimeout(() => {
__onPurchase(productId, null, error);
}, 500);
}
But at the same time, some users complain that they have money written off from the card but they do not receive the purchased reward. This can occur if an error ({"NSLocalizedDescription":"Cannot connect to iTunes Store"}) occurs in RNIap.buyProductWithoutFinishTransaction, but I don't understand why the money deducted without calling RNIap.finishTransaction.
Tell me what I'm doing wrong?
Version of react-native-iap
2.4.9
Version of react-native
0.57.8
Platforms you faced the error (IOS or Android or both?)
IOS
Tested environment (Emulator? Real Device?)
Real Device
Please see guide code to prevent such issue. What you are using is quite old detail which we've removed from the readme. You can see related issue in #307 which we've solved in #348.
@hyochan why is this flow part of the README still then?
@tonycoco Could you explain further?
https://github.com/dooboolab/react-native-iap#ios-purchasing-process-right-way calls RNIap.finishTransaction right? I guess my question is what is the "old detail" that you are speaking of?