Skip to main content

Can anyone explain if I am doing this correctly?

 

It seems to work fine on Android, but on IOS it takes at least 10 seconds for the Apple confirm dialogue to appear, and then after confirming purchase (in sandbox) it then pops up again and never gets to the alert and redirection?

 

```

useEffect(() => {
    (async function () {
      await Purchases.setLogLevel({ level: LOG_LEVEL.INFO }); // Enable to get debug logs
      await Purchases.configure({
        apiKey: "XXX"
      });
    })();
  }, ]);

 

const purchaseStoreProductA = async () => {

const offerings = await Purchases.getOfferings();

const productToBuy = offerings.current

&& offerings.current.availablePackages

&& offerings.current.availablePackagese0].product;

if (productToBuy == null) {

alert('No product');

return

};

const purchaseResult = await Purchases.purchaseStoreProduct({

product: productToBuy

});

 

purchaseResult ? alert('Thank you for subscribing.') + history.push("/ios-signup/") : null;

}

```

I call purchaseStoreProductA() from a button.

Hello,

It sounds like something is happening after you attempt to make the purchase. If you build and run the app from Xcode you will see the debug logs which may indicate any errors that happen after the purchase. Can you share them here when you get them?


Reply