getAvailablePurchases() should throw meaningful error in case of purchases are denied
See original GitHub issueVersion of react-native-iap
4.5.2
Version of react-native
0.63.2
Platforms you faced the error (IOS or Android or both?)
iOS only
Expected behavior
getAvailablePurchases()
should throw meaningful error and don’t cause pop-up flood.
for error types see also #1179
Actual behavior
if purchase permission are denied in iOS “Settings” App the following happens.
Many annoying pop-ups (“Purchases are denied”) are plopping up about one per second. This is started by a call to getAvailablePurchases()
on app start. Also this function throws E_USER_ERROR
"error": {
"code": "E_USER_ERROR",
"message": "The operation couldn\u2019t be completed. (SKErrorDomain error 4.)",
"domain": "SKErrorDomain",
"userInfo": {
"NSUnderlyingError": {
"code": "1050",
"message": "underlying error",
"domain": "ASDErrorDomain",
"userInfo": {
"NSDebugDescription": "In-app purchases not allowed on this device"
},
...
If the user has denied purchases I don’t want to bother the user with error messages.
Is it possible to ask this permission upfront?
Tested environment (Emulator? Real Device?)
real device
Steps to reproduce the behavior
- deny purchases globally in iOS Settings App
- call getAvailablePurchases()
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to use the react-native-iap.getAvailablePurchases ... - Snyk
getAvailablePurchases examples, based on popular ways it is used in public projects. ... 'ios') return InvalidResult() const purchases = await RNIAP.
Read more >dooboolab/react-native-iap (Raised $40.00) - Issuehunt
clearTransaction() throwing "Cannot finish a purchasing transaction" ... getAvailablePurchases() should throw meaningful error in case of purchases are ...
Read more >react-native-iap - npm
This react-native module will help you access the In-app purchases capabilities of your phone on the Android , iOS platforms and the Amazon ......
Read more >Error Handling | Redux-Saga
In this section we'll see how to handle the failure case from the previous example. ... Promise which gets rejected when the remote...
Read more >React Native Android In App Purchase Error - Stack Overflow
I had the same issue, and even though this is a bit old, I figured it would be useful to provide some support...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
getAvailablePurchases
send all purchases no matter what. Even if they are expired. I’ve tried it in sandbox. When I tried to implement RestorePurchases, it sent me a lot of expired purchases. I don’t know if this is the desired behavior but it is certainly annoying.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.