Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buySubscription on iOS failing multiple times for users #412

Closed
noahhayes opened this issue Feb 27, 2019 · 8 comments · Fixed by #510
Closed

buySubscription on iOS failing multiple times for users #412

noahhayes opened this issue Feb 27, 2019 · 8 comments · Fixed by #510
Labels
🍗 enhancement New feature or request 👣 waiting for response Need feedback to continue

Comments

@noahhayes
Copy link

noahhayes commented Feb 27, 2019

Version of react-native-iap

2.2.2

Version of react-native

0.57

Platforms you faced the error (IOS or Android or both?)

Expected behavior

Error message should distinguish between user cancelling purchase and user experiencing an error.

Actual behavior

I'm noticing that a large number of my users are getting an error when attempting to purchase a subscription. In my error logs, I'm seeing the CANCELLED error message when they try to buy. Of course, many of these users could actually be cancelling their transaction. However, I'm curious to dig into this further because there are many users that attempt to make the purchase multiple times. For example, some users will press purchase 4 times in a row and are not able to complete the transaction--they all show the CANCELLED error message. I can't figure out if they are just confused and cancelling the purchase or if it's breaking due to an unknown error.

Attached is roughly the code I'm using.

RegisterActivate2.txt

Tested environment (Emulator? Real Device?)

Real Device

Steps to reproduce the behavior

I can't reproduce it myself. I'm only seeing the activity through logging.

@noahhayes noahhayes changed the title buySubscription on iOS failing several times for users only get CANCELLED error buySubscription on iOS failing multiple times for users Feb 27, 2019
@hyochan hyochan added the 📱 iOS Related to iOS label Feb 27, 2019
@hyochan
Copy link
Owner

hyochan commented Feb 27, 2019

Actually, this PR was updated in #291. Apple doesn't seem to provide the correct error message natively (if I am correct). But then if we revert the PR it will provide only Enligsh error message. @mars-lan Hope you can look at this if you are available.

@hyochan hyochan added 🍗 enhancement New feature or request and removed 📱 iOS Related to iOS labels Feb 27, 2019
@noahhayes
Copy link
Author

Thanks @hyochan

Is there anything I’m doing obviously wrong in the attached code?

I saw someone commented that it may be caused by an Invalid Product ID. Are there any gotchas that I may be missing regarding Product ID?

It’s strange to me because it works fine for me in the US but breaks for users in Vietnam, Cambodia and other countries.

@hyochan
Copy link
Owner

hyochan commented Mar 1, 2019

@noahhayes I've briefly saw your code and seems to look ok. I'd suggest you to use componentDidMount instead componentWillMount tough.

I hope you to check some tax agreement for Vietnam, Cambodia or other countries if you are facing issue in ios.

@mars-lan
Copy link
Contributor

mars-lan commented Mar 1, 2019

Actually, this PR was updated in #291. Apple doesn't seem to provide the correct error message natively (if I am correct). But then if we revert the PR it will provide only Enligsh error message. @mars-lan Hope you can look at this if you are available.

I believe the original question has nothing to do with the localized description, but the actual error code (SKErrorPaymentCancelled that got mapped to the standardized "E_USER_CANCELLED" here). #291 didn't touch that part of the code so reverting it won't address the issue.

@hyochan
Copy link
Owner

hyochan commented Mar 7, 2019

@mars-lan Thanks for confirming. I did not had time to look through that. I'll come back when I am available.

@hyochan
Copy link
Owner

hyochan commented Mar 14, 2019

@noahhayes What happens when you change the code like the below?

  onPressPurchase() {
    this.setState({ purchaseLoading: true }, () => {
      RNIap.buySubscription(PRODUCT_SKU)
        .then(() => {
          this.setState({ purchaseLoading: false });
        })
        .catch((err) => {
          this.setState({ purchaseLoading: false });
        });
    });
  }

@hyochan hyochan added the 👣 waiting for response Need feedback to continue label Mar 14, 2019
@edo1493
Copy link

edo1493 commented Apr 25, 2019

I have something similar where they go through the flow, have to change payment method (for example) and then the component doesn't return anything after the transaction is completed.

In this case, we make them restore the purchases and everything is fine.

@hyochan
Copy link
Owner

hyochan commented Apr 25, 2019

@edo1493 Could you provide some codes? Do you mean you've just called getAvailablePurchases to solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍗 enhancement New feature or request 👣 waiting for response Need feedback to continue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants