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

Regis_AG picture Regis_AG · Oct 25, 2011 · Viewed 15.1k times · Source

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 !

Answer

Bill The Ape picture Bill The Ape · Jan 6, 2012

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.