Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I purchase multiple items at one time through Google Play in Android App?

In my mind, I can only puchase one item at one time in Google App.

The Code A is from the project play-billing-samples, you can see here.

purchases: MutableList<Purchase> maybe exist multiple items, it seems that I can purchase these items simultaneously through Google Play, right?

Code A

override fun onPurchasesUpdated(
        billingResult: BillingResult,
        purchases: MutableList<Purchase>?
) {
    when (billingResult.responseCode) {
        BillingClient.BillingResponseCode.OK -> {
            // will handle server verification, consumables, and updating the local cache
            purchases?.apply { processPurchases(this.toSet()) }
        }
        BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> {
            // item already owned? call queryPurchasesAsync to verify and process all such items
            Log.d(LOG_TAG, billingResult.debugMessage)
            queryPurchasesAsync()
        }
        BillingClient.BillingResponseCode.SERVICE_DISCONNECTED -> {
            connectToPlayBillingService()
        }
        else -> {
            Log.i(LOG_TAG, billingResult.debugMessage)
        }
    }
}
like image 836
HelloCW Avatar asked May 20 '20 07:05

HelloCW


People also ask

Is there a purchase limit on Google Play?

It turns out that you can set a limit for spendings on Google Play that can prevent you from making impulsive purchases. This setting leaves under Account > Purchase history.

Can you use Google Play for in-app purchases?

As part of Android's June quarterly update, Google Play will be getting a nifty new feature that will allow you to use your accrued Play Points to pay for in-app purchases without ever leaving your app or game.

How does in-app purchase work on Android?

Before downloading an app, you can check if it offers in-app purchases: On the Google Play Store app, in-app purchases will be by the Price or Install button. On play.google.com/store, you'll see "Offers in-app purchases" below the name of the app.

How much does Google charge for in-app purchases?

Tech giant Google said that it will enforce its Google Play rules that require all app developers on the Play Store to use its in-app payment system. With this move, all Android developers will use Google's billing system which takes a 30 percent fee from payments. So what qualifies for in-app purchases?


1 Answers

An user can own the same in-app item only once, but he can own different items at the same time.

Other solution is to consider the item as consumable:

if billingClient.consumeAsync() is called at the end of the purchase process then he can buy the same item again, but you have to keep track of how many times he bought it by your own means, probably through a backend server.

like image 150
from56 Avatar answered Nov 14 '22 23:11

from56