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 指定時才會顯示。
|
regionCode |
string
使用者取得產品時的 ISO 3166-1 alpha-2 帳單區碼。
|
refundableQuantity |
integer
符合退款條件的數量,例如未退款的數量。這個值反映了依數量收取的部分退款與全額退款金額,
|
方法 |
|
確認購買應用程式內商品。 |
|
消耗購買應用程式內商品。 |
|
檢查應用程式內商品的購買和消耗狀態。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eThe \u003ccode\u003eProductPurchase\u003c/code\u003e resource provides information about a user's in-app product purchase, including purchase time, state, and consumption status.\u003c/p\u003e\n"],["\u003cp\u003eIt contains details like the product ID, order ID, purchase token, and quantity, along with developer-specified payload and user account identifiers if provided.\u003c/p\u003e\n"],["\u003cp\u003eYou can use methods like \u003ccode\u003eacknowledge\u003c/code\u003e, \u003ccode\u003econsume\u003c/code\u003e, and \u003ccode\u003eget\u003c/code\u003e to manage the purchase and its state.\u003c/p\u003e\n"],["\u003cp\u003eThe resource includes fields for purchase state (purchased, canceled, pending), consumption state (consumed, not consumed), and acknowledgement state (acknowledged, not acknowledged).\u003c/p\u003e\n"]]],["The `ProductPurchase` resource details a user's in-app product purchase status, represented in JSON format with fields like `purchaseTimeMillis`, `purchaseState`, and `consumptionState`. It includes identifiers such as `orderId`, `purchaseToken`, and `productId`. Key actions involve using the methods `acknowledge` to confirm a purchase, `consume` to mark an item as used, and `get` to check the purchase status. The purchase also indicates quantity, purchase types, and refundable amounts.\n"],null,["# REST Resource: purchases.products\n\n- [Resource: ProductPurchase](#ProductPurchase)\n - [JSON representation](#ProductPurchase.SCHEMA_REPRESENTATION)\n- [Methods](#METHODS_SUMMARY)\n\nResource: ProductPurchase\n-------------------------\n\nA ProductPurchase resource indicates the status of a user's inapp product purchase.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"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 } ``` |\n\n| Fields ||\n|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `kind` | `string` This kind represents an inappPurchase object in the androidpublisher service. |\n| `purchaseTimeMillis` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970). |\n| `purchaseState` | `integer` The purchase state of the order. Possible values are: 0. Purchased 1. Canceled 2. Pending |\n| `consumptionState` | `integer` The consumption state of the inapp product. Possible values are: 0. Yet to be consumed 1. Consumed |\n| `developerPayload` | `string` A developer-specified string that contains supplemental information about an order. |\n| `orderId` | `string` The order id associated with the purchase of the inapp product. |\n| `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) |\n| `acknowledgementState` | `integer` The acknowledgement state of the inapp product. Possible values are: 0. Yet to be acknowledged 1. Acknowledged |\n| `purchaseToken` | `string` The purchase token generated to identify this purchase. May not be present. |\n| `productId` | `string` The inapp product SKU. May not be present. |\n| `quantity` | `integer` The quantity associated with the purchase of the inapp product. If not present, the quantity is 1. |\n| `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 \u003chttps://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid\u003e when the purchase was made. |\n| `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 \u003chttps://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid\u003e when the purchase was made. |\n| `regionCode` | `string` ISO 3166-1 alpha-2 billing region code of the user at the time the product was granted. |\n| `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. |\n\n| Methods ------- ||\n|--------------------------------------------------------------------------------------|--------------------------------------------------------------|\n| ### [acknowledge](/android-publisher/api-ref/rest/v3/purchases.products/acknowledge) | Acknowledges a purchase of an inapp item. |\n| ### [consume](/android-publisher/api-ref/rest/v3/purchases.products/consume) | Consumes a purchase for an inapp item. |\n| ### [get](/android-publisher/api-ref/rest/v3/purchases.products/get) | Checks the purchase and consumption status of an inapp item. |"]]