建立新的外部交易。
HTTP 要求
POST https://androidpublisher.googleapis.com/androidpublisher/v3/{parent=applications/*}/externalTransactions
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 | |
---|---|
parent |
必要欄位。表示將建立這筆外部交易的父項資源。格式:applications/{packageName} |
查詢參數
參數 | |
---|---|
externalTransactionId |
必要欄位。要用於外部交易的 ID。在應用程式的所有其他交易中,此值必須是唯一的。這個值的長度應為 1 至 63 個字元,有效字元為 /a-zA-Z0-9_-/。請勿使用這個欄位儲存任何個人識別資訊 (PII),例如電子郵件。如果嘗試在這個欄位中儲存 PII,可能會導致要求遭到封鎖。 |
要求主體
要求主體包含 ExternalTransaction
的例項。
回應主體
如果成功,回應主體會包含新建立的 ExternalTransaction
例項。
範例
以下是要求範例:
curl \ -X POST \ 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/externalTransactions?externalTransactionId=exampleExternalTransactionId' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \ -H 'Content-Type: application/json' \ -d '{ \ "originalPreTaxAmount": { \ "currency": "USD", \ "priceMicros": "1000000" \ }, \ "originalTaxAmount": { \ "currency": "USD", \ "priceMicros": "100000" \ }, \ "transactionTime": "2023-05-05T12:00:00Z", \ "oneTimeTransaction": { \ "externalTransactionToken": "token-123" \ }, \ "userTaxAddress": { \ "regionCode": "US" \ } \ }'
以下是回應範例:
{ "createTime": "2023-04-20T14:23:18.121Z", "currentPreTaxAmount": { "currency": "USD", "priceMicros": "12000000" }, "currentTaxAmount": { "currency": "USD", "priceMicros": "1200000" }, "externalTransactionId": "ext-trans-id-1234", "oneTimeTransaction": { "externalTransactionToken": "one-time-token-abc" }, "originalPreTaxAmount": { "currency": "USD", "priceMicros": "15000000" }, "originalTaxAmount": { "currency": "USD", "priceMicros": "1500000" }, "packageName": "com.example.app", "recurringTransaction": { "externalSubscription": { "subscriptionType": "RECURRING" }, "externalTransactionToken": "recurring-token-xyz", "initialExternalTransactionId": "ext-trans-id-5678", "otherRecurringProduct": {} }, "testPurchase": {}, "transactionProgramCode": 11, "transactionState": "TRANSACTION_REPORTED", "transactionTime": "2023-04-20T14:20:00.000Z", "userTaxAddress": { "regionCode": "US" } }
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/androidpublisher