dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.75k stars 632 forks source link

Cannot connect to iTunes store #875

Closed syedmuhammadwaqas closed 3 years ago

syedmuhammadwaqas commented 4 years ago

Version of react-native-iap

4.3.0

Version of react-native

0.61.5

Platforms you faced the error (IOS or Android or both?)

iOS 13 and later

Expected behavior

It should go for purchase or restore the product but it is getting error. Code: try{ const purchases = await RNIap.getAvailablePurchases(); if (purchases && purchases.length > 0) { this.setState({isLoading: false}); Alert.alert('Restore Successful'); }else{ this.requestPurchase(itemSku); } }catch(err){ Alert.alert(err.message); } After this it's going to catch with error "E_UNKNOWN Cannot connect to iTunes Store" while user did not clicked any option.

Tested environment (Emulator? Real Device?)

I tested on both and behavior is same.

AppStore Review

We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 13.2.3 on Wi-Fi.

Specifically, an error message was displayed when we attempted to purchase.

Next Steps

When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead.

Resources

You can learn more about testing in-app purchase products in your development sandbox environment in App Store Connect Developer Help.

For more information on receipt validation, please see What url should I use to verify my receipt? in the In-App Purchase FAQ.

Learn how to generate a receipt validation code in App Store Connect Developer Help.

Please see attached screenshot for details.

Screen Shot 2019-12-13 at 2 27 06 AM
mustafaaksoy commented 4 years ago

same issue...

ctohster commented 4 years ago

same, anyone solved?

messivite commented 4 years ago

I resolved this issue

syedmuhammadwaqas commented 4 years ago

I resolved this issue

How, can you share ?

leelandclay commented 4 years ago

There's nothing really to solve here. It's a notification that the User canceled. Change your error listener to check for that code (E_USER_CANCELLED) and if it is returned, don't activate the subscription or provide the service and then let it fail quietly.

If you had not made any state changes in the purchase call, just add this:

if (error.code === "E_USER_CANCELLED") { return; }

as the first line of the listener's call block. That will just simply return back to the screen they were on. If you need to make changes to the state first, then instead of return; use something like this

if (error.code === "E_USER_CANCELLED") { 
  this.setState({ subscription: undefined, userCancelled: true, whateverElse: 'completed' }, () => { return; });
Burkazoid commented 4 years ago

+1 - also experiencing this issue.

There's nothing really to solve here. It's a notification that the User canceled. Change your error listener to check for that code (E_USER_CANCELLED) and if it is returned, don't activate the subscription or provide the service and then let it fail quietly.

That's not the code in his original post.

stale[bot] commented 4 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

mustafaaksoy commented 4 years ago

This problem sandbox user only run Testflight app. I tested my app on testfligt. its working.

stale[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

L-Yeiser commented 3 years ago

We see this error consistently in tesflight but intermittently on production. Anyone find any solutions?

stale[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

stale[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

stale[bot] commented 3 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.