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

# Create Order

> Creates an onramp order to buy tokens with a card. The order returns a payment intent that the buyer completes to receive tokens in the specified wallet.



## OpenAPI

````yaml api-reference/_open-api/OnrampAPIs.json POST /2022-06-09/orders
openapi: 3.0.1
info:
  description: |
    N/A
  version: 1.0.0
  title: Onramp
  contact:
    name: Crossmint Onramp APIs
    url: https://www.crossmint.com
    email: support@crossmint.com
servers:
  - url: https://staging.crossmint.com/api
    description: Staging environment (testnets)
  - url: https://www.crossmint.com/api
    description: Production environment (mainnets)
security: []
tags:
  - name: Onramp
    description: APIs to buy tokens with a card (onramp)
paths:
  /2022-06-09/orders:
    post:
      tags:
        - Onramp
      summary: Create Order
      description: >
        Creates an onramp order to buy tokens with a card. The order returns a
        payment intent that the buyer completes to receive tokens in the
        specified wallet.


        **API scope required**: `orders.create`
      operationId: create-onramp-order
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - payment
                - lineItems
              properties:
                recipient:
                  $ref: '#/components/schemas/Recipient'
                payment:
                  $ref: '#/components/schemas/Payment'
                lineItems:
                  $ref: '#/components/schemas/LineItems'
                state:
                  type: string
                  enum:
                    - draft
                    - create
                  default: create
                  description: >-
                    Determines whether an order is officially created or whether
                    it simply returns what an order would look like. Use `draft`
                    to review the quote prior to committing. Draft orders are
                    not persisted and will not be queryable via APIs. Use
                    `create` (default) to place the order and proceed to
                    payment.
      responses:
        '201':
          description: Order successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrderResponse'
        '400':
          description: >-
            Invalid arguments. Make sure you are following the API
            specification.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400Response'
        '403':
          description: Forbidden error. Ensure the credentials are correct.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/403Response'
        '404':
          description: Not found error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/404Response'
        '503':
          description: >-
            Try again in a few minutes. If the issue still persists, contact
            Crossmint support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/503Response'
        '524':
          description: A timeout occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/524Response'
      security:
        - apiKey: []
components:
  schemas:
    Recipient:
      description: >-
        Recipient of the tokens being purchased. Provide either `walletAddress`
        or `email`, not both. When an `email` is provided, Crossmint creates a
        custodial wallet for the user that they can later log in to.
      oneOf:
        - type: object
          title: Wallet
          additionalProperties: false
          properties:
            walletAddress:
              type: string
              description: >-
                The wallet address that will receive the tokens. Ensure the
                address is valid for the chain of the token being purchased.
          required:
            - walletAddress
        - type: object
          title: Email
          additionalProperties: false
          properties:
            email:
              type: string
              format: email
              description: >-
                Email of the recipient. Crossmint creates a custodial wallet for
                this user on the fly, that they can later log in to.
          required:
            - email
    Payment:
      type: object
      additionalProperties: false
      title: Card
      description: >-
        Payment configuration for the onramp order. Onramp is completed with a
        card.
      properties:
        method:
          type: string
          enum:
            - card
          description: Payment method. Onramp orders are paid with a card.
        receiptEmail:
          type: string
          format: email
          description: >-
            Email used by Crossmint to determine whether KYC is required for the
            order and to send the receipt. Required for compliance reasons.
      required:
        - method
        - receiptEmail
    LineItems:
      type: array
      description: >-
        The tokens to purchase. Provide a single line item identifying the token
        and the amount to spend.
      minItems: 1
      maxItems: 1
      items:
        type: object
        additionalProperties: false
        properties:
          tokenLocator:
            type: string
            description: >-
              The token to purchase, as a `<chain>:<address>` locator. Use the
              USDC locator for the supported chain and environment. Staging
              locators only work against `https://staging.crossmint.com`;
              production locators only work against `https://www.crossmint.com`.


              | Chain | Environment | USDC token locator |

              | --- | --- | --- |

              | Solana | Staging (devnet) |
              `solana:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU` |

              | Base | Staging (sepolia) |
              `base-sepolia:0x036CbD53842c5426634e7929541eC2318f3dCF7e` |

              | Polygon | Staging (amoy) |
              `polygon-amoy:0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582` |

              | Stellar | Staging (testnet) |
              `stellar:CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA`
              |

              | Solana | Production |
              `solana:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |

              | Base | Production |
              `base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |

              | Polygon | Production |
              `polygon:0x3c499c542cef5e3811e1192ce70d8cc03d5c3359` |

              | Stellar | Production |
              `stellar:CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75`
              |
          executionParameters:
            type: object
            additionalProperties: false
            description: Parameters controlling how the token purchase is executed.
            properties:
              mode:
                type: string
                enum:
                  - exact-in
                  - exact-out
                description: >-
                  Execution mode. Use `exact-in` to spend an exact fiat amount
                  and receive the resulting tokens, or `exact-out` to receive an
                  exact token amount and pay the resulting fiat cost.
              amount:
                type: string
                description: >-
                  The amount as a decimal string. For `exact-in` this is the
                  fiat amount to spend; for `exact-out` this is the token amount
                  to receive.
              maxSlippageBps:
                type: string
                description: >-
                  Optional slippage tolerance in basis points (e.g., '500' for
                  5%). If not provided, default slippage will be applied.
            required:
              - mode
              - amount
        required:
          - tokenLocator
          - executionParameters
    CreateOrderResponse:
      type: object
      properties:
        clientSecret:
          type: string
          description: >-
            A token exclusively scoped to a particular order, allowing for the
            reading or updating of that order.
          example: _removed_
        order:
          $ref: '#/components/schemas/OrderObject'
    400Response:
      type: object
      properties:
        error:
          type: boolean
          example: true
        message:
          type: string
          description: Human-readable error message describing what went wrong
        code:
          type: string
          description: Machine-readable error code for programmatic handling
    403Response:
      type: object
      properties:
        error:
          type: boolean
          example: true
        message:
          type: string
          example: Malformed API key. / API key provided doesn't have required scopes.
    404Response:
      type: object
      properties:
        error:
          type: boolean
          example: true
        message:
          type: string
          example: Not found
    503Response:
      type: object
      properties:
        error:
          type: boolean
          example: true
        message:
          type: string
          example: >-
            Please try again in a few minutes. If the issue still persists,
            contact Crossmint support.
    524Response:
      type: object
      properties:
        error:
          type: boolean
          example: true
        message:
          type: string
          example: A timeout occurred.
    OrderObject:
      type: object
      properties:
        orderId:
          type: string
          example: b2959ca5-65e4-466a-bd26-1bd05cb4f837
        phase:
          type: string
          enum:
            - quote
            - payment
            - delivery
            - completed
          description: The current phase of the order lifecycle.
          example: payment
        lineItems:
          type: array
          items:
            type: object
            properties:
              chain:
                type: string
                example: solana
              metadata:
                type: object
                properties:
                  name:
                    type: string
                    example: USDC
                  description:
                    type: string
                    example: USDC Token
                  imageUrl:
                    type: string
                    example: https://cryptologos.cc/logos/usd-coin-usdc-logo.svg
              quote:
                type: object
                properties:
                  status:
                    type: string
                    example: valid
                  charges:
                    type: object
                    properties:
                      unit:
                        type: object
                        properties:
                          amount:
                            type: string
                            example: '1.47'
                          currency:
                            type: string
                            example: usd
                  totalPrice:
                    type: object
                    properties:
                      amount:
                        type: string
                        example: '5'
                      currency:
                        type: string
                        example: usd
              executionMode:
                type: string
                example: exact-in
              executionParams:
                type: object
                properties:
                  mode:
                    type: string
                    example: exact-in
                  amount:
                    type: string
                    example: '5'
        quote:
          type: object
          properties:
            status:
              type: string
              enum:
                - valid
                - expired
                - requires-recipient
                - all-line-items-unavailable
              example: valid
            quotedAt:
              type: string
              example: '2025-03-07T23:04:11.996Z'
            expiresAt:
              type: string
              example: '2025-03-07T23:14:11.996Z'
            totalPrice:
              type: object
              properties:
                amount:
                  type: string
                  example: '5'
                currency:
                  type: string
                  example: usd
        payment:
          type: object
          properties:
            status:
              type: string
              enum:
                - requires-quote
                - requires-email
                - requires-recipient-verification
                - requires-kyc
                - manual-kyc
                - failed-kyc
                - pending-kyc-review
                - awaiting-payment
                - in-progress
                - completed
              description: >-
                Status of the payment, used to determine the next action in the
                onramp flow. `requires-recipient-verification` applies to
                external wallet recipients that must prove ownership.
                `requires-kyc`, `manual-kyc`, `failed-kyc`, and
                `pending-kyc-review` cover the identity verification step.
                `awaiting-payment` means the buyer can complete the card
                payment. `in-progress` and `completed` track fulfillment.
              example: requires-kyc
            method:
              type: string
              example: card
            currency:
              type: string
              example: usd
            preparation:
              type: object
              properties:
                kyc:
                  type: object
                  properties:
                    provider:
                      type: string
                      enum:
                        - persona
                      example: persona
                    inquiryId:
                      type: string
                      description: >-
                        The identity verification inquiry identifier used to
                        resume or complete KYC with the provider.
                      example: inq_example-inquiry-id
                    sessionToken:
                      type: string
                      description: >-
                        Optional session token used to continue the identity
                        verification inquiry.
                    environmentId:
                      type: string
                      nullable: true
                      description: The provider environment identifier for the inquiry.
  securitySchemes:
    apiKey:
      type: apiKey
      name: X-API-KEY
      in: header

````