IAP google play buying product twice

Hi

How I can use sdkbox iap and buy some product twice or more? The products in google play seems to be restricted to one time buy only.

Cheers

1 Like

SDKBOX IAP will automatically consume the IAP, so you can by it again.
Unless you marked it as non-consumable

http://sdkbox-doc.github.io/en/plugins/iap/v3-cpp/#configuration

Thanks Nite but I’m trying to buy the same item again and I got this error:
In-app billing error: Unable to buy item, Error response: 7:Item Already Owned

Is there some time that I need to wait before buying again?

Nite can you help?

Interesting, it should be consumed automatically, are you testing with google’s test iap item?

I’m using Managed product in iap google play.
I’m testing on my test user, I think there is no additional option for IAP item in Google play.
I can buy it once but than no more.
I’m using IAP plugin 1.6

Nite any suggestions?

Nite why you just didn’t write to use version 1.2 because it was fixed there?

I think SDKBOX IAP always auto consume google play purchase. Did 1.2 solved your issue?

Yes. Thanks :slight_smile:

I’m running into this problem as well. I’ve updated to the latest version of the IAP plugin and SDKBOX, but it seems like a few of my consumable items are “stuck” in a bad state. I think this is because during earlier testing, the purchase flow errored before the items could be consumed.

When the app starts, the “broken” IAP items are listed as owned, but they should have already been consumed.

08-07 11:56:14.577: D/IabHelper(11366): Sku is owned: bux_1000
08-07 11:56:14.575: D/IabHelper(11366): Sku is owned: ads_removed
08-07 11:56:14.581: D/IabHelper(11366): Sku is owned: bux_5000

When I try to buy them again, I can’t– because they are “already owned”:

08-07 11:55:13.914: D/SDKBox IAPGooglePlay(10942): payForProduct invoked bux_1000
08-07 11:55:13.916: D/IabHelper(10942): Constructing buy intent for bux_1000, item type: inapp
08-07 11:55:13.921: E/IabHelper(10942): In-app billing error: Unable to buy item, Error response: 7:Item Already Owned
08-07 11:55:13.921: D/SDKBox IAPGooglePlay(10942): Error purchasing: IabResult: Unable to buy item (response: 7:Item Already Owned)

My sdkbox_config.json doesn’t list them as “non_consumable”:

      "iap": {
            "items": {
                "bux_5000": {
                    "id": "bux_5000"
                },
                "ads_removed": {
                    "type": "non_consumable",
                    "id": "ads_removed"
                },
                "bux_1000": {
                    "id": "bux_1000"
                }
            },
     ...

I think the root cause of the bug is that when the IAP plugin starts, it doesn’t check to see if any of the owned sku’s are actually consumable items that should have already been consumed and consume them all right away.

Versions:

iap
    v1.2.0.1
        (installed) sdkbox-iap_v1.2.0.1
    v1.2.1.0
        (available) sdkbox-iap_v1.2.1.0_for_v2.tar.gz
        (installed) sdkbox-iap_v1.2.1.0.tar.gz
    v1.2.1.1
        (installed) sdkbox-iap_v1.2.1.1
    v1.2.1.8
        (installed) sdkbox-iap_v1.2.1.8

SDKBOX
    v0.5.6.11

Any help is appreciated!

Thanks

Try terminate and restart your app, sometimes google play items will stuck in this state and it’s just owned in iap local cache.

How often does this problem occur? Can it be solved differently?

It’s not obvious to the normal user to fix this problem by restarting the app. He will only complain about a non working IAP.

This old thread mentions that error after a connection interruption:
https://code.google.com/p/marketbilling/issues/detail?id=121

That’s why you should always query inventory on app start and process/consume any pending items.

Is SDKBox already handling that?

SDKBOX will auto consume the item if it’s already owned. But sometime, if developer already refund the item, it will break.

Killing the app and trying again didn’t solve the problem immediately, but I tried making the purchase again two days later and everything went through smoothly. Something might have been cached within the Google Play Services app or on Google’s servers that took some time to clear up.

Thanks for the reply, @nite. I appreciate all of your hard work!