> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therius.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Issue a Full or Partial Refund

> Refund a captured payment in full or partially. Multiple partial refunds are allowed up to the total captured amount.

Use `POST /payment/{id}/refund` to return funds to a cardholder after a payment has been captured and settled. You can issue a single full refund or multiple partial refunds — as long as the cumulative refunded amount doesn't exceed the originally captured total. Refunds typically appear on the cardholder's statement within 5–10 business days, depending on their bank.

## Identifying the payment

`{id}` is the Therius payment `id` returned by `POST /payment/authorization` and `POST /payment/purchase`. `orderCode` and `paymentCode` are your own reference fields and are **not** accepted here. An unknown or non-owned `id` returns `404`.

## Examples

### Full refund

<RequestExample>
  ```bash cURL theme={"dark"}
  curl -X POST https://api.therius.io/v1/payment/9f8b2c1e-4d5a-6b7c-8d9e-0f1a2b3c4d5e/refund \
    -H "Authorization: Bearer prv_production_your_key_here" \
    -H "Idempotency-Key: $(uuidgen)" \
    -H "Content-Type: application/json" \
    -d '{
      "merchantCode": "MERCHANT_001",
      "amount": { "currency": "USD", "value": 4999, "exponent": 2 }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"dark"}
  {
    "id": "9f8b2c1e-4d5a-6b7c-8d9e-0f1a2b3c4d5e",
    "status": "refunded",
    "paymentCode": "PC-1234567890",
    "orderCode": "ORDER-20240101-001",
    "merchantCode": "MERCHANT_001",
    "amount": { "currency": "USD", "value": 4999, "exponent": 2 }
  }
  ```
</ResponseExample>

### Partial refund

Refunding only part of an order — for example, a single returned item from a multi-item purchase:

```bash theme={"dark"}
curl -X POST https://api.therius.io/v1/payment/9f8b2c1e-4d5a-6b7c-8d9e-0f1a2b3c4d5e/refund \
  -H "Authorization: Bearer prv_production_your_key_here" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantCode": "MERCHANT_001",
    "reference": "RETURN-98765",
    "amount": { "currency": "USD", "value": 1999, "exponent": 2 }
  }'
```

```json theme={"dark"}
{
  "id": "9f8b2c1e-4d5a-6b7c-8d9e-0f1a2b3c4d5e",
  "status": "refunded",
  "paymentCode": "PC-1234567890",
  "orderCode": "ORDER-20240101-001",
  "merchantCode": "MERCHANT_001",
  "amount": { "currency": "USD", "value": 1999, "exponent": 2 }
}
```

<Warning>
  You cannot refund a payment that is in the `authorized` (not yet captured) state. To release an authorization that hasn't been captured, use [Cancel](/api-reference/cancel) instead. Attempting to refund an uncaptured payment returns an error.
</Warning>

<Note>
  Multiple partial refunds are allowed. You can call this endpoint several times against the same payment `id`, provided the cumulative refund amount doesn't exceed the original captured amount. Each call should use a distinct `Idempotency-Key`.
</Note>

<Tip>
  If you're unsure whether a payment is in `authorized` or `captured` state, use [Cancel or Refund](/api-reference/cancel-or-refund) instead — it detects the state automatically and takes the appropriate action.
</Tip>


## OpenAPI

````yaml POST /payment/{id}/refund
openapi: 3.1.0
info:
  title: Therius API
  description: REST API for payments, subscriptions, and billing plans.
  version: 1.0.0
servers:
  - url: https://api.therius.io/v1
    description: Production
  - url: https://api-sandbox.therius.io/v1
    description: Sandbox
security:
  - bearerAuth: []
paths:
  /payment/{id}/refund:
    post:
      tags:
        - Payments
      summary: Issue a full or partial refund
      operationId: refundPayment
      parameters:
        - $ref: '#/components/parameters/PaymentId'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - merchantCode
                - amount
              properties:
                merchantCode:
                  type: string
                  description: >-
                    Your merchant account identifier. Validated against the
                    Bearer key's merchant; required if the key maps to more than
                    one merchant account.
                amount:
                  $ref: '#/components/schemas/Amount'
                reference:
                  type: string
                  description: Optional internal reference for this refund operation.
      responses:
        '200':
          description: Refund result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModificationResponse'
components:
  parameters:
    PaymentId:
      name: id
      in: path
      required: true
      description: >-
        The Therius payment `id` returned by `POST /payment/authorization` or
        `POST /payment/purchase`.
      schema:
        type: string
        format: uuid
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: >-
        A UUID you generate per operation. Required in production. Retrying with
        the same key returns the original response.
      schema:
        type: string
        format: uuid
  schemas:
    Amount:
      type: object
      required:
        - currency
        - value
        - exponent
      properties:
        currency:
          type: string
          description: >-
            ISO 4217 currency code. On capture, refund and cancel it must match
            the currency of the original payment.
          example: USD
        value:
          type: integer
          description: >-
            Amount in minor units (cents, pence, etc.). `4999` = $49.99 for USD
            (exponent 2); `5000` = ¥5000 for JPY (exponent 0). On capture it
            must not exceed the authorized value; on refund the cumulative total
            across refunds must not exceed the captured amount.
          example: 4999
        exponent:
          type: integer
          description: >-
            Number of decimal places for the currency — `2` for USD/EUR, `0` for
            JPY. Determines where the decimal point sits in `value`.
          example: 2
    ModificationResponse:
      type: object
      description: Result of a capture, refund, cancel or cancel_or_refund.
      properties:
        id:
          type: string
          description: The Therius payment `id`.
        merchantCode:
          type: string
        orderCode:
          type: string
        paymentCode:
          type: string
          description: Therius receipt ID.
        amount:
          $ref: '#/components/schemas/Amount'
        status:
          type: string
          enum:
            - captured
            - refunded
            - cancelled
            - failed
          description: Outcome of the operation.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your secret API key: `Bearer prv_production_xxx` (production) or `Bearer
        prv_sandbox_xxx` (sandbox).

````