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

# Cancel a pending payment

> Request cancellation of a payment that is still pending — for example to abort an in-progress checkout before it completes.

    Only payments with status PENDING are eligible; any other status (including PAID, FAILED, CANCELLED, REFUNDED, PARTIALLY_REFUNDED, UNPAID, and EXPIRED) returns an error. Currently only Stripe-processed payments are supported — PayPal payments and subscription plan-change payments cannot be cancelled through this endpoint.

    This only requests cancellation from the payment processor; it does not mark the payment as cancelled immediately. The payment's status updates to CANCELLED once the processor confirms the cancellation asynchronously.



## OpenAPI

````yaml /api-reference/api-docs.yaml patch /v0/payments/{paymentId}/cancel
openapi: 3.1.0
info:
  title: Fungies API v0
  version: 0.3.8
servers:
  - url: https://api.fungies.io
security: []
tags:
  - name: discounts
    description: Discounts related endpoints
  - name: keys
    description: Offer product keys related endpoints
  - name: orders
    description: Orders related endpoints
  - name: payments
    description: Payments related endpoints
  - name: offers
    description: Offers related endpoints
  - name: products
    description: Products related endpoints
  - name: subscriptions
    description: Subscriptions related endpoints
  - name: tax
    description: Tax calculation related endpoints
  - name: users
    description: Users related endpoints
  - name: variants
    description: Product variants related endpoints
  - name: plans
    description: Product plans related endpoints
  - name: elements
    description: Elements related endpoints
  - name: webhooks
    description: Webhooks related endpoints
paths:
  /v0/payments/{paymentId}/cancel:
    patch:
      tags:
        - payments
      summary: Cancel a pending payment
      description: >-
        Request cancellation of a payment that is still pending — for example to
        abort an in-progress checkout before it completes.

            Only payments with status PENDING are eligible; any other status (including PAID, FAILED, CANCELLED, REFUNDED, PARTIALLY_REFUNDED, UNPAID, and EXPIRED) returns an error. Currently only Stripe-processed payments are supported — PayPal payments and subscription plan-change payments cannot be cancelled through this endpoint.

            This only requests cancellation from the payment processor; it does not mark the payment as cancelled immediately. The payment's status updates to CANCELLED once the processor confirms the cancellation asynchronously.
      operationId: PatchV0PaymentsPaymentIdCancel
      parameters:
        - name: paymentId
          in: path
          required: true
          description: Unique identifier (UUID) of the payment.
          schema:
            $ref: >-
              #/components/schemas/PatchV0PaymentsPaymentIdCancelParameterPaymentId
      requestBody:
        description: PATCH /v0/payments/:paymentId/cancel Request body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchV0PaymentsPaymentIdCancelRequestBody'
      responses:
        '200':
          description: PATCH /v0/payments/:paymentId/cancel Positive response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchV0PaymentsPaymentIdCancelPositiveResponse
        '400':
          description: PATCH /v0/payments/:paymentId/cancel Negative response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchV0PaymentsPaymentIdCancelNegativeResponse
              examples:
                example1:
                  value:
                    status: error
                    error:
                      message: Sample error message
      security:
        - APIKEY_1: []
          APIKEY_2: []
components:
  schemas:
    PatchV0PaymentsPaymentIdCancelParameterPaymentId:
      type: string
      format: uuid
      description: Unique identifier (UUID) of the payment.
    PatchV0PaymentsPaymentIdCancelRequestBody:
      type: object
      properties: {}
      required: []
    PatchV0PaymentsPaymentIdCancelPositiveResponse:
      type: object
      properties:
        status:
          type: string
          const: success
        data:
          type: object
          properties:
            success:
              type: boolean
          required:
            - success
      required:
        - status
        - data
    PatchV0PaymentsPaymentIdCancelNegativeResponse:
      type: object
      properties:
        status:
          type: string
          const: error
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - status
        - error
  securitySchemes:
    APIKEY_1:
      type: apiKey
      in: header
      name: x-fngs-public-key
    APIKEY_2:
      type: apiKey
      in: header
      name: x-fngs-secret-key

````