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

Ability to know when a SKPaymentTransactionStateDeferred purchase update occurs #1080

Closed
AmauryLiet opened this issue Aug 21, 2020 · 3 comments

Comments

@AmauryLiet
Copy link
Contributor

Version of react-native-iap

4.5.2

Version of react-native

0.62.0

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

iOS

Expected behavior

When a user make a payment with "Ask to buy" enabled (typically with parental controls), the lib receives an event SKPaymentTransactionStateDeferred.
The lib should provide a notification of this updated state, so that the hosting app can display an appropriated UX (similar to Android pending payments).

Actual behavior

The lib doesn't do anything, except some logs

Tested environment (Emulator? Real Device?)

Emulator only (behaviour easier to test with xcode12 and ios 14)

Steps to reproduce the behavior

  1. Run example app with Xcode12 (rc5), on a iOS 14 device
  2. Create a *.storekit file (see WWDC explaination for this new feature if necessary) with "Enable Ask to buy"
  3. Attempt a payment
  4. => no event is forwarded to purchaseUpdatedListener nor purchaseErrorListener

I submit this issue to start a discussion on the desired implementation. Some ideas I would suggest:

  • forwarding this event on purchaseUpdatedListener seems to be the most logical implementation
  • however, we should consider that:
    • this means a breaking change
    • to distinguish the SKPaymentTransactionStateDeferred event from a standard SKPaymentTransactionStatePurchased event, it would require to passe some form of purchaseState for every event (similarly to the existing purchaseStateAndroid

Happy to get your feedback on this one, I plan to submit a pull request for this feature by the start of next week

@iaphub
Copy link
Contributor

iaphub commented Aug 22, 2020

Hi @AmauryLiet,

That's indeed something we have to implement in react-native-iap, it's been some time I have this one on my todo list.

Since there is no receipt to validate when receiving a deferred state, maybe we could send an event in the purchaseErrorListener with an error code transaction_deferred ?
Would be easy to catch the error and display the appropriate message.

We wouldn't have to add any new property to return the state and we wouldn't have any breaking change.

@AmauryLiet
Copy link
Contributor Author

Makes a lot of sense. I opened a PR with your recommendation: #1083

@AmauryLiet
Copy link
Contributor Author

Fixed by #1083

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

No branches or pull requests

2 participants