toto_tata
toto_tata

Reputation: 15432

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 !

Upvotes: 19

Views: 18962

Answers (2)

Bill The Ape
Bill The Ape

Reputation: 3306

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.

Upvotes: 15

SnowyTracks
SnowyTracks

Reputation: 1985

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.

Upvotes: 4

Related Questions