REST Resource: purchases.productsv2

資源:ProductPurchaseV2

ProductPurchaseV2 資源會指出使用者在應用程式內購買產品的狀態。

JSON 表示法
{
  "productLineItem": [
    {
      object (ProductLineItem)
    }
  ],
  "kind": string,
  "purchaseStateContext": {
    object (PurchaseStateContext)
  },
  "testPurchaseContext": {
    object (TestPurchaseContext)
  },
  "orderId": string,
  "obfuscatedExternalAccountId": string,
  "obfuscatedExternalProfileId": string,
  "regionCode": string,
  "purchaseCompletionTime": string,
  "acknowledgementState": enum (AcknowledgementState)
}
欄位
productLineItem[]

object (ProductLineItem)

包含 ProductPurchaseV2 的商品層級資訊。

kind

string

這個類別代表 androidpublisher 服務中的 ProductPurchaseV2 物件。

purchaseStateContext

object (PurchaseStateContext)

購買交易的購買狀態資訊。

testPurchaseContext

object (TestPurchaseContext)

與測試購買交易相關的資訊。這項屬性僅會設定為測試購買。

orderId

string

與應用程式內產品購買交易相關聯的訂單 ID。如果沒有與消費相關聯的訂單,可能不會設定。

obfuscatedExternalAccountId

string

與應用程式中使用者帳戶唯一相關聯的 ID 經過模糊處理的版本。只有在購買交易時使用 https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid 指定此值時,才會出現。

obfuscatedExternalProfileId

string

這個 ID 經過模糊處理,與應用程式中使用者個人資料的關聯性唯一。只有在使用 https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid 指定時才會出現,且僅限於購買時。

regionCode

string

產品授予時,使用者所在的 ISO 3166-1 alpha-2 帳單地區代碼。

purchaseCompletionTime

string (Timestamp format)

購買成功的時間,也就是 PurchaseState 變更為 PURCHASED 的時間。付款完成後,系統才會顯示這個欄位。舉例來說,如果使用者啟動待處理交易 (https://developer.android.com/google/play/billing/integrate#pending),則必須等到使用者成功完成交易所需的步驟,這個欄位才會填入資料。

使用 RFC 3339,產生的輸出內容一律會經過 Z 標準化,並使用 0、3、6 或 9 小數位數。系統也接受「Z」以外的偏移值。例如:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

acknowledgementState

enum (AcknowledgementState)

僅供輸出。購買交易的確認狀態。

PurchaseStateContext

購買狀態的背景資訊。

JSON 表示法
{
  "purchaseState": enum (PurchaseState)
}
欄位
purchaseState

enum (PurchaseState)

僅供輸出。購買交易的購買狀態。

PurchaseState

可能的購買狀態。

列舉
PURCHASE_STATE_UNSPECIFIED 未指定購買交易狀態。這個值不應設為此值。
PURCHASED 購買成功。
CANCELLED 已取消訂單
PENDING 這筆交易處於待處理狀態,尚未完成。如要進一步瞭解如何處理未完成的購買交易,請參閱 https://developer.android.com/google/play/billing/integrate#pending

TestPurchaseContext

測試購買的相關資訊。

JSON 表示法
{
  "fopType": enum (FopType)
}
欄位
fopType

enum (FopType)

測試購買交易的 fop 類型。

FopType

可能的 fop 類型。

列舉
FOP_TYPE_UNSPECIFIED 未指定 FOP 類型。這個值不應設為此值。
TEST 購買交易是使用測試卡完成。

ProductLineItem

包含 ProductPurchaseV2 的商品層級資訊。

JSON 表示法
{
  "productId": string,
  "productOfferDetails": {
    object (ProductOfferDetails)
  }
}
欄位
productId

string

所購買產品的 ID (例如「monthly001」)。

productOfferDetails

object (ProductOfferDetails)

此商品的優惠詳細資料。

ProductOfferDetails

與購買委刊項相關的商品詳細資料。

JSON 表示法
{
  "offerTags": [
    string
  ],
  "offerId": string,
  "purchaseOptionId": string,
  "rentOfferDetails": {
    object (RentOfferDetails)
  },
  "offerToken": string,
  "quantity": integer,
  "refundableQuantity": integer,
  "consumptionState": enum (ConsumptionState)
}
欄位
offerTags[]

string

與優惠相關聯的最新優惠標記。包括從購買選項繼承的代碼。

offerId

string

優惠 ID。僅適用於優惠。

purchaseOptionId

string

購買選項 ID。

rentOfferDetails

object (RentOfferDetails)

提供租賃優惠的詳細資料。這項屬性僅適用於租賃明細項目。

offerToken

string

用於建立這項購買委刊項的每筆交易優惠憑證。

quantity

integer

與應用程式內產品購買交易相關的數量。

refundableQuantity

integer

符合退款資格的數量,也就是未退款的數量。這個值反映了以數量為準的部分退款和全額退款。

consumptionState

enum (ConsumptionState)

僅供輸出。購買交易的消費狀態。

RentOfferDetails

這個類型沒有任何欄位。

與租賃委刊項相關的商品詳細資料。

ConsumptionState

可能的消費狀態。

列舉
CONSUMPTION_STATE_UNSPECIFIED 未指定消費狀態。這個值不應設為此值。
CONSUMPTION_STATE_YET_TO_BE_CONSUMED 尚未使用。
CONSUMPTION_STATE_CONSUMED 已使用。

AcknowledgementState

一次性產品的確認狀態。

列舉
ACKNOWLEDGEMENT_STATE_UNSPECIFIED 未指定的確認狀態。
ACKNOWLEDGEMENT_STATE_PENDING 購買交易尚未確認。
ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED 已確認購買交易。

方法

getproductpurchasev2

檢查應用程式內商品的購買和消費狀態。