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

# Solicitar Reembolso

> Solicita um reembolso total da transação de pagamento informada. O reembolso é assíncrono — a confirmação chega via webhook `refund_completed` quando o PSP processar.

**Permissão requerida:** `REFUND:WRITE` ou `FULL_ACCESS`



## OpenAPI

````yaml POST /transactions/{id}/refund
openapi: 3.0.0
info:
  title: MisesPay API
  description: MisesPay Payment API documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://api.misespay.com/v2
security: []
paths:
  /transactions/{id}/refund:
    post:
      tags:
        - External API - Transactions
      summary: Solicitar reembolso de transação
      description: >-
        Solicita um reembolso total da transação de pagamento informada. O
        reembolso é assíncrono — a confirmação chega via webhook
        `refund_completed` quando o PSP processar.


        **Permissão requerida:** `REFUND:WRITE` ou `FULL_ACCESS`
      operationId: ExternalTransactionsController_requestRefund
      parameters:
        - name: id
          required: true
          in: path
          description: ID da transação de pagamento a ser reembolsada
          schema:
            type: string
            format: uuid
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestRefundInput'
      responses:
        '201':
          description: >-
            Reembolso solicitado com sucesso. Status PENDING até a confirmação
            via webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestRefundOutput'
        '400':
          description: >-
            Bad Request - Transação não pode ser reembolsada (já reembolsada,
            expirada, status inválido, 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 - Transação não encontrada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    RequestRefundInput:
      type: object
      properties:
        reason:
          type: string
          maxLength: 255
          description: Motivo do reembolso (opcional, máximo 255 caracteres)
          example: Cliente solicitou cancelamento
    RequestRefundOutput:
      type: object
      properties:
        originalTransactionId:
          type: string
          format: uuid
          description: ID da transação original que está sendo reembolsada
        pspProvider:
          type: string
          description: Provedor PSP que processou o reembolso
        pspRefundTransactionId:
          type: string
          description: ID da transação de reembolso no PSP
        status:
          type: string
          enum:
            - PENDING
            - CONFIRMED
            - ERROR
          description: >-
            Status retornado pelo PSP. PENDING significa que o reembolso foi
            aceito mas ainda não foi confirmado — a confirmação chega via
            webhook `refund_completed`.
          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 obtido no POST /auth (client_id + client_secret). Válido
        por 300 segundos.

````