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
ชนิดนี้แสดงออบเจ็กต์ inappPurchase ในบริการ androidpublisher
|
purchaseTimeMillis |
string (int64 format)
เวลาที่มีการซื้อผลิตภัณฑ์เป็นมิลลิวินาทีนับตั้งแต่ Epoch (1 ม.ค. 1970)
|
purchaseState |
integer
สถานะการซื้อของคำสั่งซื้อ ค่าที่เป็นไปได้คือ 0 ซื้อ 1 ยกเลิกแล้ว 2 รอดำเนินการ
|
consumptionState |
integer
สถานะการใช้ไอเทมที่ซื้อในแอป ค่าที่เป็นไปได้คือ 0 ยังไม่ได้ใช้ 1. ใช้งาน
|
developerPayload |
string
สตริงที่นักพัฒนาแอประบุซึ่งมีข้อมูลเสริมเกี่ยวกับคำสั่งซื้อ
|
orderId |
string
รหัสคำสั่งซื้อที่เชื่อมโยงกับการซื้อไอเทมที่ซื้อในแอป
|
purchaseType |
integer
ประเภทของการซื้อไอเทมที่ซื้อในแอป ระบบจะตั้งค่าช่องนี้เฉพาะในกรณีที่การซื้อนี้ไม่ได้ดำเนินการโดยใช้ขั้นตอนการเรียกเก็บเงินสำหรับการซื้อในแอปแบบมาตรฐาน ค่าที่เป็นไปได้คือ 0 การทดสอบ (เช่น ซื้อจากบัญชีทดสอบใบอนุญาต) 1. โปรโมชัน (เช่น ซื้อโดยใช้รหัสโปรโมชัน) ไม่รวมการซื้อ Play Points 2. มีการให้รางวัล (จากการดูโฆษณาวิดีโอแทนการชำระเงิน)
|
acknowledgementState |
integer
สถานะการตอบรับของไอเทมที่ซื้อในแอป ค่าที่เป็นไปได้คือ 0 ยังไม่ได้รับการตอบรับ 1. รับทราบแล้ว
|
purchaseToken |
string
โทเค็นการซื้อที่สร้างขึ้นเพื่อระบุการซื้อนี้ อาจไม่มี
|
productId |
string
SKU ของไอเทมที่ซื้อในแอป อาจไม่มี
|
quantity |
integer
จำนวนที่เชื่อมโยงกับการซื้อไอเทมที่ซื้อในแอป หากไม่มี จำนวนจะเป็น 1
|
obfuscatedExternalAccountId |
string
รหัสเวอร์ชันที่ปรับให้ยากต่อการอ่าน (Obfuscate) ซึ่งเชื่อมโยงกับบัญชีของผู้ใช้ในแอปของคุณโดยเฉพาะ แสดงหากระบุโดยใช้ https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid ขณะทำการซื้อเท่านั้น
|
obfuscatedExternalProfileId |
string
รหัสเวอร์ชันที่ปรับให้ยากต่อการอ่าน (Obfuscate) ซึ่งเชื่อมโยงกับโปรไฟล์ของผู้ใช้ในแอปของคุณโดยไม่ซ้ำกัน แสดงหากระบุโดยใช้ https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid เมื่อทำการซื้อเท่านั้น
|
regionCode |
string
รหัสภูมิภาคสำหรับการเรียกเก็บเงิน ISO 3166-1 alpha-2 ของผู้ใช้ ณ เวลาที่ได้รับผลิตภัณฑ์
|
refundableQuantity |
integer
จำนวนที่มีสิทธิ์ขอเงินคืน เช่น จำนวนที่ยังไม่ได้คืนเงิน ค่านี้แสดงถึงการคืนเงินบางส่วนตามจำนวนและการคืนเงินเต็มจำนวน
|
เมธอด |
|
ตอบรับการซื้อรายการในแอป |
|
ใช้การซื้อรายการในแอป |
|
ตรวจสอบสถานะการซื้อและการใช้ไอเทมที่ซื้อในแอป |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\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. |"]]