chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
892 stars 187 forks source link

How can I judge purchaseProduct failed or not? #197

Open pengcao1 opened 5 years ago

pengcao1 commented 5 years ago

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: