Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android in-app billing: what is the "developer payload" and how the "Buy" button works?

I am playing with the Google in-app billing example app "Dungeons".

In this app, I can either click on the "Buy" button to buy something or on the "Edit Payload" button to...edit the payload :). But I don't understand what does this button and what "Edit Payload" means... Can anyone clarify that ?

By the way, can anyone tell me how the "Buy" button fires the buying action as the code in the Dungeons app is the following (the buying action is launched by I don't understand how...):

public void onClick(View v) {
        if (v == mBuyButton) {
            // NO CODE HERE TO DO SOMETHING ???!!!
            if (!mBillingService.requestPurchase(mSku, mPayloadContents)) {
                showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
            }
        } else if (v == mEditPayloadButton) {
            showPayloadEditDialog();
        }
    }

Thanks !

like image 614
Regis_AG Avatar asked Oct 25 '11 14:10

Regis_AG


People also ask

What is developer payload?

A "Developer Payload" is a developer-specified string that contains supplemental information about an order. You can specify a value for this field when you make a REQUEST_PURCHASE request.

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.

What is payload Android studio?

Software payloads allow you to distribute apps to devices. The payload sends the app information and location to the devices for installation.


2 Answers

A "Developer Payload" is a developer-specified string that contains supplemental information about an order. You can specify a value for this field when you make a REQUEST_PURCHASE request.

For example, you can use this key to send index keys with an order, which is useful if you are using a database to store purchase information. Google recommends that you do not use this key to send actual data or content.

For more info see the In-app Billing Reference.

like image 118
Bill The Ape Avatar answered Sep 29 '22 08:09

Bill The Ape


in the if statment the requestPurchase method is called, this does the purchase request then if it fails, the error Dialog box is shown. From there you can also follow the payload down to see how it is used.

like image 39
SnowyTracks Avatar answered Sep 29 '22 08:09

SnowyTracks