- [HTTP request](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#body.request_body)
  - [JSON representation](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#body.response_body)
- [AsynchronousRefundResponse](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#AsynchronousRefundResponse)
  - [JSON representation](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#AsynchronousRefundResponse.SCHEMA_REPRESENTATION)
- [AsynchronousRefundResult](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#AsynchronousRefundResult)
  - [JSON representation](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#AsynchronousRefundResult.SCHEMA_REPRESENTATION)

Refunds a portion of or the entire transaction initiated through `generateReferenceNumber`. The `requestId` within the header is the idempotency key, which uniquely identifies this transaction.

If the endpoint encounters an error while processing the request, the response body from this endpoint should be of type `https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/ErrorResponse`.

An example request looks like:


    {
      "requestHeader": {
        "protocolVersion": {
          "major": 1,
          "minor": 3,
          "revision": 0
        },
        "requestId": "G18FCDTLD5B0SR4",
        "requestTimestamp": "1482489410000"
      },
      "paymentIntegratorAccountId": "InvisiCashUSA_USD",
      "generateReferenceNumberRequestId": "bWVyY2hhbnQgdHJhbnNhY3Rpb24gaWQ",
      "refundAmount": {
        "amountMicros": "728000000",
        "currencyCode": "INR"
      }
    }

An example response looks like:


    {
      "responseHeader": {
        "responseTimestamp": "1482489412366"
      },
      "result": {
        "acknowledged": {}
      }
    }

### HTTP request

`POST https://www.integratorhost.example.com/integrator-base-path/refundable-one-time-payment-code-v1/asynchronousRefund`

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestHeader": { object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/RequestHeader`) }, "paymentIntegratorAccountId": string, "refundAmount": { object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/Amount`) }, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "generateReferenceNumberRequestId": string, "captureRequestId": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `requestHeader` | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/RequestHeader`)`` **REQUIRED**: Common header for all requests. |
| `paymentIntegratorAccountId` | `string` **REQUIRED**: This is the payment integrator account ID that defines contractual constraints around this transaction. |
| `refundAmount` | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/Amount`)`` **REQUIRED**: The amount of the refund, this will be a positive number, and should always be less-than or equal-to the remaining balance for the cash payment. |
| **REQUIRED**: A unique identifier for the cash payment which is to be refunded. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `generateReferenceNumberRequestId` | `string` The `requestId` of the initial payment event to be refunded. This is used for: 1. Refunds of one-time reference number payments. 2. Refunds of the initial mandate payment. This ID corresponds to the `requestId` in the `requestHeader` of the `generateReferenceNumber` or `createMandateWithOptionalInstantPayment` call for the payment being refunded. |
| `captureRequestId` | `string` The `requestId` of the capture event to be refunded. This is used for refunds of subsequent/recurring payments made against a mandate. This ID corresponds to the `requestId` in the `requestHeader` of the `capture` call for the payment being refunded. |
| End of mutually exclusive fields. ||

### Response body

This method supports multiple return types. For additional information about what 4XX or 5XX HTTP status code to return with an `ErrorResponse`, consult the `ErrorResponse` object and [HTTP status codes documentation](https://developers.google.com/pay/refundable-one-time-payment-code-v1/guides/connectivity/protocol-standards#http_status_codes).

| Possible response messages ||
|---|---|
| HTTP 200 Status | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#AsynchronousRefundResponse`)`` |
| HTTP 4XX / 5XX Status | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/ErrorResponse`)`` |
| End of mutually exclusive fields. ||

## AsynchronousRefundResponse

Response object for the payment integrator hosted `asynchronousRefund` method.

| JSON representation |
|---|
| ``` { "responseHeader": { object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/ResponseHeader`) }, "result": { object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#AsynchronousRefundResult`) } } ``` |

| Fields ||
|---|---|
| `responseHeader` | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/ResponseHeader`)`` **REQUIRED**: Common header for all responses. |
| `result` | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/asynchronousRefund#AsynchronousRefundResult`)`` **REQUIRED**: The result of the asynchronous refund call. |

## AsynchronousRefundResult

Result of this asynchronous refund.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "acknowledged": { object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/Empty`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| **REQUIRED**: The result of the refund. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `acknowledged` | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/Empty`)`` The refund has been requested and the integrator will do additional steps to determine if the refund was successful. Once the integrator knows the result of the refund, they will inform Google of the result by calling the `refundResultNotification` API. |
| End of mutually exclusive fields. ||