Skip to main content

Google Receipt Verification

This method checks whether the receipt issued after a Google in-app purchase(IAP) is valid.
For more information about the IAP process, please refer to the IAP Verification documentation in BACKND Function of BACKND Base.

IsValidateGooglePurchase(string productId, string token, string receiptDescription, bool isSubscription = false) -> BackendReturnObject

// example
var bro = Backend.Receipt.IsValidateGooglePurchase("pid", "token", "pid receipt verification", false);

Parameters

ValueTypeDescription
productIdstringID of the in-app purchased product
tokenstringReceipt token value generated after IAP
receiptDescriptionstringContent to be checked additionally in receipt verification history
isSubscriptionboolSubscription payment status

Return casess

When successful(general product)
statusCode : 201
message : Success returnValue : {"usedDate":"2018-10-15T05:17:49Z"}

When successful(subscription product)
statusCode : 200
message : Success returnValue : see below

{
"kind":"androidpublisher#subscriptionPurchase",
"startTimeMillis":"1583722491833",
"expiryTimeMillis":"1583722908247",
"autoRenewing":true,
"priceCurrencyCode":"KRW",
"priceAmountMicros":"1000000000",
"countryCode":"KR",
"developerPayload":"{\"developerPayload\":\"\",\"is_free_trial\":false,\"has_introductory_price_trial\":false,\"is_updated\":false}",
"paymentState":1,
"orderId":"order Id",
"purchaseType":0,
"acknowledgementState":1
}

Already used receipt token
statusCode : 409
errorCode : UsedReceipt
message : This receipt has already been used. usedDate: 2018-02-15T04:01:50.000Z

When the receipt for an already used or canceled subscription product is verified
statusCode : 409
errorCode : DuplicatedParameterException
message : Duplicated receipt, Duplicated receipt

Refunded/canceled receipt
statusCode : 402
errorCode : AbnormalReceipt
message : This receipt has changed status. purchaseState: cancelled

Expired receipt token
statusCode : 400
errorCode : BadParameterException
message : bad token, Invalid token You must check the JWT permissions in Step 3.
If a bad token error occurs even after setting the permissions properly, reissue the JWT, and if an error occurs even after reissuing, create a new JWT and try again.
JWT modification may not be applied immediately, so it is recommended to try again after 1-2 hours.