# Create a refund request

This endpoint is used to create a Refund Request.

Refunds can only be created for successful payments made via a Pay Request. If a Pay Request has not yet been captured, then void the Pay Request instead.

Refunds can be made for the total or partial amount of the Pay Request. Multiple refunds can be created for the same Pay Request as long as the total refunds amount does not exceed the original Pay Request total.

Refunds can only be sent back to the original payment method used.

Endpoint: POST /pay/refunds
Version: 0.9
Security: JWT

## Header parameters:

  - `Authorization` (string, required)

  - `Content-Type` (string, required)
    Enum: "application/json"

## Request fields (application/json):

  - `payRequestId` (string, required)
    The id of the Pay Request to be refunded
    Example: "0f448ac1-862a-4c7b-bdb4-a3b7cdbf6148"

  - `total` (object)
    The total amount to be refunded (in smallest currency unit). Defaults to the total of the Pay Request.

  - `total.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `total.currency` (string, required)
    This is always AUD
    Enum: "AUD"

## Response 201 fields (application/json):

  - `id` (string)
    The id of the Refund Request
    Example: "2d448ac1-862a-4c7b-bdb4-a3b7cdbf6143"

  - `payRequestId` (string)
    The id of the Pay Request to be refunded
    Example: "0f448ac1-862a-4c7b-bdb4-a3b7cdbf6149"

  - `total` (object)
    The total amount to be refunded (in smallest currency unit). Defaults to the total of the Pay Request.

  - `total.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `total.currency` (string, required)
    This is always AUD
    Enum: "AUD"

  - `status` (string)
    The current status of the refund
    Enum: "SUCCESS", "FAILED", "PROCESSING"

  - `createdAt` (string)
    The timestamp when the Refund Request was created
    Example: "2022-11-23T22:39:54.931Z"

  - `updatedAt` (string)
    The timestamp when the Refund Request was last updated
    Example: "2022-11-23T22:40:48.237Z"

## Response 400 fields (application/json):

  - `error` (string)
    The validation error message.

  - `errorCode` (string)
    The unique error code for message.


## Response 403 fields
