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

# Cancel

> Cancel a payment if supported by the payment method.



## OpenAPI

````yaml https://raw.githubusercontent.com/seerbit/openapi/master/specs/external-api.yml post /payments/cancel
openapi: 3.0.1
info:
  title: SeerBit API Reference
  contact: {}
  version: '1.0'
servers:
  - url: https://seerbitapi.com/api/v2
security: []
tags:
  - name: AUTHENTICATION
  - name: STANDARD CHECKOUT
  - name: ORDER CHECKOUT
  - name: PAYMENT METHOD
  - name: MOMO
  - name: NON 3DS PAYMENT
  - name: CARD
  - name: ACCOUNT
  - name: TOKENIZE
  - name: AUTHORISE
  - name: PREAUTHORIZATION
  - name: RECURRENT
paths:
  /payments/cancel:
    post:
      tags:
        - PREAUTHORIZATION
      summary: Cancel
      description: Cancel a payment if supported by the payment method.
      operationId: Cancel
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelRequest'
        required: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cancel201Response'
        '400':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                type: object
              examples:
                400Response:
                  $ref: '#/components/examples/400Response'
                400Response2:
                  $ref: '#/components/examples/400Response2'
                400Response3:
                  $ref: '#/components/examples/400Response3'
                400Response4:
                  $ref: '#/components/examples/400Response4'
                400Response5:
                  $ref: '#/components/examples/400Response5'
                400Response6:
                  $ref: '#/components/examples/400Response6'
                400Response11:
                  $ref: '#/components/examples/400Response11'
        '403':
          description: Missing Header Token
          content:
            application/json:
              schema:
                type: object
              examples:
                403Response2:
                  $ref: '#/components/examples/403Response2'
                403Response3:
                  $ref: '#/components/examples/403Response3'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
              examples:
                400Response:
                  $ref: '#/components/examples/404Response1'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
              examples:
                500Response:
                  $ref: '#/components/examples/500Response'
      deprecated: false
      security:
        - Basic: []
components:
  schemas:
    CancelRequest:
      title: CancelRequest
      required:
        - country
        - paymentReference
        - productDescription
        - publicKey
      type: object
      properties:
        paymentReference:
          type: string
          description: >-
            This is the unique identifier for a transaction, to be generated by
            merchant.
        publicKey:
          type: string
          description: This is the merchant public key.
        country:
          type: string
          description: This is the country the customer is doing the transaction from
        productDescription:
          type: string
          description: This is the product description supplied by the merchant.
      example:
        paymentReference: PREAUTH124456789798765k3L1CB0
        publicKey: SBTESTPUBK_dhrpzbRpR34l6VmqkCFOKA94L5E1jSTu
        country: NG
        productDescription: test void
    Cancel201Response:
      title: CancelResponse
      type: object
      example:
        status: SUCCESS
        data:
          code: '00'
          payments:
            paymentReference: PREAUTH1244567890987654321CB0
            status: CANCELLED
            card:
              bin: '512345'
              last4: '0008'
          message: APPROVED
  examples:
    400Response:
      summary: An example of 400 response payload
      value:
        message: Bad Request
        error: There has been a problem with reading or understanding the request.
    400Response2:
      summary: An example of 400 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: Invalid/Missing parameters = publicKey
    400Response3:
      summary: An example of 400 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: Invalid/Missing parameters = amount
    400Response4:
      summary: An example of 400 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: Invalid/Missing parameters = paymentReference
    400Response5:
      summary: An example of 400 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: Invalid/Missing parameters = currency
    400Response6:
      summary: An example of 400 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: Invalid/Missing parameters = country
    400Response11:
      summary: An example of 400 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: No authorised transaction found for this reference
    403Response2:
      summary: An example of 403 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: Bad credentials = invalid public key
    403Response3:
      summary: An example of 403 response payload
      value:
        status: ERROR
        data:
          code: S12
          message: Bad credentials
    404Response1:
      summary: An example of 404 response payload
      value:
        message: Not Found
        error: The server can not find the requested resource
    500Response:
      summary: An example of 500 response payload
      value:
        message: Internal Server Error
        error: PROCESSING
  securitySchemes:
    Basic:
      type: http
      scheme: basic

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.