react-native-in-app-utils: invalid product error?

hi,

I can get product details via this code:

var products = [
            'com.emretekince.xxx',
        ];
        InAppUtils.loadProducts(products, (error, products) => {
           console.log(products) // it works
        });

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

But I can’t test buy product code. I have tested it with my device but I got same error.

invalid_product

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 45 (33 by maintainers)

Most upvoted comments

@malithjkmt That is actually the expected flow for now.

Just a note that I was experiencing this because I hadn’t completed the Tax/Banking information (I had added the Tax info but not a bank).

Once I added a bank, it took about an hour and then worked fine.

depends on the app. It’s a valid concern but returning error in not the right solution.

How about:

InAppUtils.loadProducts(products, (error, products, invalidProducts) => {
   //update store here.
});

oh yeah. For me it took like 24 hours.

I don’t know if it will prevent you from accessing the products. I just sent all my information to them before even adding products.

@chirag04 When I load the products, it’s returns null error but an empty Array [].

When I use product id to make a purchase it says invalid_product.

Which brings up another good question, do we pass the product id into purchaseProduct or do we pass (one of) the returned products from loadProducts?