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

# Cancel a partner transaction safely with idempotent retries

> Cancels a partner transaction when the current state allows cancellation. Reuse the same `Idempotency-Key` for retries of the same cancellation intent.



## OpenAPI

````yaml /openapi/openapi.json post /partner/transactions/{id}/cancel
openapi: 3.1.0
info:
  title: CashWeb Partner API
  description: >-
    CashWeb Partner API enables crypto-to-fiat offramp transactions. Create
    quotes, manage transactions, receive lifecycle webhooks, and reconcile
    revenue.
  contact:
    name: Michael Anyi
    email: michael@cashweb.cash
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://api-staging.cashweb.cash/api/v1
    description: Staging environment
  - url: https://api.cashweb.cash/api/v1
    description: Production environment
security: []
paths:
  /partner/transactions/{id}/cancel:
    post:
      tags:
        - Partner API
      summary: Cancel a partner transaction safely with idempotent retries
      description: >-
        Cancels a partner transaction when the current state allows
        cancellation. Reuse the same `Idempotency-Key` for retries of the same
        cancellation intent.
      operationId: cancel_transaction
      parameters:
        - name: id
          in: path
          description: Partner transaction identifier
          required: true
          schema:
            type: string
            format: uuid
        - name: Idempotency-Key
          in: header
          description: Idempotency key for safe retries
          required: true
          schema:
            type: string
          example: partner-cancel-0001
      responses:
        '200':
          description: Transaction cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_PartnerTransactionResponse'
              example:
                data:
                  amount: '161500.00'
                  crypto_amount: '100.00'
                  crypto_currency: usdt
                  deposit_address: TUr4xexampleaddress
                  expires_at: '2026-02-12T12:00:00Z'
                  id: 01917f00-7b4c-7f56-8a2b-15998d58c9f3
                  merchant_id: mrc_001
                  merchant_reference: order-4551
                  network: trc20
                  rate: '1615.00'
                  status: cancelled
                  terminal_id: term_01
                message: Transaction cancelled
                success: true
        '400':
          description: Invalid request (missing idempotency header or malformed input)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid partner API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Transaction not found for this partner
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Transaction is in a non-cancellable state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: CONFLICT
                  message: Transaction cannot be cancelled in status completed
                  timestamp: '2026-02-12T12:00:00Z'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - PartnerApiKey: []
components:
  schemas:
    ApiResponse_PartnerTransactionResponse:
      type: object
      description: Standard API response wrapper for all successful responses
      required:
        - success
        - data
      properties:
        data:
          type: object
          description: >-
            Partner transaction snapshot returned by create and cancel
            endpoints.
          required:
            - id
            - deposit_address
            - network
            - expires_at
            - status
            - rate
            - amount
            - crypto_amount
            - crypto_currency
          properties:
            amount:
              type: string
              description: Fiat amount in NGN derived or fixed at create time.
              example: '161500.00'
            crypto_amount:
              type: string
              description: Crypto amount in token units.
              example: '100.00'
            crypto_currency:
              type: string
              description: Token for this transaction.
              example: usdt
            deposit_address:
              type: string
              description: >-
                Deposit address where the seller should send funds for this
                transaction.
              example: '0x9d8D32b6D7DfDdAb66f6a79b9dA8fA2E30A91B7a'
            expires_at:
              type: string
              format: date-time
              description: >-
                Deposit deadline. Deposits after this timestamp may require
                manual recovery.
              example: '2026-02-12T12:00:00Z'
            id:
              type: string
              format: uuid
              example: 01917f00-7b4c-7f56-8a2b-15998d58c9f3
            merchant_id:
              type:
                - string
                - 'null'
              description: Partner-provided merchant identifier.
              example: mrc_001
            merchant_reference:
              type:
                - string
                - 'null'
              description: >-
                Partner-owned canonical reference used for timeout recovery and
                reconciliation.
              example: order-4551
            network:
              type: string
              description: Network expected for the deposit address.
              example: bep20
            rate:
              type: string
              description: Executable partner rate in NGN per token.
              example: '1615.00'
            status:
              type: string
              description: >-
                Current transaction lifecycle status.

                Allowed values: pending, awaiting_deposit, deposit_confirming,
                selling_crypto, order_filled,

                completed, failed, expired, cancelled, refunded.
              example: awaiting_deposit
            terminal_id:
              type:
                - string
                - 'null'
              description: Partner-provided terminal identifier.
              example: term_01
        message:
          type:
            - string
            - 'null'
          description: Optional message for additional information
        success:
          type: boolean
          description: Indicates if the request was successful
          example: 'true'
    ErrorResponse:
      type: object
      description: Error response structure for OpenAPI documentation
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetails'
          description: Error details
    ErrorDetails:
      type: object
      description: Error details structure
      required:
        - message
        - code
        - timestamp
      properties:
        code:
          type: string
          description: Machine-readable error code
        message:
          type: string
          description: Human-readable error message
        timestamp:
          type: string
          format: date-time
          description: Timestamp when the error occurred
  securitySchemes:
    PartnerApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````