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.

getAvailablePurchases() should throw meaningful error in case of purchases are denied

See original GitHub issue

Version 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Yann-prakcommented, Mar 19, 2021

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.

0reactions
stale[bot]commented, Jul 20, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

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