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

# Request Refund

> Requests a full refund of the given payment transaction. The refund is asynchronous — confirmation arrives via the `refund_completed` webhook once the PSP processes it.

**Required permission:** `REFUND:WRITE` or `FULL_ACCESS`



## OpenAPI

````yaml openapi.en.json POST /transactions/{id}/refund
openapi: 3.0.0
info:
  title: pague.dev API
  description: pague.dev Payment API documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://api-gateway.pague.dev/v2
security: []
paths:
  /transactions/{id}/refund:
    post:
      tags:
        - External API - Transactions
      summary: Request transaction refund
      description: >-
        Requests a full refund of the given payment transaction. The refund is
        asynchronous — confirmation arrives via the `refund_completed` webhook
        once the PSP processes it.


        **Required permission:** `REFUND:WRITE` or `FULL_ACCESS`
      operationId: ExternalTransactionsController_requestRefund
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the payment transaction to be refunded
          schema:
            type: string
            format: uuid
        - $ref: '#/components/parameters/SubAccount'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestRefundInput'
      responses:
        '201':
          description: >-
            Refund requested successfully. Status remains PENDING until
            confirmation via webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestRefundOutput'
        '400':
          description: >-
            Bad Request - Transaction cannot be refunded (already refunded,
            expired, invalid status, etc.)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestErrorResponse'
        '401':
          description: Unauthorized - Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
        '404':
          description: Not Found - Transaction not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - bearerAuth: []
components:
  parameters:
    SubAccount:
      name: X-Sub-Account
      in: header
      required: false
      description: >-
        Reference of the sub-account the operation runs against. When omitted,
        the operation happens on the main account; the reserved value
        `principal` also resolves to the main account and is equivalent to
        omitting the header. Accepted on every endpoint except `POST /auth` and
        the `/sub-accounts` endpoints themselves, which always operate on the
        main account.


        Possible errors: `404 SUB_ACCOUNT_NOT_FOUND`, `403
        SUB_ACCOUNT_FORBIDDEN`, `403 SUB_ACCOUNT_SUSPENDED`.


        Requires the credential to have **sub-account access** enabled (Settings
        → Integration → API Credentials). It starts turned off and is not
        replaced by any permission, not even `FULL_ACCESS`: without it the
        response is `403 SUB_ACCOUNT_FORBIDDEN`.
      schema:
        type: string
        pattern: ^[a-z0-9][a-z0-9_-]{1,31}$
        example: loja-centro
  schemas:
    RequestRefundInput:
      type: object
      properties:
        reason:
          type: string
          maxLength: 255
          description: Refund reason (optional, up to 255 characters)
          example: Cliente solicitou cancelamento
    RequestRefundOutput:
      type: object
      properties:
        originalTransactionId:
          type: string
          format: uuid
          description: ID of the original transaction being refunded
        pspProvider:
          type: string
          description: PSP provider that processed the refund
        pspRefundTransactionId:
          type: string
          description: Refund transaction ID at the PSP
        status:
          type: string
          enum:
            - PENDING
            - CONFIRMED
            - ERROR
          description: >-
            Status returned by the PSP. PENDING means the refund was accepted
            but not yet confirmed — confirmation arrives via the
            `refund_completed` webhook.
          example: PENDING
      required:
        - originalTransactionId
        - pspProvider
        - pspRefundTransactionId
        - status
    BadRequestErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        error:
          type: string
          example: BadRequest
        message:
          type: string
          example: name must be longer than or equal to 2 characters
        details:
          type: object
        timestamp:
          type: string
          example: '2025-12-15T22:00:00.000Z'
        traceId:
          type: string
      required:
        - statusCode
        - error
        - message
        - timestamp
    UnauthorizedErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          example: 401
        error:
          type: string
          example: Unauthorized
        message:
          type: string
          example: Authentication token is required
        details:
          type: object
        timestamp:
          type: string
          example: '2025-12-15T22:00:00.000Z'
        traceId:
          type: string
      required:
        - statusCode
        - error
        - message
        - timestamp
    NotFoundErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          example: 404
        error:
          type: string
          example: NotFound
        message:
          type: string
          example: Resource with id 550e8400-e29b-41d4-a716-446655440000 not found
        details:
          type: object
          example:
            resource: Example
            id: 550e8400-e29b-41d4-a716-446655440000
        timestamp:
          type: string
          example: '2025-12-15T22:00:00.000Z'
        traceId:
          type: string
      required:
        - statusCode
        - error
        - message
        - timestamp
    InternalServerErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          example: 500
        error:
          type: string
          example: InternalError
        message:
          type: string
          example: An unexpected error occurred
        details:
          type: object
        timestamp:
          type: string
          example: '2025-12-15T22:00:00.000Z'
        traceId:
          type: string
          example: 2771463d58840c8e116dc6dda1e1e5d0
      required:
        - statusCode
        - error
        - message
        - timestamp
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Access token obtained from POST /auth (client_id + client_secret). Valid
        for 300 seconds.

````