v1

latestOpenAPI 3.0.12026-07-2699111970.1 KB
Headless

Create Order

Creates a new order that can be used to complete a headless checkout.

API scope required: orders.create

post/2022-06-09/orders

Request body

recipientstring

Allowed formats:

<chain>:<address> or

email:<email_address>:<chain> or

userId:<userId>:<chain> or

twitter:<twitter_handle>:<chain>

see here for more info

localestring

Specify the locale for the email content [Default: en-US]

state'draft' | 'create'

Determines whether an order is officially created or whether it simply returns what an order would look like. Use draft to review results prior to committing. Draft orders are not currently persisted and will not be queryable via APIs. Use create (default) to place the order and proceed to payment/fulfillment.

Example request

{
  "recipient": "email:testy@crossmint.com:polygon",
  "locale": "en-US",
  "lineItems": {
    "collectionLocator": "crossmint:<collectionId>"
  }
}

Response

Order successfully created.

clientSecretstring

A token exclusively scoped to a particular order, allowing for the reading or updating of that order.

Example response

{
  "clientSecret": "_removed_",
  "order": {
    "orderId": "b2959ca5-65e4-466a-bd26-1bd05cb4f837",
    "phase": "payment",
    "locale": "en-US",
    "lineItems": [
      {
        "chain": "polygon-amoy",
        "executionMode": "exact-out",
        "quantity": 1,
        "callData": {
          "quantity": 1,
          "ADDITIONAL_PROPERTIES": "Your other mint function arguments"
        },
        "maxSlippageBps": "50",
        "metadata": {
          "name": "Headless Checkout Demo",
          "description": "NFT Description",
          "imageUrl": "https://cdn.io/image.png"
        },
        "quote": {
          "status": "valid",
          "charges": {
            "unit": {
              "amount": "0.0001",
              "currency": "eth"
            },
            "salesTax": {
              "amount": "0.34",
              "currency": "usdc"
            },
            "shipping": {
              "amount": "0",
              "currency": "usdc"
            }
          },
          "totalPrice": {
            "amount": "0.0001",
            "currency": "eth"
          }
        },
        "delivery": {
          "status": "awaiting-payment",
          "recipient": {
            "locator": "email:<email_address>:<chain>",
            "email": "testy@crossmint.com",
            "walletAddress": "0x1234abcd..."
          },
          "txId": "0x2e69f11dae7869b92e3d5eaf4cadd50c48b5c6803d1232815f979d744521ad4c",
          "tokens": [
            {
              "locator": "polygon:0xE04Cf294985282Ddc088E6433c064cfB85eD9EdA:3",
              "contractAddress": "0xE04Cf294985282Ddc088E6433c064cfB85eD9EdA",
              "tokenId": "3",
              "mintHash": "MintHashAbc123",
              "quantity": "1500000",
              "symbol": "USDC",
              "decimals": 6
            }
          ]
        }
      }
    ],
    "quote": {
      "status": "valid",
      "quotedAt": "2024-06-07T16:55:44.653Z",
      "expiresAt": "2024-06-07T17:55:44.653Z",
      "totalPrice": {
        "amount": "0.0001375741",
        "currency": "eth"
      }
    },
    "payment": {
      "status": "awaiting-payment",
      "method": "base-sepolia",
      "currency": "eth",
      "preparation": {
        "chain": "base-sepolia",
        "payerAddress": "0x1234abcd...",
        "serializedTransaction": "0x02f90....."
      },
      "receiptEmail": "user@example.com",
      "received": {
        "amount": "0.50",
        "currency": "usd"
      },
      "refunded": {
        "amount": "0.50",
        "currency": "usd"
      },
      "failureReason": {
        "code": "payment-declined",
        "message": "The payment was declined by the issuer."
      }
    }
  }
}