Skip to Content

Create Checkout

POST/checkouts

Description

Create a new checkout session for a one-time stablecoin payment. Returns a checkout object containing a checkout_url where you should redirect your customer to complete the payment.

For direct payments, an on_chain_id and X-Signature header are required (see Signed Requests for SDK setup). For two-step payments, no signature is needed at creation time.

⏱️

By default, checkouts expire after 24 hours. You can customize this with the expires_at parameter.

Headers

HeaderDescriptionRequired
AuthorizationBearer token with your API keyyes
Content-Typeapplication/jsonyes
X-SignatureSignature from signDirectPayment(). Required for direct payments only.direct only

Request Body

NameTypeDescriptionRequired
amountnumberPayment amount in the smallest currency unit (e.g., cents for USD).yes
currencystringThree-letter ISO currency code for pricing (e.g., "USD", "EUR"). The customer will pay the equivalent in their chosen stablecoin.yes
descriptionstringDescription of the payment shown to the customer.no
success_urlstringURL to redirect the customer after successful payment.yes
cancel_urlstringURL to redirect the customer if they cancel the checkout.no
customer_emailstringCustomer email for payment receipt.no
metadataobjectCustom key-value pairs to attach to the checkout.no
expires_atstringISO 8601 timestamp for when the checkout should expire.no
payment_methodstringPayment method: "direct" (funds sent directly to your settlement address, requires signed request) or "two_step" (funds held in escrow for capture or refund via signed requests).yes
on_chain_idstringOn-chain payment identifier (32-byte hex) from signDirectPayment(). Required for direct payments.direct only

Example: Direct Payment

import { signDirectPayment } from '@exodus/checkout-signer'
 
const { onChainId, signature } = signDirectPayment(process.env.SIGNING_PRIVATE_KEY)
 
const response = await fetch('https://checkout.exodus.com/checkouts', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer sk_live_xxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json',
    'X-Signature': signature,
  },
  body: JSON.stringify({
    amount: 5000,
    currency: 'USD',
    description: 'Order #12345',
    payment_method: 'direct',
    on_chain_id: onChainId,
    success_url: 'https://yoursite.com/success',
    cancel_url: 'https://yoursite.com/cancel',
  }),
})

Example: Two-Step Payment

const response = await fetch('https://checkout.exodus.com/checkouts', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer sk_live_xxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    amount: 5000,
    currency: 'USD',
    description: 'Order #12345',
    payment_method: 'two_step',
    success_url: 'https://yoursite.com/success',
    cancel_url: 'https://yoursite.com/cancel',
    customer_email: '[email protected]',
    metadata: {
      order_id: '12345',
      product_name: 'Widget',
    },
  }),
});

Response

SUCCESSFUL CHECKOUT CREATION
{
  "id": "chk_1234567890abcdef",
  "object": "checkout",
  "amount": 5000,
  "currency": "USD",
  "description": "Order #12345",
  "payment_method": "two_step",
  "status": "pending",
  "checkout_url": "https://checkout.exodus.com/pay/chk_1234567890abcdef",
  "success_url": "https://yoursite.com/success",
  "cancel_url": "https://yoursite.com/cancel",
  "customer_email": "[email protected]",
  "metadata": {
    "order_id": "12345",
    "product_name": "Widget"
  },
  "expires_at": "2024-01-16T12:00:00Z",
  "created_at": "2024-01-15T12:00:00Z"
}

Error Responses

VALIDATION ERROR
{
  "error": {
    "type": "validation_error",
    "message": "Amount must be greater than 0",
    "param": "amount"
  }
}

Start building

XO

Request Demo

Schedule a call with our team

Select a product
Arrow right

Start building
Grateful

Contact Us

We're here to help