REST Resource: purchases.products

  • A ProductPurchase resource provides information about a user's in-app product purchase status.

  • The JSON representation of a ProductPurchase includes details like purchase time, state, consumption state, order ID, and product ID.

  • The resource includes methods to acknowledge, consume, and get the status of an in-app item purchase.

Resource: ProductPurchase

A ProductPurchase resource indicates the status of a user's inapp product purchase.

JSON representation
{
  "kind": string,
  "purchaseTimeMillis": string,
  "purchaseState": integer,
  "consumptionState": integer,
  "developerPayload": string,
  "orderId": string,
  "purchaseType": integer,
  "acknowledgementState": integer,
  "purchaseToken": string,
  "productId": string,
  "quantity": integer,
  "obfuscatedExternalAccountId": string,
  "obfuscatedExternalProfileId": string,
  "regionCode": string,
  "refundableQuantity": integer
}
Fields
kind

string

This kind represents an inappPurchase object in the androidpublisher service.

purchaseTimeMillis

string (int64 format)

The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).

purchaseState

integer

The purchase state of the order. Possible values are: 0. Purchased 1. Canceled 2. Pending

consumptionState

integer

The consumption state of the inapp product. Possible values are: 0. Yet to be consumed 1. Consumed

developerPayload

string

A developer-specified string that contains supplemental information about an order.

orderId

string

The order id associated with the purchase of the inapp product.

purchaseType

integer

The type of purchase of the inapp product. This field is only set if this purchase was not made using the standard in-app billing flow. Possible values are: 0. Test (i.e. purchased from a license testing account) 1. Promo (i.e. purchased using a promo code). Does not include Play Points purchases. 2. Rewarded (i.e. from watching a video ad instead of paying)

acknowledgementState

integer

The acknowledgement state of the inapp product. Possible values are: 0. Yet to be acknowledged 1. Acknowledged

purchaseToken

string

The purchase token generated to identify this purchase. May not be present.

productId

string

The inapp product SKU. May not be present.

quantity

integer

The quantity associated with the purchase of the inapp product. If not present, the quantity is 1.

obfuscatedExternalAccountId

string

An obfuscated version of the id that is uniquely associated with the user's account in your app. Only present if specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid when the purchase was made.

obfuscatedExternalProfileId

string

An obfuscated version of the id that is uniquely associated with the user's profile in your app. Only present if specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid when the purchase was made.

regionCode

string

ISO 3166-1 alpha-2 billing region code of the user at the time the product was granted.

refundableQuantity

integer

The quantity eligible for refund, i.e. quantity that hasn't been refunded. The value reflects quantity-based partial refunds and full refunds.

Methods

acknowledge

Acknowledges a purchase of an inapp item.

consume

Consumes a purchase for an inapp item.

get

Checks the purchase and consumption status of an inapp item.

Error codes

The operations of this resource, return the following HTTP error codes:

Error code Reason Description Resolution
400 invalidPurchaseState The purchase is not in a valid state to perform the requested operation. For example, you might be trying to acknowledge an already consumed purchase or cancel a subscription that is not active. Check the current state of the resource using the corresponding Get API before attempting the operation. Ensure the resource is in an appropriate state for the action.
400 invalidValue An invalid value was provided in the request. This is often returned for a malformed or invalid purchase token. Correct the invalid field value in the request body or parameters based on the API reference.
400 productNotOwnedByUser The provided purchase token is valid, but the user does not currently own the product. This can happen if the purchase was refunded, revoked or expired before acknowledgement. Check the current state of the resource using the corresponding Get API before attempting the operation. Ensure the resource is in an appropriate state for the action.
400 purchaseTokenMismatch The provided purchase token does not match the purchase, package name, subscription ID or product ID. Verify all the details in the request are correct and correspond to each other.
400 required A required field or parameter is missing from the request. Consult the API documentation to ensure all mandatory fields and parameters are included.
400 unsupportedIabType The operation is not supported for the given In-App Billing type. Ensure the API method is compatible with the item type being managed.
403 userInsufficientPermission The user does not have sufficient permission to perform the requested operation. Ensure the authenticated user has the necessary permissions in the Google Play Console. See Using a service account for more details.
404 notFound The requested resource could not be found. Verify the identifiers (e.g., purchase token, package name, product ID, subscription ID) are correct.
409 concurrentUpdate There was an attempt to update an object that is being updated concurrently. Retry the request with exponential backoff. Avoid simultaneous modifications to the same resource.
5xx Generic error Generic error in the Google Play server. Retry your request.

If the problem persists contact your Google Play account manager or submit a support request. Consider checking the Play Status Dashboard for any known outages.