dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.81k stars 641 forks source link

getPurchaseHistory and getAvailablePurchases consume purchase without calling finishTransactionIOS #808

Closed brianephraim closed 3 years ago

brianephraim commented 4 years ago

Version of react-native-iap

3.4.0

Version of react-native

0.60.5

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

IOS ( __DEV__ mode only so far)

Expected behavior

getPurchaseHistory and getAvailablePurchases do not affect purchases, they just report

Actual behavior

Calling getPurchaseHistory and getAvailablePurchases will consume previously unconsumed consumable purchases

Tested environment (Emulator? Real Device?)

Real device DEV mode

Steps to reproduce the behavior

hyochan commented 4 years ago

@defualt Would you like to try removing these lines?

brianephraim commented 4 years ago

Removing those lines, calling getAvailablePurchases and getPurchaseHistory results in empty array. However the purchases do not get consumed because when I reset the app, purchaseUpdatedListener logs the recent unconsumed purchase.

brianephraim commented 4 years ago

deleting just this line has the desired effect but I don't know if this breaks something else. https://github.com/dooboolab/react-native-iap/blob/e33d06f6ac44f6bf80de7a32d7ace2863f4e4cfe/ios/RNIapIos.m#L429

roberto-buratti commented 4 years ago

I'm experiencing the same issue. In fact there are a lot of points in the code where [...finishTransaction:..] is called even if the app never calls .finishTransaction().

IMHO this is a serious bug that has to be fixed as soon as possible.

What if my customer makes a purchase but do not consumes it immediately (...there are zillions of reason why this may happen in a real application..)? Today, the net result is that any pending transaction is immediately finished even the purchase has not been consumed, which may imply (and actually does) money loss for the customer.

Please fix it ASAP.

roberto-buratti commented 4 years ago

Moreover... this is a signal of another bug: even if the transaction has been finished without request, getPurchaseHistory() should return it but it doesn't...

So, we have no way to work around the problem.

roberto-buratti commented 4 years ago

any news about this?

stale[bot] commented 4 years ago

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.

roberto-buratti commented 4 years ago

Stale? not at all, we are still waiting for a fix.

mcchrish commented 4 years ago

Yes, this is a real issue I'm experiencing as well. Seems to be a critical bug if so.

jplandry908 commented 4 years ago

I agree, this is a significant issue. Once you verify the purchase once it disappears and cannot verify it again. This is very problematic for lifetime purchases.

jplandry908 commented 4 years ago

@defualt Would you like to try removing these lines?

FYI - Removing these lines seemed to fix the issue.

roberto-buratti commented 4 years ago

Please fix it!!...

hyochan commented 4 years ago

@defualt Would you like to try removing these lines?

FYI - Removing these lines seemed to fix the issue.

@emilioicai Could you kindly tell the effect of removing these lines?

I'll try to remove this and deploy new version if there isn't any answer.

jplandry908 commented 4 years ago

FYI - Removing the lines worked for me a while back, and I am using it in production. I just need to remember to make the change again for any future upgrades unless it is updated in the next release.

hyochan commented 4 years ago

FYI - Removing the lines worked for me a while back, and I am using it in production. I just need to remember to make the change again for any future upgrades unless it is updated in the next release.

Thanks for your confirm. I'll try to manage to remove the lines in next release when I do not get the answer from @emilioicai who've added the code.

jplandry908 commented 4 years ago

Any update on this?

I'm still using an old version with the lines removed and the changes have been working great in production. But it looks like I am falling behind on updates. Since NPM is showing v4.5.3 (https://www.npmjs.com/package/react-native-iap) and the latest GitHub release tag is v4.4.4, it's hare to determine what is changing.

And to be clear, I just verified that this is the only line that I removed. The rest of the for loop and if statement still exists.

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];

stale[bot] commented 3 years ago

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.

jplandry908 commented 3 years ago

This is still an open issue. I still have a patch commenting out this line.

stale[bot] commented 3 years ago

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.

jplandry908 commented 3 years ago

This line is still in the production version of the code. [[SKPaymentQueue defaultQueue] finishTransaction:transaction];

I still have it manually removed in my production applications. Without it, I was not able to receive the purchase history on the device after the purchase was made.

lukebrandonfarrell commented 3 years ago

Still an issue +1

lukebrandonfarrell commented 3 years ago

We should be able to get purchase history without consuming

storrdev commented 3 years ago

@hyochan it looks like @emilioicai has only made a few contributions to github in the past few months, and most of them are to react-native-lottie. Is there an assistance anyone else can provide to help get this patched?

andresesfm commented 3 years ago

finishTransactionIOS has been removed since version 7.2.0 and replaced by a unified finishTransaction that works on both platforms. Please try on version 7.3.0 or newer and let us know. Closing this ticket