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
getAvailablePurchases returns different array every time #634
Comments
I am also seeing this. The really dangerous thing about it is there is a chance that the most recent valid receipt might not be in the results. |
From looking at this modules code it honestly looks like an issue on Apple's side since this module is effectively just passing through whatever |
I wonder if As stated in the iap docs on this package, |
I found getPurchaseHistory() gave varying array lengths as well. Seemed like frequency of requests effected it. In the end it turned out this didn't really matter for us, once any of the transaction receipts was sent up for validation all receipts were returned by Apple in the |
I'm having the same issue (don't know if it is sandbox mode error). Also, when I switch apple id within a real device the purchase made with another account gets returned. Ex: Another issue that I found is that if I restore the device (factory reset) both methods Apple's response for restoring a purchase is:
|
Found a Apple Developer Forums topic about the varying results of https://forums.developer.apple.com/thread/115242 Maybe, this is related:
I've had other sandbox accounts on the same device. So could it be the transactions of different accounts, on the same device, are just messed up and not "finished" at all? However, I did run a loop on all the transactions, and called Could also explain what @fcandiani experiences.
Thanks for the info @ssg-luke , i'm gonna do the same. |
I also ran a loop on all the transactions, and was not able to remove them with finishTransactionIOS. My transactions are auto-renewing subscriptions. |
Facing almost the same. I was creating a issue, but, decided to put here all the information to help others to find the problem and solution. Version of react-native-iap3.5.9 Version of react-native0.60.5 Platforms you faced the error (IOS or Android or both?)iOS
Expected behaviorUser subscribed once, Actual behavior
Tested environment (Emulator? Real Device?)Real device with fresh sandbox account. Steps to reproduce the behavior
This doesn't seem to be the right behavior, from what I read on docs and from what happens on Android. I appreciate any help. |
getAvaialblePurchases() is returning 150+ results on my sandbox test account. I have decided not to use getAvailablePurchases() at all and just store last purchase on the device and also on the server. If app is deleted or user moved to new phone, we will still have last purchase on our server tied to our company user id & platform (iOS or Android). Calling getAvailablePurchases() taking close to a minute and sometimes calling this triggering purchase updated listener trying to restore multiple purchases. We have modified our flow like this:
|
@ramakula and what if the user cancels his subscription? The way you told, you will keep the subscription on your database until the end date, and will "see" that's not available purchase anymore. |
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. |
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. |
I believe we can get the latest purchases from the receipt. By verifying the receipt of a user, with exclude-old-transactions: true we can get the latest subscription info (only for auto-renewable type). I believe we can use this method to restore auto-renewable subscription purchases. I'm not sure if this is an ideal method though. |
Version of react-native-iap
3.3.9 (but also experiences this in 3.0.0 and before)
Version of react-native
0.59.9
Platforms you faced the error (IOS or Android or both?)
iOS (not tested on Android)
Expected behavior
Same array every time I call
getAvailablePurchases
Same array length every time
Actual behavior
Different array every time i call
getAvailablePurchases
Different array length every time i call
getAvailablePurchases
Tested environment (Emulator? Real Device?)
Real Device
Steps to reproduce the behavior
I think this is only visible with a lot of transactions, but can't confirm this. My Sandbox account has 50+ transactions.
With the above code, when I press "Restore purchase", i get different logs every time:
Pressing "Restore purchase" 6 times, with a wait in between to let the results come in:
I would expect the array to always be the same, right? What's happening here?
The result of
getAvailablePurchases()
is different every time i run itThe text was updated successfully, but these errors were encountered: