19

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 !

toto_tata
  • 14,526
  • 27
  • 108
  • 198

2 Answers2

15

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.

ubershmekel
  • 11,864
  • 10
  • 72
  • 89
Bill The Ape
  • 3,261
  • 25
  • 44
  • 2
    While testing in-app billing, Google is not returning my developer payload! I want it to be included in the signature, but it is returning null for developer payload. I'm trying to purchase the test item android.test.purchased. – Chloe Apr 13 '12 at 01:43
  • @Chloe - did you ever find a solution to this problem? Im running into the same issue. – tamak Feb 08 '14 at 19:34
  • @tamak I don't remember exactly, but I believe the app has to be published first, and possibly it has to be a real item. Test with $1 item. – Chloe Feb 08 '14 at 20:16
  • so we just can ignore it (paste any string which we're not going to use) – user25 May 06 '18 at 18:48
4

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.

SnowyTracks
  • 1,965
  • 15
  • 21
  • Thanks for your answer ! I am not used with this kind of syntax in a if statement ! I have already read the code but it would be helpful if you could explain quickly what is this "payload". Thanks :) – toto_tata Oct 25 '11 at 15:22
  • 2
    Developer Payload use can be found here: http://developer.android.com/guide/market/billing/billing_reference.html#billing-interface – SnowyTracks Oct 25 '11 at 15:54
  • 1
    you didn't answer the question: "what is the “developer payload”?" – user924 May 06 '18 at 08:46
  • Downvote because question is not answered: what is developer payload. – bra.Scene Nov 30 '20 at 17:55