-
-
Notifications
You must be signed in to change notification settings - Fork 647
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
Doesn't let rebuy Android item on test account #126
Comments
@ilyakar Is this a consumable product? You should consumeItem to rebuy it. Please read some guides on how IAP works in android. |
Hi @dooboolab, it's not a consumable product. Users have it forever. There's a way to restore the product so it's good to let users known in production that they cannot buy the same product again since they already bought it. But for testing purposes, it gets very uncomfortable to have to use a different account each time all the purchases have been bought. |
I don't think I had this problem in 0.2.17 |
@ilyakar Ah.. Sorry I was confused. Actually, if it is |
@ilyakar I've got feedback from my friend developer and he also faced the same problem. Therefore, I came up with solution to use P.S. I think above method will work on |
I think this is already solved since I don't think IAP works with Test Account And @dooboolab's solution of One noob question @dooboolab as I have only implemented IAP once in an Android App but never tried if it works 😂 Can we buy a product without spending any money like $0❓ |
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. |
@ilyakar You're saying that it is still not working. Did you tried calling |
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. |
@ilyakar becareful using |
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. async componentDidMount() {
const { itemSkus } = this.props;
try {
const result = await RNIap.initConnection()
console.log('initiated connection?', result)
const consumed = await RNIap.consumeAllItems();
console.log('consumed all items?', consumed)
let products = await RNIap.getProducts(itemSkus);
console.log('loaded products', products)
} catch (err) {
console.warn(err);
}
}; |
@TylerNoblett This solution isn't working right now.
|
The console output is:
On:
|
@tulpn Looks like you've not correctly installed our module since |
@hyochan Didn't work for me. |
@roots-ai What version are you using? Also, please refers to the code we've provided in |
I ran into this earlier today and after digging through the code I found that a pretty straight-forward option is to call There is a more complete code snippet below. import * as IAP from "react-native-iap"
...
const App = () => {
...
useEffect(() => {
const checkCurrentPurchases = async (purchase) => {
if (purchase) {
const receipt = purchase.transactionReceipt
if (receipt) {
try {
const isConsumable = true // if we were dealing with non-consumables this would be false but we aren't.
const ackResult = await IAP.finishTransaction(purchase, isConsumable)
console.info(`Transaction Completed Successfully ${JSON.stringify(ackResult)}`)
} catch (ackError) {
console.warn(`Error finishing transaction ${ackError}`)
}
}
}
}
checkCurrentPurchases(currentPurchase)
}, [currentPurchase])
...
} I hope this helps someone. 🙂 |
seems However, I have facing the already owned error for already purchased items... any ideas ...? |
Facing the same issue. Is there a way to flush already owned items? |
@kaushil111 I was able to consume/flush them like this
|
That worked! Thanks! |
You are a savior it worked like a charm (Y) |
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
Steps to reprodue the behabior
Buy an item more than once using a test account
The text was updated successfully, but these errors were encountered: