- [HTTP request](https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#body.request_body)
  - [JSON representation](https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#body.response_body)
- [AsynchronousRefundResponse](https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#AsynchronousRefundResponse)
  - [JSON representation](https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#AsynchronousRefundResponse.SCHEMA_REPRESENTATION)
- [AsynchronousRefundResultCode](https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#AsynchronousRefundResultCode)

Refunds a portion or all of the transaction initiated through `https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousCaptureFundsReservation#google.standardpayments.flows.card_fop_reserve_capture.v1.PaymentIntegratorCardReserveCaptureService.AsynchronousCaptureFundsReservation`.

This initiates a request to refund funds that were captured. The amount refunded can be equal to or smaller than the remaining captured amount on the transaction. Multiple partial refunds are allowed by calling `card-fop-v1.asynchronousRefund` multiple times with different `requestId` within the header. The final result of the refund is supplied by a call to \[`refundResultNotification`\]\[google.standardpayments.flows.card_fop_async_refund.v1.GoogleCardAsyncRefundService.RefundResultNotification\]. 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/card-fop-v1/payment-integrator-card-fop-api/ErrorResponse`.

An example request looks like:


    {
      "requestHeader": {
        "protocolVersion": {
          "major": 1,
          "minor": 0,
          "revision": 0
        },
        "requestId": "G18FCDTLD5B0SR4",
        "requestTimestamp": "1482489410000"
      },
      "paymentIntegratorAccountId": "SpeedyPaymentsIndia_INR",
      "captureRequestId": "G112YZH4XPDV88J",
      "refundAmount": "364000000"
    }

An example response looks like:


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

### HTTP request

`POST https://www.integratorhost.example.com/integrator-base-path/v1/payment-integrator-card-fop-api/asynchronousRefund`

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestHeader": { object (`https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/RequestHeader`) }, "paymentIntegratorAccountId": string, "captureRequestId": string, "refundAmount": string } ``` |

| Fields ||
|---|---|
| `requestHeader` | ``object (`https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-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. |
| `captureRequestId` | `string` **REQUIRED** : A unique identifier for the capture to be refunded. This is the `requestId` generated by Google during the `captureFundsReservation` or `capture` which this request is associated with. |
| `refundAmount` | `string (https://developers.google.com/discovery/v1/type-format format)` **REQUIRED**: The amount of the refund, a positive number of micros of the currency unit specified in the originating message, either the funds reservation or initiating capture. |

### 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/card-fop-v1/guides/connectivity/protocol-standards#http_status_codes).

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

## AsynchronousRefundResponse

Response object for the payment integrator hosted card-fop-v1.asynchronousRefund method.

| JSON representation |
|---|
| ``` { "responseHeader": { object (`https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/ResponseHeader`) }, "result": enum (`https://developers.google.com/pay/card-fop-v1/payment-integrator-card-fop-api/asynchronousRefund#AsynchronousRefundResultCode`) } ``` |

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

## AsynchronousRefundResultCode

Result codes for asynchronousRefund.

| Enums ||
|---|---|
| `ASYNCHRONOUS_REFUND_RESULT_CODE_UNSPECIFIED` | Do not ever set this default value! |
| `ACKNOWLEDGED` | The refund has been requested and the integrator will do additional steps to determine if the capture was successful. Once the integrator knows the result of the refund, they will inform Google of the result by calling the `refundNotification` API. |