IAP plugin “This In-App Purchase has already been bought. It will be restored for free.” issue

Hi,

I’m using IAP plugin in iOS device.

All my goods are consumable.

I got user’s feedbacks about “This In-App Purchase has already been bought. It will be restored for free.” popped out in iOS devices.

After some search, this may be helpful. http://greensopinion.com/2017/03/22/This-In-App-Purchase-Has-Already-Been-Bought.html

Is it possible to fix this issue in SDKBOX lib only?

Or should we take care the issue by ourself? If so, please give us some steps.

Thanks,

Jo

En,
You need to add a menu ‘Restore’ in your game, and call IAP::restore();

But it’s consumable goods. not non-consumable…

Can you double check your iTunes connect? If you see that message it means it’s non-consumable. Only set it in sdkbox_config.json is not enough.

Yes, I’m sure that is consumable.

please check this link https://stackoverflow.com/questions/26937195/in-app-purchase-when-trying-to-buy-consumable-product-again-this-in-app-purc

Jo

Ok, we have to look into it a bit more

have u call enableUserSideVerification(false) ?
Is there any crash ?

I set sdkbox::IAP::enableUserSideVerification(true);
No crash found, but it’s an user feedback, cannot be so sure.

Thanks,
Jo

Hi

Is there any update for this issue?

BRs,
Jo

Still can’t reproduce this issue. If you have steps to reproduce this issue, please let us know.

according to http://greensopinion.com/2017/03/22/This-In-App-Purchase-Has-Already-Been-Bought.html

This scenario can easily occur when an error occurs before calling SKPaymentQueue.default().finishTransaction(transaction).

As I know, it occurs when you bought the goods, but didn’t finishTransaction, maybe because of some network error or crash. Please check your code that if your handle this situation and finishTransaction at some point.

you don’t finishTransaction, then you cannot buy the same goods again.

Ok, maybe some reason, can not get result from server, so did not call finishTransaction. We’ll check the network issue.

I wanna confirm the flow:

  1. send request to Apple server
  2. get receipt from Apple server
  3. call finishTransaction

I’m using the token to send them to my server and verify there, then add goods to users.
When will the callback be called with receipt token?
I thought it was after 3?

yes, it’s right. And you can call

static void finishTransaction(const std::string name);

to finish the transaction.

I don’t understand what you meant.
I though finishTransaction is hidden in your code, no API exposed. (At least in my version)

you said it’s called after finishTransaction, then why should I call it by myself?

What is the exact flow should I follow?

Sorry, I thought u complete the receipt verify by yourself.

Hi
Sorry, maybe I didn’t explain well.

  1. I’m using sdkbox-iap_v2.3.14.3 plugin which has no finishTransaction function in C++ level.
  2. After onsuccess callback, I sent the receipt token to my server, after the server verified it, add goods to user account.

And I encounter the issue I originally posted.

a) in that version v2.3.14.3, at what timing do you call finishTransaction in iOS SDK?
b) how should I fix it?

I encounter the issue too. It is sdkbox bug for IAP.
My IAP don’t verify with server. It is a local game.
I can reproduce the case easily by the following steps:

  1. click the “buy” button.
  2. send request to Apple server by sdkbox sdk.
  3. kill the game by memory warning , let the game killed. (this will caused the finishTransaction function be not called, and the user can’t get any goods from IAP , although the user did purchase success . )
  4. When you restart the game, it will popup out “This In-App Purchase has already been bought. It will be restored for free.” in your iOS devices. And you the user can’t buy the items again.

PS: All my goods are consumable too.

I tried to find some solution but found It have to call the Object C code and this will interrupt the C++ code flow.
Is it possible to fix this issue in SDKBOX lib only?

2 Likes

I checked this issue with 2.3.17.3

precondition

test item is consumable

two cases

TEST ONE

  1. click ‘pucharse’ item
  2. click ‘buy’ button in system IAP dialog
  3. kill the game in Xcode
  4. start the game before “Your purchase was successful.”
  5. got onSuccess called
  6. click ‘purchase’ item
  7. (steps 1~4)
    works fine

TEST TWO

  1. click ‘pucharse’ item
  2. click ‘buy’ button in system IAP dialog
  3. kill the game in Xcode
  4. will for “Your purchase was successful.” message on Home screen
  5. start the game
  6. got onSuccess called
  7. click ‘purchase’ item
  8. (step 1~4)
    works fine.

“This In-App Purchase has already been bought. It will be restored for free.” did not popup with the two cases.

Is it possible that we can have access to your game, so we can try it out as well?