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

[Android - successful pending purchase] Handling lost connection during pending payment success #1082

Closed
AmauryLiet opened this issue Aug 24, 2020 · 1 comment
Labels
🤖 android Related to android 🐛 bug Something isn't working

Comments

@AmauryLiet
Copy link
Member

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?)

Android

Expected behavior

  • the user starts a pending payment (Android)
  • he/she gets offline & close the app
  • the pending purchase is confirmed
  • he/she then get back online
  • he/she opens the app (in this specific order)
    expected:
  • when the app is opened again, the purchase is completed and the product delivered to the user

Actual behavior

unfortunately, no event is sent by rn-iap, but the user is billed (no refund like This test purchase was cancelled because it was not acknowledged.)

Tested environment (Emulator? Real Device?)

Real device (Closed Alpha track)

Steps to reproduce the behavior

  • start a payment with "Slow test card. Approves after a few minutes" on demo app
  • turn on plane mode
  • kill app
  • after 3 minutes, you receive the validation email from the Play Store
  • turn off plane mode
  • reopen demo app
  • => you don't have any event sent on purchaseUpdatedListener, and the purchase if finished in the background

other info:

If do the same process BUT without ever closing the app, I get 2 successful events on purchaseUpdatedListener, which might lead to deliver the purchase twice


I believe the issue is around the strategy of calling consumeAllItemsAndroid (= billingClient.queryPurchases then billingClient.consumeAsync for all items) on sdk load (encouraged in the exemple app)
=> we maybe should not consumme successful payments, but notify in purchaseUpdatedListener instead

Some doc about Android implementation recommendation with indeed suggest using billingClient.queryPurchases but not to consumme all items blindly

@hyochan
Copy link
Member

hyochan commented Sep 26, 2020

Closes vis #1085

@hyochan hyochan closed this as completed Sep 26, 2020
@hyochan hyochan added 🤖 android Related to android 🐛 bug Something isn't working labels Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Related to android 🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants