问题
Is there a way to do more than 1 item using in-app purchase? For example - can I buy 2 of the same item?
回答1:
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.
回答2:
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.
回答3:
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
来源:https://stackoverflow.com/questions/8660646/android-in-app-multiple-purchases