Android in-app multiple purchases
Asked Answered
E

3

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?

Eventempered answered 28/12, 2011 at 19:59 Comment(1)
Possible duplicate of Difference between managed and unmanaged in-app product android?Ane
F
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.

Factfinding answered 28/12, 2011 at 20:29 Comment(0)
W
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.

Widow answered 6/6, 2012 at 7:30 Comment(0)
F
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.

Factfinding answered 28/12, 2011 at 20:29 Comment(0)
P
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

Pileus answered 20/9, 2017 at 18:13 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.