react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

The user loss money, but on the side of the application, he does not receive a reward

Open abaddonGIT opened this issue 7 years ago • 4 comments

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

abaddonGIT avatar Apr 25 '19 00:04 abaddonGIT

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 avatar Apr 25 '19 03:04 hyochan

@hyochan why is this flow part of the README still then?

tonycoco avatar May 15 '19 02:05 tonycoco

@tonycoco Could you explain further?

hyochan avatar May 15 '19 05:05 hyochan

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?

tonycoco avatar May 15 '19 16:05 tonycoco