Skip to main content
Version: 5.7.0

ConfirmGooglePlayPurchase

Confirm Google Play purchase.

caution

WARNING: ConfirmGooglePlayPurchase() returns a 200 result even if the purchase was declined by Google. You must check the data.result value to see that it exists and is "OK" to confirm that a purchase was a success.

ServiceOperation
productCONFIRM_GOOGLEPLAY_PURCHASE

Method Parameters

ParameterDescription
orderIdGoogle Play orderId ("GPA.####-####-####-#####")
productIdGoogle Play productId ("com.acme.runner.birdseed1")
tokenGoogle Play purchaseToken ("bhcmgnlflegpffpbcpeknjpi.AO-J1Oy_...")

Usage

http://localhost:3000
string orderId = "Google Play order ID";
string productId = "Google Play product ID";
string token = "Google Play purchase token";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.ProductService.ConfirmGooglePlayPurchase(orderId, productId, token, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"result": "OK",
"status": {
"consumptionState": 1,
"developerPayload": "",
"purchaseState": 0,
"kind": "androidpublisher#productPurchase",
"purchaseTimeMillis": 1464789264502
},
"playerCurrency": {
"updatedAt": 1464789275517,
"currencyMap": {
"gems": {
"purchased": 15,
"balance": 15,
"consumed": 0,
"awarded": 0
},
"gold": {
"purchased": 8000,
"balance": 8000,
"consumed": 0,
"awarded": 0
}
},
"playerId": "b5ba6fb5-4dd8-49cd-a6cc-36842ccff05d",
"createdAt": 1464373318154
},
"server_time": 1464789275522
}
}