> ## 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 payment

> Cancels a payment in CREATED or SCHEDULED status before execution.



## OpenAPI

````yaml en/openapi/v3-current/payments.yaml post /v1/payments/{id}/cancel
openapi: 3.0.3
info:
  title: Payments — via BTG API
  description: >-
    API for the Lerian Payments interface via BTG. It covers boleto issuance,
    cancellation, installments, and queries; bill payments (bankslip, utilities,
    and DARF), cancellation, and queries; aggregated boleto and payment
    dashboards; provider connection and outbound webhook configuration; and the
    provider webhook receiver for settlement events.
  version: v1.0.0
servers:
  - url: https://payments.sandbox.lerian.net
security: []
tags:
  - name: Health
    description: Service health and readiness endpoints
  - name: Boletos
    description: Boleto issuance, cancellation, installments, and queries
  - name: Payments
    description: Bill payments (bankslip, utilities, DARF), cancellation, and queries
  - name: Dashboards
    description: Aggregated metrics and dashboards for boletos and payments
  - name: Admin
    description: Administrative endpoints for webhook configuration
  - name: Webhooks
    description: Provider webhook receiver for settlement events
paths:
  /v1/payments/{id}/cancel:
    post:
      tags:
        - Payments
      summary: Cancel a payment
      description: Cancels a payment in CREATED or SCHEDULED status before execution.
      parameters:
        - description: Tenant organization ID
          in: header
          name: X-Organization-Id
          required: true
          schema:
            type: string
        - description: Idempotency key (UUID v4 or v7)
          in: header
          name: Idempotency-Key
          required: true
          schema:
            type: string
        - description: Payment ID (UUID)
          in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/http.cancelPaymentRequest'
        description: Cancellation payload
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/http.cancelPaymentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pluginerrors.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pluginerrors.ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pluginerrors.ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pluginerrors.ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pluginerrors.ErrorResponse'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pluginerrors.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    http.cancelPaymentRequest:
      properties:
        reason:
          type: string
      type: object
    http.cancelPaymentResponse:
      properties:
        canceledAt:
          type: string
        cancellationReason:
          type: string
        id:
          type: string
        providerId:
          type: string
        status:
          type: string
      type: object
    pluginerrors.ErrorResponse:
      properties:
        code:
          example: PBP-0001
          type: string
        details:
          additionalProperties: {}
          type: object
        message:
          example: dueDate must be in YYYY-MM-DD format
          type: string
        title:
          example: Bad Request
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      description: 'Bearer token authentication (format: "Bearer {token}")'
      in: header
      name: Authorization
      type: apiKey

````