Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IapHub.buy() doesn't return anything #20

Closed
corasan opened this issue Jul 23, 2020 · 11 comments
Closed

IapHub.buy() doesn't return anything #20

corasan opened this issue Jul 23, 2020 · 11 comments

Comments

@corasan
Copy link

corasan commented Jul 23, 2020

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

@captaincole
Copy link

captaincole commented Jul 29, 2020

I'm seeing a similar issue. After connecting to a debugger and testing in a sandbox I'm getting a Error: Transaction not found Error sometimes. I'm on react-native v0.62.1 and iaphub v3.0.7

Update: I upgraded to 3.0.9 and still see the same issue.

Note: I am running this on iOS 14 beta 2. I don't believe that is the cause of this issue though.

Update #2: I upgraded to 4.0.0 and am still seeing the issue that Iaphub.buy() never resolves.

@iaphub
Copy link
Owner

iaphub commented Aug 1, 2020

Hey @corasan, we tried to analyze what could cause the issue with @captaincole but we haven't found the culprit yet (can't reproduce the issue on our side), still digging...
Do you still have the issue?

@captaincole
Copy link

@corasan I believe I have solved the issue. It was specific to iOS 14.

#21

@iaphub
Copy link
Owner

iaphub commented Aug 2, 2020

Awesome @captaincole 🙂
I'm going to investigate why exactly the promise of requestSubscription of the react-native-iap package isn't resolving on IOS 14.
Removing await might cause another issue, we won't be able to catch some errors that are asynchronous.

@corasan
Copy link
Author

corasan commented Aug 3, 2020

@iaphub yeah I still have the issue on version 4.0.2 too

@iaphub
Copy link
Owner

iaphub commented 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).

@iaphub iaphub closed this as completed Aug 5, 2020
@fogg4444
Copy link

fogg4444 commented Nov 24, 2020

I'm seeing this problem too:

"react-native-iap": "4.6.3",
"react-native-iaphub": "5.1.0",
"react-native": "0.61.5",

ios 14.2 (yes, running on the real device)
xcode: Version 12.2 (12B45b)

@iaphub
Perhaps a regression?

EDIT:
I've upgraded react-native-iap to 5.0.0 and we're sorted

@iaphub
Copy link
Owner

iaphub commented Nov 25, 2020

Hi @fogg4444, did you fix the issue by updating react-native-iap to 5.0.0?
Weird because the version 5.0.0 only introduce changes to Android.
You were definitely not loading the version 4.6.3 for some reason, did you do pod install?

@AngelDev0329
Copy link

AngelDev0329 commented Mar 1, 2022

I am facing same issue on call Iaphub.buy() on iOS platform.
I can't get any result from them.
How can I solve this issue?

@scipilot
Copy link

scipilot commented May 28, 2022

Hi, I have had the same problem and by comparing different devices I found that it's not launching the iTunes login dialogue.

Using
"react-native-iap": "~5.2.6",
"react-native-iaphub": "~6.4.2",

Using an iPad Mini which is stuck at IOS v12.5.5 (the maximum for this hardware), running from XCode and with the app in sandbox mode, I see " Purchase Started !!" in the XCode output panel, but it never gets past that. No exception is caught, the transaction is never returned, the promise never times out.

When using an iPhone on iOS v15.4.1 with exactly the same app and setup, I get a username/password login dialog popup at the same moment, and after logging in with my sandbox Apple ID account which I setup in appstore connect, it all works.

I had signed out of iTunes on the iPad prior to testing help force this login (as you can't sign in to the iPad iTunes generally with the sandbox account).

So I'm guessing in this case, the iTunes/Store login isn't being displayed for some reason, but the IAP code is kind of waiting for the dialog to be submitted forever? I'm not sure if it's specific to my iPad or if it's iOS v12 which isn't supported by IAPHub 6.4.2? AHA: After finding the general iTunes login in settings was spinning forever too, and then rebooting the iPad, I was presented with the login panel, and then a flurry of Payment Success dialogues for all the tests I'd done! So it seems it was specific to my iPad being stuck in some internal iTunes auth hjiccup. And it was impressive that it resolved itself asynchronously after a reboot.

The requirement of using a real device makes this very difficult to test broadly. Anyway I thought this information might help narrow down the causes for others diagnosing this behaviour.

@iaphub
Copy link
Owner

iaphub commented 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 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants