Question

when purchaseStoreProduct, no response

  • 10 October 2023
  • 4 replies
  • 104 views

Badge

I am trying to purchase a product in React native.

my env:

"react-native": "0.68.2",

"react-native-purchases": "^6.6.5",

 

in iOS, after configure with iOS public key, I try to purchase a product by using a function purchaseStoreProduct

const { customerInfo, productIdentifier } = await Purchases.purchaseStoreProduct(product);

But I could not get any response as well as any errors.

In my test, I could get the Apple login modal prompt at the first function call.
But after some times, when trying to call this function, I could not get any response.

 


4 replies

Userlevel 6
Badge +8

Hey @cheng-he-70a75c,

Apologies, I’m not sure we have enough information to investigate what’s happening in this case.

Can you provide debug logs reproducing the issue?

Badge

Thanks for reaching me.

After following the sandbox test in iOS, (especially using StoreKit), then it worked.

Best.

Badge +2

I’m having the same issue here. Using Expo w. React Native.

When calling: `const result = await Purchases.purchaseStoreProduct(product)` Promise neither rejects nor resolves and thus subsequent statements are not executed.

This happens on physical iOS device. Haven’t tested on Android just yet.

Badge +2

Actually, I fixed my issue. I was mistakenly calling Purchases.configure mutliple times as the call was located in a custom hook.

I moved Purchases.configure outside my component tree into the root file and instead called Purchases.logIn inside my custom hook to add the appUserId.

Works as expected now 👍

Reply