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

How to manually cancel a pending purchase? #615

Closed
tmjordan opened this issue Jul 29, 2019 · 11 comments
Closed

How to manually cancel a pending purchase? #615

tmjordan opened this issue Jul 29, 2019 · 11 comments
Labels
1️⃣ good first issue Good for newcomers 🤖 android Related to android 🙏 help wanted Extra attention is needed ❓ question Further information is requested Stale

Comments

@tmjordan
Copy link

Version of react-native-iap

3.3.7

Version of react-native

0.59.8

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

Android

Expected behavior

when i request a purchase, then i validate the receipt on my server, if the validation failed i want to be able to manually cancel the purchase, instead of the function purchaseUpdatedListener triggered every time, if don't call acknowledgepurchase or consumepurchase.

Actual behavior

when not finishing the purchase, i can not cancel the pending purchase. On android i have to wait that it is cancelled automatically.

Tested environment (Emulator? Real Device?)

Real device

Steps to reproduce the behavior

Make a purchase and don't call acknowledgepurchase or consumepurchase.

@tmjordan tmjordan changed the title How to manually cancel a pending subscription? How to manually cancel a pending purchase? Jul 29, 2019
@hyochan hyochan added 🤖 android Related to android 🙏 help wanted Extra attention is needed ❓ question Further information is requested labels Jul 29, 2019
@hyochan
Copy link
Member

hyochan commented Jul 29, 2019

Even the failure result, you should still call acknowledgePurchase and consumePurchase for finished transaction. You only not proceed logic such as not giving a reward on your own database. Also, you should consmePurchase so that it does not remain in your app.

@hyochan hyochan closed this as completed Jul 29, 2019
@tmjordan
Copy link
Author

@hyochan if i do that, the payment will be approved and the user account will be charged without getting rewarded.

@hyochan hyochan reopened this Jul 30, 2019
@hyochan hyochan added the 1️⃣ good first issue Good for newcomers label Jul 30, 2019
@hyochan
Copy link
Member

hyochan commented Jul 30, 2019

@tmjordan Oh, I see what you meant. What if you proceed logic by giving a reward then?

@tmjordan
Copy link
Author

@hyochan when a user purchase a product, the given receipt is sent to google servers in order to validate the receipt and to get the status of the purchase (if the payment has been approved , or is pending, or cancelled).
Let say i have an error during the validation process not coming from the google server (my backend for example), so i can't validate the receipt and i want to cancel the purchase manually instead of waiting for it to get cancelled by google (during that time i can't make another purchase) if i don't call aknowledgepurchase or consumepurchase.
Don't know if it is possible, maybe that's just how the purchasing process works on google.

@tmjordan
Copy link
Author

It would be nice, if we can manually cancel a purchase which has not been yet acknowledged or consumed. In that scenario the user will be refunded if the payment had been approved.
Instead of having the same purchase triggered every time until it get cancelled by google.

@hyochan
Copy link
Member

hyochan commented Aug 1, 2019

@tmjordan Thanks for your good point of view. Sounds very reasonable but I am not quite sure that pending purchases are actually charged. I think the pending purchases should not even be charged when acknowledged and rather these should be removed. Hope we can go over more details on any other experiences.

@tmjordan
Copy link
Author

tmjordan commented Aug 2, 2019

@hyochan, Is there a functionnality like that on iOS, in order to cancel a purchase which has not been completed by calling finishTransactionIOS and then having that purchase being removed from the purchase history. I don't know if there is another way to check if a subscription is still active, but what i do now is to check the expiration date for the last transaction in the receipt history. So if a purchase has not been completed, i don't want it to being recorded in the purchase history. Unfortunately at the moment, that's exactly what's happening. And unlike Android the incompleted purchase will not be cancelled after some time and it will never stop being triggered by the purchaseUpdateListener.

So i have the same problem on ios and android, i need to cancel a purchase which has not been completed. And specifically on ios, not having that purchase being recorded in the history unless if there is a more efficient way to check the validity of a subscription.

@raiss
Copy link

raiss commented Aug 18, 2020

I would like to handle similar scenario

  1. User Start the purchase of a (time sensitive) product. This product should be returned immediately
  2. Server fails to return the product. and it may be late to return the product by retrying
  3. the purchaseUpdateListener gets triggered many times until finishTransactionIOS is called however this is not the desirable results. The transaction should be cancelled at this stage.

Is there a method to cancel the transaction.

@stale
Copy link

stale bot commented Jun 9, 2021

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 stale bot added the Stale label Jun 9, 2021
@stale
Copy link

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.

@stale stale bot closed this as completed Jul 21, 2021
@trickeyd
Copy link

trickeyd commented Sep 8, 2022

Hey - I don't believe this issue should have been closed - it seems to me that this is a critical bit of functionality. Was something implemented that can achieve this in the latest version? I see no mention of it in the docs.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1️⃣ good first issue Good for newcomers 🤖 android Related to android 🙏 help wanted Extra attention is needed ❓ question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

4 participants