Android in-app billing: what is the "developer payload" and how the "Buy" button works?
Solution 1
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.
Solution 2
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.
toto_tata
Updated on June 13, 2022Comments
-
toto_tata almost 2 years
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 over 12 yearsThanks 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 :)
-
SnowyTracks over 12 yearsDeveloper Payload use can be found here: developer.android.com/guide/market/billing/…
-
Chloe about 12 yearsWhile 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.
-
tamak about 10 years@Chloe - did you ever find a solution to this problem? Im running into the same issue.
-
Chloe about 10 years@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.
-
user924 almost 6 yearsyou didn't answer the question: "what is the “developer payload”?"
-
user25 almost 6 yearsso we just can ignore it (paste any string which we're not going to use)
-
bra.Scene over 3 yearsDownvote because question is not answered: what is developer payload.