react-native-iap: Doesn't let rebuy Android item on test account
Version of react-native-iap
0.3.10
Platforms you faced the error (IOS or Android or both?)
Android
Expected behavior
Should be able to rebuy an item as many times as I need since I’m just testing
Actual behavior
Returns
Error: You already own this item.
at createErrorFromErrorData (59522b9c-ca17-4e00-9e00-05cc989b1199:2016)
at 59522b9c-ca17-4e00-9e00-05cc989b1199:1968
at MessageQueue.__invokeCallback (59522b9c-ca17-4e00-9e00-05cc989b1199:2410)
at 59522b9c-ca17-4e00-9e00-05cc989b1199:2155
at MessageQueue.__guardSafe (59522b9c-ca17-4e00-9e00-05cc989b1199:2323)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (59522b9c-ca17-4e00-9e00-05cc989b1199:2154)
at t (RNDebuggerWorker.js:1)
Steps to reprodue the behabior
Buy an item more than once using a test account
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (7 by maintainers)
@kaushil111 I was able to consume/flush them like this
I was running into the same issue as @ilyakar, and using the code below I was able to clear the non-consumable purchase and test it again.
I ran into this earlier today and after digging through the code I found that a pretty straight-forward option is to call
finishTransaction(purchase, true)There is a more complete code snippet below.
I hope this helps someone. 🙂
@TylerNoblett This solution isn’t working right now.
consumeAllItemsAndroidinstead ofconsumeAllItems. Any further help is appreciated.@ilyakar Is this a consumable product? You should consumeItem to rebuy it. Please read some guides on how IAP works in android.
Hi @dooboolab, I was just responding to @deadcoder0904 with my previous knowledge. I’m afraid I have not tried your solution and probably won’t for some time since it’s not an urgent fix. But I will let you know in the future when I have.
Yes @deadcoder0904, that’s the whole concept of Android test accounts (https://developer.android.com/google/play/billing/billing_testing.html). Which do work fine with the plugin, but as I have pointed out, you cannot make the same purchase twice.