REST Resource: purchases.products

資源:ProductPurchase

ProductPurchase 資源會指出使用者應用程式內商品購買交易的狀態。

JSON 表示法
{
  "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
}
欄位
kind

string

這類代表 androidpublisher 服務中的 inappPurchase 物件。

purchaseTimeMillis

string (int64 format)

產品的購買時間,以自 Epoch 紀元時間 (1970 年 1 月 1 日) 起的毫秒為單位。

purchaseState

integer

訂購單的購買狀態。可能的值包括:0。已購買 1. 已取消 2. 待處理

consumptionState

integer

應用程式內商品的消耗狀態。可能的值包括:0。尚未使用的抵免額 1. 使用

developerPayload

string

開發人員指定的字串,內容為有關訂購單的其他資訊。

orderId

string

與應用程式內商品購買交易相關聯的訂單 ID。

purchaseType

integer

應用程式內商品的購買類型。只有在購買交易不是透過標準應用程式內結帳流程完成時,才會設定這個欄位。可能的值包括:0。測試 (即透過授權測試帳戶購買) 1. 促銷 (即使用促銷代碼購買)。不含 Play Points 交易。2. 獎勵 (即觀看影片廣告而非付費)

acknowledgementState

integer

應用程式內商品的確認狀態。可能的值包括:0。尚待確認 1. 已確認

purchaseToken

string

系統產生的購買交易權杖,用於識別這筆交易。可能不會顯示。

productId

string

應用程式內商品 SKU。可能不會顯示。

quantity

integer

與應用程式內商品購買交易相關聯的數量。如未提供,數量則為 1。

obfuscatedExternalAccountId

string

經過模糊處理的 ID,只與應用程式中的使用者帳戶有關。只有在購買交易時使用 https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid 指定時,才會顯示這個 ID。

obfuscatedExternalProfileId

string

與應用程式中使用者設定檔相關聯的專屬 ID 模糊處理版本。只有在購買時使用 https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid 指定時,才會顯示這個 ID。

regionCode

string

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

refundableQuantity

integer

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

方法

acknowledge

確認應用程式內商品交易。

consume

消耗應用程式內商品的購買交易。

get

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

錯誤代碼

這項資源的作業會傳回下列 HTTP 錯誤碼:

錯誤代碼 原因 解析度
5xx Google Play 伺服器發生一般錯誤。 重試要求。

如果問題持續發生,請與 Google Play 帳戶管理員聯絡,或提交支援要求。 建議查看 Play 狀態資訊主頁,瞭解是否有已知服務中斷情形。

409 並行更新錯誤。

嘗試更新正在更新的物件。舉例來說,購買交易同時透過呼叫 Play 帳款服務程式庫的 acknowledgePurchase() 方法和 Play Developer API 的 purchases.products.acknowledge 進行確認。

重試要求。