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
purchaseUpdatedListener being called multiple, sometimes 20+ times #1104
Comments
Same for me, but I call purchase flow in action
|
I have 4 test products and I receive |
Tried finish those transactions but still multiple calls |
Is the item an auto-renew? I think what is happening is because it's in the sandbox the renew period is only 5 mins for my monthly subscription. So apple will send an event on each renew, so if the app was closed for 10 mins, that's 2 notifications I'll get when the app opens. Can anyone confirm this is the expected behavior to get notifications on an auto-renew and not just on the purchase? |
My purchase is one time consumable |
Same here. At every auto-renew event, I receive the actual auto-renewable subscription and a few seconds later I receive a big chunk of 135 purchase objects from the At the next auto-renew event, that big chunk of transactions is increasing (136, 137,...). The transactions are only my auto-renew subs. None of my consumable/non-consumable products appear on the list. |
Same here, I confirm it calls the listener the same amount of times as the number of purchases in the purchase history. |
I have some problem. It is happening only when subscription is enabled. |
I had a similar experience with iOS 14. My app sells an auto-renewal subscription. The following link may be relevant to this issue. |
take a look this post |
#1160 (comment) |
I am seeing the same as mentioned here: #1172 (comment). |
On android, after a requestPurchase, the purchaseUpdatedListener is called exactly 3 times with the same payload and I therefore make 3 circles of "give rewards in backend -> finish transaction". The first time it is all good but the second and third time they fail because the transaction is finished the first time. On IOS it's all good, only one time the purchaseUpdatedListener is called.The purchase history in empty. |
Can somebody please validate this is the case in |
@andresesfm I am encountering this issue on My code (note, I'm testing Android right now so I'm only using
result:
note 1 - I have attempted purchases many many times this morning, and after each attempt the number of these loops increases On the surface it does seems possible the purchaseUpdatedListener is not getting removed properly, and maybe this is happening because I have been hot reloading the app? Thanks for looking into this! |
@marcpechaitis thank you for the details. I have created a PR with fixes to multiple billing clients being created: #1388 this could be the solution to your problems. Any help testing it would be appreciated. |
@andresesfm awesome thanks for the hard work on this! I've been out of town and am just now able to get back at this. I have a question about your PR (#1338) -- I reviewed your changes and I see the recommendation related to the connection lifecycle and, essentially, "connect/init as soon as you can, not right before you need it" which makes sense... but does the High-level: I have 2 screens where I'm using |
@andresesfm I'm having issues trying to get your fork to work in my project:
(I'm don't have tons of experience with git, so I appreciate any advice you can give to help me proceed?) Here is how I tried to use your fork:
|
@andresesfm I just wanted to report back that I made some changes and have stopped seeing the "purchaseUpdatedListener being called multiple times" issue on my end (despite not using your fork). I took the advice in the documentation of your fork and removed a couple extraneous calls I was making to |
Probably the best solution is - on iOS call a chain of |
Thank you all for the info. I'm closing it, but feel free to reopen if needed |
I'm using latest version 12.10.2 and still getting this problem. Can you please help me out? |
Getting the same problem here... .Will probably need to code a workaround.... Maybe have a timeout that prevents a second trigger of the assigned side effect. |
In getting the same issue on latest version ios |
So here's my solution with comments:
|
Another update: I noticed that the multiple binding only happens at the very start of the App. If I bind the purchaseUpdate to data that is later fetched, the error does not happen. So I basically accidentally fixed it by having an if-statement and a dependency on data that were later fetched:
|
Issue still exist in the latest version of react-native-iap, purchaseUpdatedListener is getting called multiple times. Please share if someone has resolution for this issue. |
Having the same problem. All works as expected on Android but I'm having issues with this on iOS. |
It seems to happen on Android if you have multiple open connections (which can happen pretty easily when running with Metro, i.e. In my testing, the function passed to |
+1 |
Version of react-native-iap
"react-native-iap": "^4.5.3"
Version of react-native
"react-native": "0.62.0"
Platforms you faced the error (IOS or Android or both?)
iOS (havent tested on android yet)
Expected behavior
purchaseUpdatedListener should only be as called as many times as the component has mounted
Actual behavior
purchaseUpdatedListener was called 20 times in a couple of seconds, every so often when I open the app it get's called multiple times
Tested environment (Emulator? Real Device?)
Real device, sandbox env
Steps to reproduce the behavior
Follow instructions as per main page
I currently have purchaseUpdatedListener being attached to a listener in componentDidMount(), sometimes when I open up my app it will fire multiple times. This is happening on txns that I have called finishTransaction on. Is anyone seeing something like this?
The text was updated successfully, but these errors were encountered: