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

# POST /v1/gateway/payment/{id}/cancel



## OpenAPI

````yaml api/2026-02-19.preview.json POST /v1/gateway/payment/{id}/cancel
openapi: 3.1.0
info:
  title: WalletConnect Pay API
  version: 2026-02-19.preview
servers:
  - url: https://api.pay.walletconnect.com
security:
  - API Key: []
  - ApiKey: []
  - AppId: []
tags:
  - name: Gateway
  - name: Payments
  - name: Refunds
  - name: Merchant Management
  - name: Settlements
  - name: Crypto Settlement
paths:
  /v1/gateway/payment/{id}/cancel:
    post:
      tags:
        - Gateway
      operationId: gatewayCancelPayment
      parameters:
        - name: Api-Key
          in: header
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: App-Id
          in: header
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: Client-Id
          in: header
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: WCP-Version
          in: header
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: Sdk-Name
          in: header
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: Sdk-Version
          in: header
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: Sdk-Platform
          in: header
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentId'
      responses:
        '200':
          description: Payment cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayCancelPaymentResponse'
        '400':
          description: Payment cannot be cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Payment not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    PaymentId:
      type: string
      description: Payment ID
      examples:
        - pay_7fa2ecc101ARZ3NDEKTSV4RRFFQ69G5FAV
    GatewayCancelPaymentResponse:
      type: object
      required:
        - paymentId
        - status
        - cancelledReason
        - cancelledAt
      properties:
        cancelledAt:
          type: string
        cancelledReason:
          type: string
        paymentId:
          $ref: '#/components/schemas/PaymentId'
        status:
          $ref: '#/components/schemas/PaymentStatus'
      example:
        cancelledAt: '2025-01-14T10:30:00Z'
        cancelledReason: cancelled_by_user
        paymentId: pay_c4a2ecc101KQFN7X7RZACHTYV7JX5C4QET
        status: cancelled
    ErrorResponse:
      type: object
      description: Standard error response structure for API errors.
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
    PaymentStatus:
      type: string
      description: |-
        Payment status representing the lifecycle of a payment.

        Payments progress through these states from creation to terminal status.
        Some states are specific to the payment source (pull vs push).
      enum:
        - requires_action
        - processing
        - succeeded
        - failed
        - expired
        - cancelled
    ErrorCode:
      type: string
      description: |-
        Standard error codes for API responses.

        This prevents typos like "invlaid_params" from reaching production.
      enum:
        - rate_limited
        - invalid_params
        - params_validation
        - payment_not_found
        - idempotency_conflict
        - internal_error
        - invalid_api_key
        - unauthorized
        - forbidden
        - invalid_state
        - payment_expired
        - quote_expired
        - missing_api_key
        - missing_merchant_api_key
        - missing_merchant_id
        - header_not_ascii
        - not_sandbox_api_key
        - merchant_not_found
        - merchant_exists
        - api_key_not_found
        - partner_not_found
        - customer_not_found
        - wallet_not_found
        - executor_not_found
        - missing_app_id
        - missing_client_id
        - invalid_app_id
        - conflicting_auth_headers
        - missing_auth_headers
        - invalid_api_version
        - unknown_api_version
        - api_version_downgrade
        - sanctioned_user
        - payment_not_succeeded
        - already_refunded
  securitySchemes:
    API Key:
      type: apiKey
      in: header
      name: Api-Key
    ApiKey:
      type: apiKey
      in: header
      name: Api-Key
      description: Private API key for wallet authentication
    AppId:
      type: apiKey
      in: header
      name: App-Id
      description: >-
        Public App ID for wallet authentication. When using this auth mode, the
        Client-Id header is also required.

````