question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't let rebuy Android item on test account

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (7 by maintainers)

github_iconTop GitHub Comments

12reactions
MHB2011commented, Nov 22, 2021

@kaushil111 I was able to consume/flush them like this

  try {
    await RNIap.initConnection();
    const availablePurchases = await RNIap.getAvailablePurchases();

    availablePurchases.forEach((purchase) => {
      finishTransaction(purchase, true);
    });
  } catch (error) {
    console.warn(
      "Failed to connect to IAP and finish all available transactions"
    );
  }
10reactions
TylerNoblettcommented, Nov 15, 2018

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);
    }
  };

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing in-app billing: "The publisher cannot purchase this item"
A developer cannot purchase anything from herself. To fully test, you will need to create a test account in the Developer Console and...
Read more >
Integrate the Google Play Billing Library into your app
Show the user what they can buy. · Launch the purchase flow for the user to accept the purchase. · Verify the purchase...
Read more >
Android in app purchase issue: You already own this item
Sometimes this happens when there is an error while completing the transaction. Can you do the following: Settings->Apps->All->Google Play Store ...
Read more >
If you can't find or use your in-app purchases - Apple Support
Open the app that you used to buy the item. Look for an option to restore. You might find it in the app's...
Read more >
Retrieving the Android Apps You've Already Paid For
To retrieve the apps, you must use the same Google account you used when you bought them. 1. Launch the Play Store app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found