REST Resource: purchases.productsv2

Resource: ProductPurchaseV2

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

JSON representation
{
  "productLineItem": [
    {
      object (ProductLineItem)
    }
  ],
  "kind": string,
  "purchaseStateContext": {
    object (PurchaseStateContext)
  },
  "testPurchaseContext": {
    object (TestPurchaseContext)
  },
  "orderId": string,
  "obfuscatedExternalAccountId": string,
  "obfuscatedExternalProfileId": string,
  "regionCode": string,
  "purchaseCompletionTime": string,
  "acknowledgementState": enum (AcknowledgementState)
}
Fields
productLineItem[]

object (ProductLineItem)

Contains item-level info for a ProductPurchaseV2.

kind

string

This kind represents a ProductPurchaseV2 object in the androidpublisher service.

purchaseStateContext

object (PurchaseStateContext)

Information about the purchase state of the purchase.

testPurchaseContext

object (TestPurchaseContext)

Information related to test purchases. This will only be set for test purchases.

orderId

string

The order id associated with the purchase of the inapp product. May not be set if there is no order associated with the purchase.

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.

purchaseCompletionTime

string (Timestamp format)

The time when the purchase was successful, i.e., when the PurchaseState has changed to PURCHASED. This field will not be present until the payment is complete. For example, if the user initiated a pending transaction (https://developer.android.com/google/play/billing/integrate#pending), this field will not be populated until the user successfully completes the steps required to complete the transaction.

Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

acknowledgementState

enum (AcknowledgementState)

Output only. The acknowledgement state of the purchase.

PurchaseStateContext

Context about the purchase state.

JSON representation
{
  "purchaseState": enum (PurchaseState)
}
Fields
purchaseState

enum (PurchaseState)

Output only. The purchase state of the purchase.

PurchaseState

Possible purchase states.

Enums
PURCHASE_STATE_UNSPECIFIED Purchase state unspecified. This value should never be set.
PURCHASED Purchased successfully.
CANCELLED Purchase canceled.
PENDING The purchase is in a pending state and has not yet been completed. For more information on handling pending purchases, see https://developer.android.com/google/play/billing/integrate#pending.

TestPurchaseContext

Context about a test purchase.

JSON representation
{
  "fopType": enum (FopType)
}
Fields
fopType

enum (FopType)

The fop type of the test purchase.

FopType

Possible fop types.

Enums
FOP_TYPE_UNSPECIFIED Fop type unspecified. This value should never be set.
TEST The purchase was made using a test card.

ProductLineItem

Contains item-level info for a ProductPurchaseV2.

JSON representation
{
  "productId": string,
  "productOfferDetails": {
    object (ProductOfferDetails)
  }
}
Fields
productId

string

The purchased product ID (for example, 'monthly001').

productOfferDetails

object (ProductOfferDetails)

The offer details for this item.

ProductOfferDetails

Offer details information related to a purchase line item.

JSON representation
{
  "offerTags": [
    string
  ],
  "offerId": string,
  "purchaseOptionId": string,
  "rentOfferDetails": {
    object (RentOfferDetails)
  },
  "offerToken": string,
  "quantity": integer,
  "refundableQuantity": integer,
  "consumptionState": enum (ConsumptionState)
}
Fields
offerTags[]

string

The latest offer tags associated with the offer. It includes tags inherited from the purchase option.

offerId

string

The offer ID. Only present for offers.

purchaseOptionId

string

The purchase option ID.

rentOfferDetails

object (RentOfferDetails)

Offer details about rent offers. This will only be set for rental line items.

offerToken

string

The per-transaction offer token used to make this purchase line item.

quantity

integer

The quantity associated with the purchase of the inapp product.

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.

consumptionState

enum (ConsumptionState)

Output only. The consumption state of the purchase.

RentOfferDetails

This type has no fields.

Offer details information related to a rental line item.

ConsumptionState

Possible consumption states.

Enums
CONSUMPTION_STATE_UNSPECIFIED Consumption state unspecified. This value should never be set.
CONSUMPTION_STATE_YET_TO_BE_CONSUMED Yet to be consumed.
CONSUMPTION_STATE_CONSUMED Consumed already.

AcknowledgementState

Acknowledgement state of the one time product.

Enums
ACKNOWLEDGEMENT_STATE_UNSPECIFIED Unspecified acknowledgement state.
ACKNOWLEDGEMENT_STATE_PENDING The purchase is not acknowledged yet.
ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED The purchase is acknowledged.

Methods

getproductpurchasev2

Checks the purchase and consumption status of an inapp item.