Method: externaltransactions.refundexternaltransaction
Stay organized with collections
Save and categorize content based on your preferences.
Refunds or partially refunds an existing external transaction.
HTTP request
POST https://androidpublisher.googleapis.com/androidpublisher/v3/{name=applications/*/externalTransactions/*}:refund
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters |
name |
string
Required. The name of the external transaction that will be refunded. Format: applications/{packageName}/externalTransactions/{externalTransaction}
|
Request body
The request body contains data with the following structure:
JSON representation |
{
"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 .
} |
Fields |
refundTime |
string (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" .
|
Union field refund_type . Required. Type of external transaction refund. refund_type can be only one of the following: |
partialRefund |
object (PartialRefund )
A partial refund.
|
fullRefund |
object (FullRefund )
A full-amount refund.
|
Response body
If successful, the response body contains an instance of ExternalTransaction
.
Sample
The following is a sample request:
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" \
}'
The following is a sample response:
{
"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"
}
}
}
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/androidpublisher
PartialRefund
A partial refund of a transaction.
JSON representation |
{
"refundId": string,
"refundPreTaxAmount": {
object (Price )
}
} |
Fields |
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.
|
refundPreTaxAmount |
object (Price )
Required. The pre-tax amount of the partial refund. Should be less than the remaining pre-tax amount of the transaction.
|
FullRefund
This type has no fields.
A full refund of the remaining amount of a transaction.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-28 UTC.
[null,null,["Last updated 2025-05-28 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,["# Method: externaltransactions.refundexternaltransaction\n\n- [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\n### HTTP 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\n### Path 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\n### Request 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\n### Response body\n\nIf successful, the response body contains an instance of [ExternalTransaction](/android-publisher/api-ref/rest/v3/externaltransactions#ExternalTransaction).\n\n### Sample\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\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/androidpublisher`\n\nPartialRefund\n-------------\n\nA 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----------\n\nThis type has no fields.\nA full refund of the remaining amount of a transaction."]]