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

# Cancel a MED refund request

> Cancels a not-yet-Analisada refund request as the solicitante PSP (JDPI devolucao/cancelar, contract 2.11). An unknown id returns a coded 404. Persists the JDPI response entity and returns it.



## OpenAPI

````yaml /en/openapi/v3-current/pix.yaml post /v1/med/refunds/{idSolDevolucao}/cancel
openapi: 3.1.0
info:
  description: Brazilian PIX Direct (DICT + SPI) plugin API.
  title: plugin-br-pix-jd
  version: 1.0.0
servers: []
security:
  - BearerAuth: []
paths:
  /v1/med/refunds/{idSolDevolucao}/cancel:
    post:
      tags:
        - MED Refunds
      summary: Cancel a MED refund request
      description: >-
        Cancels a not-yet-Analisada refund request as the solicitante PSP (JDPI
        devolucao/cancelar, contract 2.11). An unknown id returns a coded 404.
        Persists the JDPI response entity and returns it.
      operationId: cancelMedRefund
      parameters:
        - description: The refund-request GUID.
          in: path
          name: idSolDevolucao
          required: true
          schema:
            description: The refund-request GUID.
            examples:
              - d4e5f6a7-b8c9-0123-def4-56789012345a
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelRefundRequestBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundRequestView'
          description: OK
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
components:
  schemas:
    CancelRefundRequestBody:
      additionalProperties: false
      properties:
        idempotencyKey:
          description: >-
            Client-supplied idempotency key: any stable business string. The
            plugin projects it deterministically into the GUID form JDPI
            requires (contract 6), so the same value always dedups against the
            same JDPI request and the raw value is never sent verbatim.
          examples:
            - med-cancel-2024-0001
          type: string
      required:
        - idempotencyKey
      type: object
    RefundRequestView:
      additionalProperties: false
      properties:
        analysisDeadline:
          description: >-
            Contestado-side analysis deadline (RFC 3339 UTC; contract §5, 6h
            Fraude / 48h otherwise); null for filer-side and terminal requests.
          examples:
            - '2024-01-01T18:00:00.000Z'
          type: string
        breached:
          description: >-
            True when the analysis deadline has been reached or passed (computed
            at read time); false when no deadline is set.
          examples:
            - false
          type: boolean
        detalhes:
          description: Free-text detail.
          examples:
            - Operational failure.
          type: string
        detalhesAnalise:
          description: Analysis detail.
          examples:
            - Insufficient balance.
          type: string
        dtHrCriacao:
          description: JDPI creation timestamp (RFC 3339 UTC).
          examples:
            - '2024-01-01T12:00:00.000Z'
          type: string
        dtHrRegistro:
          description: >-
            dtHrRegistro — when the request was REGISTERED in the JDPI base (raw
            JDPI instant), distinct from dtHrCriacao (the DICT creation
            instant). Returned by the §8.2.26 JDPI-base read only.
          examples:
            - '2021-08-06T10:33:08.241Z'
          type: string
        dtHrUltModificacao:
          description: >-
            JDPI last-modification timestamp (RFC 3339 UTC) — the poll
            watermark.
          examples:
            - '2024-01-01T12:05:00.000Z'
          type: string
        endToEndId:
          description: EndToEndId of the contested payment or devolucao.
          examples:
            - E1234567820240101000000000000001
          type: string
        endToEndIdDevolucao:
          description: pacs.004/pacs.008 devolucao reference, recorded at analysis.
          examples:
            - D1234567820240101000000000000099
          type: string
        idRecValores:
          description: Value-recovery GUID, when from a recovery.
          examples:
            - b2c3d4e5-f6a7-8901-bcde-f23456789012
          type: string
        idRelatoInfracao:
          description: Linked infraction GUID, when fraud.
          examples:
            - a1b2c3d4-e5f6-7890-abcd-ef1234567890
          type: string
        idSolDevolucao:
          description: Refund-request GUID (the natural key).
          examples:
            - d4e5f6a7-b8c9-0123-def4-56789012345a
          type: string
        ispbContestado:
          description: ISPB of the contested PSP.
          examples:
            - '87654321'
          type: string
        ispbSolicitante:
          description: ISPB of the requesting PSP.
          examples:
            - '12345678'
          type: string
        motivo:
          description: >-
            Refund motivo code (0=Falha Operacional, 1=Fraude, 3=Pix
            Automatico).
          examples:
            - 1
          format: int64
          type: integer
        motivoDescription:
          description: Human-readable refund motivo label.
          examples:
            - Fraude
          type: string
        motivoRejeicao:
          description: >-
            Rejection reason (0,1,3,4); present only when the analysis rejected
            the request.
          examples:
            - 0
          format: int64
          type: integer
        motivoRejeicaoDescription:
          description: Human-readable rejection-reason label.
          examples:
            - Falta de saldo
          type: string
        resultadoAnalise:
          description: >-
            Refund analysis result (0=Aceita Totalmente, 1=Aceita Parcialmente,
            2=Rejeitada); null until analysed.
          examples:
            - 0
          format: int64
          type: integer
        resultadoAnaliseDescription:
          description: Human-readable refund analysis-result label.
          examples:
            - Aceita Totalmente
          type: string
        status:
          description: stSolDevolucao lifecycle code (0=Aberta, 1=Cancelada, 2=Analisada).
          examples:
            - 0
          format: int64
          type: integer
        statusDescription:
          description: Human-readable stSolDevolucao label.
          examples:
            - Aberta
          type: string
        valorDevolucao:
          description: Requested refund amount, in centavos.
          examples:
            - 25000
          format: int64
          type: integer
        valorDevolvido:
          description: Amount actually refunded, in centavos; null when absent.
          examples:
            - 25000
          format: int64
          type: integer
      required:
        - idSolDevolucao
        - endToEndId
        - motivo
        - motivoDescription
        - valorDevolucao
        - status
        - statusDescription
        - ispbSolicitante
        - ispbContestado
        - dtHrCriacao
        - dtHrUltModificacao
        - breached
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````