question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IapHub.buy() doesn't return anything

See original GitHub issue

When I try to use the buy() method it doesn’t do anything after the purchase is done, blocking me from doing anything after it. It seems as if the promise is never finished, the code never reaches console.log(transaction) or finally {}. This used to work a couple of days ago. I do see they receipt in the IAPHUB dashboard though.

try {
  const transaction = await IapHub.buy('product_sku')
  console.log(transaction)
} catch (err) {
  console.log(err)
} finally {
  console.log('finally done')
}

I also see this in the Xcode logs:

 Purchase Started !!
2020-07-23 00:09:26.745113-0400 Development[1039:184402] 




 Purchase Successful !! 




.

So the purchase is successful.

react-native-iaphub v3.0.9 react-native-iap v4.4.3 react-native v0.63.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
iaphubcommented, Aug 5, 2020

We pushed a PR to fix the issue in react-native-iap (here) 🙂 The issue should be fixed in the latest version of react-native-iaphub we released (v4.1.0), if it doesn’t work be sure you have the latest version of react-native-iap (v4.5.2).

0reactions
iaphubcommented, May 28, 2022

Hi @scipilot,

We’ve seen iOS bugs (not because of the IAPHUB library) like this one in the sandbox environment (not happening in production), especially on older versions of iOS. If it happens you should either try to restart the device or create a new sandbox iTunes account. But it seems like you were able to resolve the issue 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-iaphub/README.md at master - GitHub
The easiest way to implement IAP (In-app purchase) in your React Native app. - react-native-iaphub/README.md at master ...
Read more >
Blog | IAPHUB
The react-native-iaphub is already doing that pretty well but we've decided to ... and doesn't return subscriptions on a paused or retry period...
Read more >
react-native-iaphub - npm
This method will only return the transactions that were not already on IAPHUB (pretty handy to know how many transactions have been restored)....
Read more >
Reasons for SKProductsRequest returning 0 products?
In the sandbox I had everything working, there was no indication that there was anything anything wrong, even with an optimized release build....
Read more >
React Native : Subscriptions, In-App Purchases & Service ...
If for debugging you want to consume all items, you have to iterate over the purchases returned by getAvailablePurchases() . Beware that if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found