Method: externaltransactions.refundexternaltransaction
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mengembalikan dana atau pengembalian dana sebagian transaksi eksternal yang ada.
Permintaan HTTP
POST https://androidpublisher.googleapis.com/androidpublisher/v3/{name=applications/*/externalTransactions/*}:refund
URL menggunakan sintaksis gRPC Transcoding.
Parameter jalur
Parameter |
name |
string
Wajib. Nama transaksi eksternal yang akan dikembalikan dananya. Format: applications/{packageName}/externalTransactions/{externalTransaction}
|
Isi permintaan
Isi permintaan memuat data dengan struktur berikut:
Representasi JSON |
{
"refundTime": string,
// Union field refund_type can be only one of the following:
"partialRefund": {
object (PartialRefund )
},
"fullRefund": {
object (FullRefund )
}
// End of list of possible types for union field refund_type .
} |
Kolom |
refundTime |
string (Timestamp format)
Wajib. Waktu saat transaksi dikembalikan dananya. Menggunakan RFC 3339, dengan output yang dihasilkan akan selalu dinormalisasi Z dan menggunakan digit pecahan 0, 3, 6, atau 9. Offset selain "Z" juga diterima. Contoh: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" , atau "2014-10-02T15:01:23+05:30" .
|
Kolom union refund_type . Wajib. Jenis pengembalian dana transaksi eksternal. refund_type hanya dapat berupa salah satu dari berikut: |
partialRefund |
object (PartialRefund )
Pengembalian dana sebagian.
|
fullRefund |
object (FullRefund )
Pengembalian dana dalam jumlah penuh.
|
Isi respons
Jika berhasil, isi respons memuat instance ExternalTransaction
.
Contoh
Berikut adalah contoh permintaan:
curl \
-X POST \
'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/externalTransactions/foo:refund' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d '{ \
"partialRefund": { \
"refundId": "my_refund_id", \
"refundPreTaxAmount": { \
"currency": "USD", \
"priceMicros": "10120000" \
} \
}, \
"refundTime": "2023-10-20T16:43:32.852Z" \
}'
Berikut adalah contoh respons:
{
"externalTransactionId": "1234567890123456789012345678901234567890123456789012345678901234",
"originalPreTaxAmount": {
"currency": "USD",
"priceMicros": "1990000"
},
"originalTaxAmount": {
"currency": "USD",
"priceMicros": "11400000"
},
"packageName": "com.example.app",
"transactionState": "TRANSACTION_CANCELED",
"transactionTime": "2023-04-01T12:00:00Z",
"userTaxAddress": {
"regionCode": "US"
},
"createTime": "2023-04-01T11:55:00Z",
"currentPreTaxAmount": {
"currency": "USD",
"priceMicros": "0"
},
"currentTaxAmount": {
"currency": "USD",
"priceMicros": "0"
},
"testPurchase": {},
"recurringTransaction": {
"initialExternalTransactionId": "9876543210987654321098765432109876543210987654321098765432109876",
"externalSubscription": {
"subscriptionType": "RECURRING"
}
}
}
Cakupan otorisasi
Memerlukan cakupan OAuth berikut:
https://www.googleapis.com/auth/androidpublisher
PartialRefund
Pengembalian dana sebagian suatu transaksi.
Representasi JSON |
{
"refundId": string,
"refundPreTaxAmount": {
object (Price )
}
} |
Kolom |
refundId |
string
Wajib. ID unik yang membedakan pengembalian dana sebagian ini. Jika pengembalian dana berhasil, pengembalian dana berikutnya dengan ID yang sama akan gagal. Harus unik di berbagai pengembalian dana untuk satu transaksi individual.
|
refundPreTaxAmount |
object (Price )
Wajib. Jumlah pengembalian dana sebagian sebelum pajak. Harus lebih kecil dari sisa jumlah transaksi sebelum pajak.
|
FullRefund
Jenis ini tidak memiliki kolom.
Pengembalian dana penuh dari sisa jumlah transaksi.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\u003cp\u003eRefunds or partially refunds an existing external transaction using an HTTP POST request.\u003c/p\u003e\n"],["\u003cp\u003eRequires providing the external transaction name as a path parameter and refund details in the request body.\u003c/p\u003e\n"],["\u003cp\u003eThe request body specifies the refund time and either a partial or full refund type.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful requests will receive a response containing the updated external transaction details.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization requires the \u003ccode\u003ehttps://www.googleapis.com/auth/androidpublisher\u003c/code\u003e OAuth scope.\u003c/p\u003e\n"]]],["This document details how to refund an external transaction via a POST request to the specified URL. The request requires a `name` path parameter, indicating the transaction to be refunded. The request body includes a `refundTime` timestamp and either a `partialRefund` object with a unique `refundId` and `refundPreTaxAmount`, or a `fullRefund` object. Successful requests return an `ExternalTransaction` instance and needs the `androidpublisher` OAuth scope.\n"],null,["- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [PartialRefund](#PartialRefund)\n - [JSON representation](#PartialRefund.SCHEMA_REPRESENTATION)\n- [FullRefund](#FullRefund)\n- [Try it!](#try-it)\n\nRefunds or partially refunds an existing external transaction.\n\nHTTP request\n\n`POST https://androidpublisher.googleapis.com/androidpublisher/v3/{name=applications/*/externalTransactions/*}:refund`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\nPath parameters\n\n| Parameters ||\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. The name of the external transaction that will be refunded. Format: applications/{packageName}/externalTransactions/{externalTransaction} |\n\nRequest body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"refundTime\": string, // Union field `refund_type` can be only one of the following: \"partialRefund\": { object (/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#PartialRefund) }, \"fullRefund\": { object (/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#FullRefund) } // End of list of possible types for union field `refund_type`. } ``` |\n\n| Fields ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `refundTime` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Required. The time that the transaction was refunded. Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than \"Z\" are also accepted. Examples: `\"2014-10-02T15:01:23Z\"`, `\"2014-10-02T15:01:23.045123456Z\"` or `\"2014-10-02T15:01:23+05:30\"`. |\n| Union field `refund_type`. Required. Type of external transaction refund. `refund_type` can be only one of the following: ||\n| `partialRefund` | `object (`[PartialRefund](/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#PartialRefund)`)` A partial refund. |\n| `fullRefund` | `object (`[FullRefund](/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#FullRefund)`)` A full-amount refund. |\n\nResponse body\n\nIf successful, the response body contains an instance of [ExternalTransaction](/android-publisher/api-ref/rest/v3/externaltransactions#ExternalTransaction).\n\nSample\n\nThe following is a sample request: \n\n```json\ncurl \\\n -X POST \\\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/externalTransactions/foo:refund' \\\n -H 'Accept: application/json' \\\n -H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \\\n -H 'Content-Type: application/json' \\\n -d '{ \\\n \"partialRefund\": { \\\n \"refundId\": \"my_refund_id\", \\\n \"refundPreTaxAmount\": { \\\n \"currency\": \"USD\", \\\n \"priceMicros\": \"10120000\" \\\n } \\\n }, \\\n \"refundTime\": \"2023-10-20T16:43:32.852Z\" \\\n }'\n```\n\nThe following is a sample response: \n\n```json\n{\n \"externalTransactionId\": \"1234567890123456789012345678901234567890123456789012345678901234\",\n \"originalPreTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"1990000\"\n },\n \"originalTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"11400000\"\n },\n \"packageName\": \"com.example.app\",\n \"transactionState\": \"TRANSACTION_CANCELED\",\n \"transactionTime\": \"2023-04-01T12:00:00Z\",\n \"userTaxAddress\": {\n \"regionCode\": \"US\"\n },\n \"createTime\": \"2023-04-01T11:55:00Z\",\n \"currentPreTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"0\"\n },\n \"currentTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"0\"\n },\n \"testPurchase\": {},\n \"recurringTransaction\": {\n \"initialExternalTransactionId\": \"9876543210987654321098765432109876543210987654321098765432109876\",\n \"externalSubscription\": {\n \"subscriptionType\": \"RECURRING\"\n }\n }\n}\n```\n\nAuthorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/androidpublisher`\n\nPartialRefund A partial refund of a transaction.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------|\n| ``` { \"refundId\": string, \"refundPreTaxAmount\": { object (/android-publisher/api-ref/rest/v3/Price) } } ``` |\n\n| Fields ||\n|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `refundId` | `string` Required. A unique id distinguishing this partial refund. If the refund is successful, subsequent refunds with the same id will fail. Must be unique across refunds for one individual transaction. |\n| `refundPreTaxAmount` | `object (`[Price](/android-publisher/api-ref/rest/v3/Price)`)` Required. The pre-tax amount of the partial refund. Should be less than the remaining pre-tax amount of the transaction. |\n\nFullRefund\n\nThis type has no fields.\nA full refund of the remaining amount of a transaction."]]