Method: externaltransactions.refundexternaltransaction

  • The purpose of this page is to detail how to refund or partially refund an existing external transaction.

  • The HTTP request uses a POST method with a URL that includes the application package name and external transaction ID.

  • The request body requires the refundTime and either partialRefund or fullRefund to specify the refund details.

  • A successful response returns an instance of ExternalTransaction.

  • This operation requires the https://www.googleapis.com/auth/androidpublisher OAuth scope.

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,

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "partialRefund": {
    object (PartialRefund)
  },
  "fullRefund": {
    object (FullRefund)
  }
  // End of mutually exclusive fields.
}
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 use 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".

Required. Type of external transaction refund. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response:
partialRefund

object (PartialRefund)

A partial refund.

fullRefund

object (FullRefund)

A full-amount refund.

End of mutually exclusive fields.

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.