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.

iOS: This in-app purchase has already been bought.

See original GitHub issue

Version of react-native-iap

"react-native-iap": "^2.0.3",

Platforms you faced the error (IOS or Android or both?)

iOS

Expected behavior

Makes a purchase

const purchase = await RNIap.buyProductWithoutFinishTransaction(productId) const { transactionReceipt, purchaseToken } = purchase sendToServer(transactionReceipt, { onSuccess: () => { RNIap.finishTransaction() RNIap.consumeAllItems() }})

Actual behavior

Dialog: “This in-app purchase has already been bought”. This is only happening for one SKU, others are working fine. I think the app got in a bad state and I don’t see a way to fix it. I tired to call finishTransaction and consumeAllItems on initialization but that didn’t fix it. Other SKUs I can purchase multiple times without issue. Nothing is returned for getPurchaseHistory.

Tested environment (Emulator? Real Device?)

Device (sandbox)

Steps to reproduce the behavior

I’m not sure.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
sivrihuseyincommented, Sep 16, 2018

It is fixed with the version 2.2.0 by applying clearTransaction function. Thank you @JJMoon

3reactions
siderakiscommented, Sep 14, 2018

I was calling this native code.

When I called it in didFinishLaunchingWithOptions currentQueue.transactions was empty, but calling it in applicationDidBecomeActive worked.

This worked:

- (void)applicationDidBecomeActive:(UIApplication *)application
{
  // take current payment queue
  SKPaymentQueue* currentQueue = [SKPaymentQueue defaultQueue];
  [currentQueue restoreCompletedTransactions];
  // finish ALL transactions in queue
  //  [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
  [currentQueue.transactions enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
    [currentQueue finishTransaction:(SKPaymentTransaction *)obj];
  }]; 
}

I’m not sure how but maybe we can expose this functionality in the library?

Read more comments on GitHub >

github_iconTop Results From Across the Web

"this in-app purchase has already … | Apple Developer Forums
Tap 'Buy' to download it again for free." - If the user taps 'Buy' then a new transaction will be sent to updatedTransactions...
Read more >
iOS "This in-app purchase has already been bought" pop-up
It was saying that it had already been purchased, it would restore for free, but not let me buy another subscription extension. Part...
Read more >
"This In-App Purchase has already been bought. It will be ...
An error happens that you pay for the pack but don't get it and It remain unlock, but when you try to buy...
Read more >
Since beta 2, “This in-app purchase has already been bought”
So I play rise of kingdom's, and I can't buy the daily supply upgrade etc. it resets every day for purchase, however I...
Read more >
[iOS] Continually receiving a "This in-App Purchase has ...
There isn't really anything Bongfish can do except have you try and sign out of your Apple ID and back in, or try...
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