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

How can I judge purchaseProduct failed or not? #197

Open
pengcao1 opened this issue Sep 26, 2018 · 0 comments
Open

How can I judge purchaseProduct failed or not? #197

pengcao1 opened this issue Sep 26, 2018 · 0 comments

Comments

@pengcao1
Copy link

Hi, everyone:
this code snippet was copied from my project.

        InAppUtils.purchaseProduct(productId, (purchaseError: Error, transaction: IProductTransaction) => {
          if (purchaseError) {
              //TODO purcuase error?
          }
        });

and this code snippet was copied from react-native-in-app-utils README.MD file

InAppUtils.purchaseProduct(productIdentifier, (error, response) => {
   // NOTE for v3.0: User can cancel the payment which will be available as error object here.
   if(response && response.productIdentifier) {
      Alert.alert('Purchase Successful', 'Your Transaction ID is ' + response.transactionIdentifier);
      //unlock store here.
   }
});

so my question is:

  • can I change the logic from if (purchaseError) to if(!(response && response.productIdentifier))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant