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

# Cancel Payment



## OpenAPI

````yaml POST /payments/cancel/{xIntentId}
openapi: 3.0.1
info:
  title: xPay API Store
  description: ''
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.xpaycheckout.com
security:
  - basicAuth: []
paths:
  /payments/cancel/{xIntentId}:
    post:
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        description: Cancel Payment
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cancel-payment'
        required: true
      responses:
        '200':
          description: Cancel Payment response
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
        pattern: ^[a-zA-Z0-9\-_:\.]+$
      description: >-
        A unique key for making the request idempotent. Must match pattern:
        `^[a-zA-Z0-9\-_:\.]+$`. See [Idempotent
        Requests](/developer-resources/idempotency) for more details.
      example: KG5LxwFBepaKHyUD
  schemas:
    cancel-payment:
      required:
        - xIntentId
      type: object
      properties:
        xIntentId:
          description: Unique identifier of the payment
          type: string
          example: in_fooBOwYsaK50AEfK
    Error:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          example: bad_request
        errorDescription:
          type: string
          example: Failed to read request
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````