9

Is there a way to do more than 1 item using in-app purchase? For example - can I buy 2 of the same item?

OkyDokyman
  • 3,786
  • 7
  • 38
  • 50
  • Possible duplicate of [Difference between managed and unmanaged in-app product android?](http://stackoverflow.com/questions/9391123/difference-between-managed-and-unmanaged-in-app-product-android) – msangel Oct 28 '16 at 10:40

3 Answers3

5

Creation multiple Products is not correct answer. Because if you planing sell in-game money or "health potions". These things can be purchased an infinite number of times. See the answer about managed/unmanaged products to correct processing this situation.

Community
  • 1
  • 1
iBog
  • 2,245
  • 1
  • 20
  • 15
3

No, not at this time. You can buy multiple unmanaged items, but they'll need to be separate purchases.

As a workaround, I've seen people create separate SKUs for different item quantities. For example:

  • potion_1 = 1 potion ($1)
  • potion_2 = 2 potions ($2)
  • potion_3 = 3 potions ($3)
  • and so on...

Alternatively, you can allow users to buy in-app credits specific to your app (again, you'll need to create different SKUs representing different credit values), then write your own storefront for exchanging these credits for goods. It's a bit more work, but this gives you a lot more control and flexibility over the checkout flow.

Trevor Johns
  • 15,682
  • 3
  • 55
  • 54
2

It's possible

Reference: https://github.com/googlesamples/android-play-billing/blob/master/TrivialDrive/app/src/main/java/com/example/android/trivialdrivesample/MainActivity.java

Basically you must cunsume the item to notify Google about this possibility.

if (purchase.getSku().equals(SKU_GAS)) {
                // bought 1/4 tank of gas. So consume it.
                Log.d(TAG, "Purchase is gas. Starting gas consumption.");
                try {
                    mHelper.consumeAsync(purchase, mConsumeFinishedListener);
                } catch (IabAsyncInProgressException e) {
                    complain("Error consuming gas. Another async operation in progress.");
                    setWaitScreen(false);
                    return;
                }
            }

See the documentation about Consume a purchase

https://developer.android.com/training/in-app-billing/purchase-iab-products.html#Consume

Cícero Moura
  • 2,027
  • 1
  • 24
  • 36