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

# Simulate a payment on a sandbox checkout session

> Sandbox only. Pays an open checkout session without a shopper, so you can test your
order flow and webhook handling end to end without a browser or 3D Secure.

The payment goes through Kalixo's sandbox test processor, never a real payment provider.
Everything after that is the normal flow: `payment.authorized`, then `payment.captured`
once the capture is confirmed (or `payment.failed`), and `checkout_session.completed`.
You can refund the payment and simulate a dispute on it with
`POST /v1/test-helpers/payments/{id}/dispute`.

| `outcome` | Result |
| --- | --- |
| `succeeded` | Authorised and, with automatic capture, captured |
| `declined` | Declined; the session stays open, so you can simulate again |
| `insufficient_funds` | Declined with `decline_code: insufficient_funds` |
| `processing` | Pending; the outcome arrives by webhook |
| `amount_mismatch` | Reported with a different amount; Kalixo reverses it and sends `payment.amount_mismatch` |

Use a session the shopper has not paid on yet: a session with an attempt at a payment
provider returns `session_has_attempts`.




## OpenAPI

````yaml /checkout/openapi.yaml post /v1/test-helpers/checkout-sessions/{id}/simulate
openapi: 3.1.0
info:
  title: Kalixo Checkout API
  version: '2026-10-01'
  summary: Payment orchestration API for Kalixo partners.
  description: >
    Kalixo Checkout lets partners collect payments from their shoppers through
    one

    provider-neutral API. Kalixo is merchant of record and handles payment

    processing, so partners never integrate a payment provider directly.


    - Amounts are integers in the currency's minor unit (EUR 49.99 = `4999`).

    - Server endpoints use a secret key (`kc_sk_test_...` or `kc_sk_live_...`).

    - Client endpoints are called by `Kalixo.js` with a publishable key and the
      checkout session's `client_secret`.
    - Every `POST` with a secret key requires an `Idempotency-Key` header.

    - Every response has a `Request-Id` header. Errors repeat it in
    `error.request_id`;
      include it when you contact Kalixo support.
    - Bursts above about 50 requests per second per API key can be rejected with
      `429 rate_limit_error`. Retry with exponential backoff.
    - Request bodies with unknown fields are rejected (`parameter_invalid`).
    Responses
      and events can gain fields at any time; ignore the ones you do not know.
  contact:
    name: Kalixo Checkout integrations
    email: integrations@kalixo.io
  license:
    name: Proprietary
    url: https://kalixo.io/legal
servers:
  - url: https://checkout.kalixo.io
    description: Live
  - url: https://sandbox.checkout.kalixo.io
    description: Sandbox (test keys only, never moves money)
security:
  - secretKey: []
tags:
  - name: Checkout sessions
    description: >-
      Create a session with the amount to charge, then show it with Kalixo.js or
      the hosted checkout.
  - name: Payments
    description: Read payments and capture or cancel authorized payments.
  - name: Refunds
    description: Full and partial refunds of captured payments.
  - name: Payment links
    description: Kalixo-hosted payment links that survive provider switches.
  - name: Customers
    description: Customers and their stored payment methods for one-click checkout.
  - name: Disputes
    description: Chargebacks and information requests, plus evidence upload.
  - name: Events
    description: The event log behind webhooks.
  - name: Webhook endpoints
    description: Where Kalixo delivers signed events.
  - name: Reports
    description: CSV exports of transactions for reconciliation and partner invoicing.
  - name: Test helpers
    description: Sandbox only. Send test webhook events and simulate disputes.
  - name: Client
    description: Called by Kalixo.js and the hosted checkout. Not for partner servers.
paths:
  /v1/test-helpers/checkout-sessions/{id}/simulate:
    parameters:
      - $ref: '#/components/parameters/PathId'
    post:
      tags:
        - Test helpers
      summary: Simulate a payment on a sandbox checkout session
      description: >
        Sandbox only. Pays an open checkout session without a shopper, so you
        can test your

        order flow and webhook handling end to end without a browser or 3D
        Secure.


        The payment goes through Kalixo's sandbox test processor, never a real
        payment provider.

        Everything after that is the normal flow: `payment.authorized`, then
        `payment.captured`

        once the capture is confirmed (or `payment.failed`), and
        `checkout_session.completed`.

        You can refund the payment and simulate a dispute on it with

        `POST /v1/test-helpers/payments/{id}/dispute`.


        | `outcome` | Result |

        | --- | --- |

        | `succeeded` | Authorised and, with automatic capture, captured |

        | `declined` | Declined; the session stays open, so you can simulate
        again |

        | `insufficient_funds` | Declined with `decline_code:
        insufficient_funds` |

        | `processing` | Pending; the outcome arrives by webhook |

        | `amount_mismatch` | Reported with a different amount; Kalixo reverses
        it and sends `payment.amount_mismatch` |


        Use a session the shopper has not paid on yet: a session with an attempt
        at a payment

        provider returns `session_has_attempts`.
      operationId: simulateCheckoutSession
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                outcome:
                  type: string
                  enum:
                    - succeeded
                    - declined
                    - insufficient_funds
                    - processing
                    - amount_mismatch
                  default: succeeded
            examples:
              succeeded:
                $ref: '#/components/examples/SimulateSessionSucceeded'
              declined:
                $ref: '#/components/examples/SimulateSessionDeclined'
      responses:
        '200':
          description: The simulated attempt and its immediate result. Webhooks follow.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSessionSimulation'
              examples:
                succeeded:
                  $ref: '#/components/examples/CheckoutSessionSimulation'
        '400':
          $ref: '#/components/responses/TestHelperBadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/SessionSimulationConflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    PathId:
      name: id
      in: path
      required: true
      schema:
        type: string
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: >
        Unique key per logical request, reused on retries. 1 to 255 characters,
        kept for

        24 hours. A retry with the same key and body returns the stored response
        with the

        header `Idempotent-Replayed: true`.
      schema:
        type: string
        minLength: 1
        maxLength: 255
  examples:
    SimulateSessionSucceeded:
      summary: A successful payment
      value:
        outcome: succeeded
    SimulateSessionDeclined:
      summary: A declined payment
      value:
        outcome: declined
    CheckoutSessionSimulation:
      summary: Authorised; payment.captured follows by webhook
      value:
        object: checkout_session_simulation
        checkout_session: cs_01M75N56PRT5WA5G2JF25B20RK
        payment: pay_01M75N56PRT5WA5G2JF25B20RJ
        outcome: succeeded
        attempt:
          id: att_01M75N56PRT5WA5G2JF25B20RM
          status: authorized
          error: null
    ErrTestModeOnly:
      summary: test_mode_only
      value:
        error:
          type: invalid_request_error
          code: test_mode_only
          decline_code: null
          message: Test helpers are available in the sandbox only
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrTestHelperUnavailable:
      summary: test_helper_unavailable
      value:
        error:
          type: invalid_request_error
          code: test_helper_unavailable
          decline_code: null
          message: >-
            Dispute simulation works only for payments made with the sandbox
            test cards
          param: id
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrParameterInvalid:
      summary: parameter_invalid
      value:
        error:
          type: invalid_request_error
          code: parameter_invalid
          decline_code: null
          message: amount must be an integer number
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrApiKeyMissing:
      summary: api_key_missing
      value:
        error:
          type: authentication_error
          code: api_key_missing
          decline_code: null
          message: Provide your API key in the Authorization header as a Bearer token
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrApiKeyInvalid:
      summary: api_key_invalid
      value:
        error:
          type: authentication_error
          code: api_key_invalid
          decline_code: null
          message: Invalid API key
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrApiKeyModeMismatch:
      summary: api_key_mode_mismatch
      value:
        error:
          type: authentication_error
          code: api_key_mode_mismatch
          decline_code: null
          message: This environment only accepts test keys
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrSecretKeyRequired:
      summary: secret_key_required
      value:
        error:
          type: authentication_error
          code: secret_key_required
          decline_code: null
          message: This endpoint requires a secret key
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrResourceMissing:
      summary: resource_missing
      value:
        error:
          type: not_found_error
          code: resource_missing
          decline_code: null
          message: 'No such payment: ''pay_01M75N56PRT5WA5G2JF25B20RJ'''
          param: id
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrSessionNotOpen:
      summary: session_not_open
      value:
        error:
          type: invalid_request_error
          code: session_not_open
          decline_code: null
          message: This checkout session is complete
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrSessionExpired:
      summary: session_expired
      value:
        error:
          type: invalid_request_error
          code: session_expired
          decline_code: null
          message: This checkout session has expired
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrSessionHasAttempts:
      summary: session_has_attempts
      value:
        error:
          type: invalid_request_error
          code: session_has_attempts
          decline_code: null
          message: >-
            This session already has a payment attempt with the payment
            provider. Simulate on a new session.
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrPaymentInProgressClient:
      summary: payment_in_progress
      value:
        error:
          type: invalid_request_error
          code: payment_in_progress
          decline_code: null
          message: This payment is already being processed
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrRateLimited:
      summary: rate_limited
      value:
        error:
          type: rate_limit_error
          code: rate_limited
          decline_code: null
          message: Too many requests. Slow down and retry with backoff.
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    ErrInternal:
      summary: internal_error
      value:
        error:
          type: api_error
          code: internal_error
          decline_code: null
          message: An internal error occurred. Retry with the same Idempotency-Key.
          param: null
          request_id: req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
  schemas:
    CheckoutSessionSimulation:
      type: object
      required:
        - object
        - checkout_session
        - payment
        - outcome
        - attempt
      properties:
        object:
          type: string
          const: checkout_session_simulation
        checkout_session:
          type: string
        payment:
          type: string
        outcome:
          type: string
          enum:
            - succeeded
            - declined
            - insufficient_funds
            - processing
            - amount_mismatch
        attempt:
          type: object
          required:
            - id
            - status
            - error
          description: >-
            The simulated attempt's immediate result. The payment's final state
            arrives by webhook.
          properties:
            id:
              type: string
            status:
              type: string
              enum:
                - authorized
                - processing
                - requires_action
                - refused
                - error
            error:
              oneOf:
                - $ref: '#/components/schemas/PaymentError'
                - type: 'null'
    PaymentError:
      type: object
      properties:
        code:
          type: string
          examples:
            - payment_declined
        decline_code:
          type:
            - string
            - 'null'
          examples:
            - insufficient_funds
        message:
          type: string
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
            - request_id
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - not_found_error
                - idempotency_error
                - payment_error
                - rate_limit_error
                - api_error
            code:
              type: string
              examples:
                - amount_locked
              description: >-
                Stable machine-readable code. Branch on `code`, not on
                `message`.
            decline_code:
              type:
                - string
                - 'null'
              description: Set on declined payments only.
            message:
              type: string
              description: Human-readable explanation. Can change; do not parse it.
            param:
              type:
                - string
                - 'null'
              description: >-
                The request field or header that caused the error, when there is
                one.
            request_id:
              type: string
              description: >-
                Same as the `Request-Id` response header. Include it when you
                contact support.
  responses:
    TestHelperBadRequest:
      description: Invalid request (`invalid_request_error`).
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            test_mode_only:
              $ref: '#/components/examples/ErrTestModeOnly'
            test_helper_unavailable:
              $ref: '#/components/examples/ErrTestHelperUnavailable'
            parameter_invalid:
              $ref: '#/components/examples/ErrParameterInvalid'
    Unauthorized:
      description: Missing, invalid or wrong-mode API key (`authentication_error`).
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            api_key_missing:
              $ref: '#/components/examples/ErrApiKeyMissing'
            api_key_invalid:
              $ref: '#/components/examples/ErrApiKeyInvalid'
            api_key_mode_mismatch:
              $ref: '#/components/examples/ErrApiKeyModeMismatch'
            secret_key_required:
              $ref: '#/components/examples/ErrSecretKeyRequired'
    NotFound:
      description: The object does not exist for your account (`not_found_error`).
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            resource_missing:
              $ref: '#/components/examples/ErrResourceMissing'
    SessionSimulationConflict:
      description: The checkout session cannot be simulated in its current state.
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            session_not_open:
              $ref: '#/components/examples/ErrSessionNotOpen'
            session_expired:
              $ref: '#/components/examples/ErrSessionExpired'
            session_has_attempts:
              $ref: '#/components/examples/ErrSessionHasAttempts'
            payment_in_progress:
              $ref: '#/components/examples/ErrPaymentInProgressClient'
    TooManyRequests:
      description: >-
        Too many requests (`rate_limit_error`). Wait for `Retry-After` seconds,
        then retry with exponential backoff.
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rate_limited:
              $ref: '#/components/examples/ErrRateLimited'
    ServerError:
      description: Kalixo-side error (`api_error`). Retry with the same `Idempotency-Key`.
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal_error:
              $ref: '#/components/examples/ErrInternal'
  headers:
    RequestId:
      description: >-
        Unique ID of the request. Send it to Kalixo support. Matches
        `error.request_id`.
      schema:
        type: string
        examples:
          - req_6f1c2a9e0b7d4c3f8a1e5d2b9c0f4a7e
    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: integer
        minimum: 1
        examples:
          - 12
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      description: Secret key, `kc_sk_test_...` or `kc_sk_live_...`. Server-side only.

````

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