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

# Simulate a card payment

> **Sandbox only.** Simulates a merchant payment on an `ACTIVE` card whose product supports every operation. It fires `transaction.created`, then `transaction.updated` unless `outcome` is `PENDING`. Returns 404 in production.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sandbox/spend
openapi: 3.1.0
info:
  title: StableMesh Open API
  version: 1.0.0
  description: >-
    Issue and manage StableMesh cards from your own server. Every endpoint is
    `POST` with a JSON body, authenticated with your API key in `X-API-KEY`.
  contact:
    email: contact@stablemesh.io
servers:
  - url: https://api.stablemesh.io
    description: Production
security:
  - ApiKey: []
tags:
  - name: Account
    description: Your USD account.
  - name: Deposits
    description: Fund your USD account with stablecoins.
  - name: Cards
    description: Issue, fund and control cards.
  - name: Webhooks
    description: Configure event delivery.
  - name: Sandbox
    description: Simulate deposits and payments in the sandbox.
paths:
  /v1/sandbox/spend:
    post:
      tags:
        - Sandbox
      summary: Simulate a card payment
      description: >-
        **Sandbox only.** Simulates a merchant payment on an `ACTIVE` card whose
        product supports every operation. It fires `transaction.created`, then
        `transaction.updated` unless `outcome` is `PENDING`. Returns 404 in
        production.
      operationId: v1_sandbox_spend
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                cardId:
                  type: string
                  description: The card's id, from `card/list` or `card/create`.
                  example: '2026100117908000004821'
                amount:
                  type:
                    - string
                    - number
                  description: USD.
                  example: '19.99'
                merchantName:
                  type: string
                  description: Defaults to `SANDBOX MERCHANT`.
                outcome:
                  type: string
                  description: Final state of the payment.
                  enum:
                    - COMPLETED
                    - PENDING
                    - FAILED
                  default: COMPLETED
                  example: COMPLETED
              required:
                - cardId
                - amount
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: '`0` on success.'
                    example: 0
                  message:
                    type: string
                    description: '`ok` on success.'
                    example: ok
                  data:
                    $ref: '#/components/schemas/Transaction'
                required:
                  - code
                  - message
                  - data
        '400':
          description: Refused (bad parameter, business rule). Nothing changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, invalid, revoked or expired API key (`11002`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Request from an IP not on the key's allowlist (`11003`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Over the per-key rate limit (`11004`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >-
            Internal error (`9999`). The outcome may be unknown; check state
            before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      servers:
        - url: https://{sandboxHost}
          description: Sandbox (credentials on request)
          variables:
            sandboxHost:
              default: sandbox.example
              description: Sandbox host sent to you with your sandbox access.
components:
  schemas:
    Transaction:
      type: object
      properties:
        transactionId:
          type: string
          description: Issuer's transaction id.
          example: TXN8F3A21C0
        cardId:
          type: string
          description: The card's id, from `card/list` or `card/create`.
          example: '2026100117908000004821'
        type:
          type: string
          description: Transaction type.
          enum:
            - PURCHASE
            - REFUND
            - REVERSAL
            - VERIFICATION
            - FEE
          example: PURCHASE
        status:
          type: string
          description: >-
            Status as reported by the issuer, e.g. `PENDING`, `COMPLETED`,
            `FAILED`, `REVERTED`.
          example: COMPLETED
        previousStatus:
          type: string
          description: Only on `transaction.updated` webhooks.
        amount:
          type: string
          description: Amount in the merchant's currency. Decimal string.
          example: '19.99'
        currency:
          type: string
          description: Merchant currency.
          example: USD
        billAmount:
          type: string
          description: Amount charged to the card. Decimal string.
          example: '19.99'
        billCurrency:
          type: string
          description: Card currency.
          example: USD
        fee:
          type: string
          description: Fees on this transaction, USD (incl. cross-border). Decimal string.
          example: '0'
        merchant:
          type: object
          properties:
            name:
              type:
                - string
                - 'null'
              description: ''
              example: OPENAI *CHATGPT SUBSCR
            country:
              type:
                - string
                - 'null'
              description: ''
              example: US
            mcc:
              type:
                - string
                - 'null'
              description: Merchant category code.
              example: '5734'
        description:
          type:
            - string
            - 'null'
          description: ''
        transactionTime:
          type: string
          description: ISO 8601, UTC.
          format: date-time
          example: '2026-10-03T14:12:09Z'
      required:
        - transactionId
        - cardId
        - type
        - status
        - amount
        - currency
        - billAmount
        - billCurrency
        - fee
        - merchant
        - description
        - transactionTime
    Error:
      type: object
      properties:
        code:
          type: integer
          description: Non-zero error code. See [Errors](/api-reference/errors).
          example: 4011
        message:
          type: string
          description: Human-readable reason.
          example: >-
            This card can't be topped up through the API. Use the dashboard for
            this card.
        data:
          type: object
          description: >-
            Present only when the error carries something you need, e.g.
            `withdrawalId` on a `9999` from `card/withdraw`.
          additionalProperties: true
      required:
        - code
        - message
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Create keys in the dashboard under **Settings → API keys**. Production
        keys start with `smk_live_`.

````

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