docs
Get startedTroubleshootingPaymentsWebhooksAgent paymentsSwop MCPOviIdentity (swop.id)SwivyRPC (preview)API reference

Checkout intents

Create a checkout from a cart, then read it until it's paid.

A checkout intent is one payable checkout: a priced cart, the amount due, and the ways the buyer can pay. Create one per purchase attempt. See Headless checkout for the full guide.

Create a checkout

POSThttps://apps.apiswop.co/api/v5/merchant/checkout-intents

Scope: commerce.checkout

Body

FieldTypeRequiredNotes
itemsarrayYes1 to 60 lines
items[].productIdstringYesA product _id from your store (24 hex characters)
items[].quantityintegerNo1 to 999, default 1
items[].selectedOptionsobjectWhen the product has optionse.g. { "Color": "Black", "Size": "M" }
customerInfoobjectFor physical itemsname, email, phone, address { line1, line2, city, state, postalCode, country }
paymentRailstringNoOmit for crypto only; "buyer_choice" to offer card when eligible
descriptionstringNoDefaults to one built from the items
expiresAtISO 8601NoDefault 24 hours, maximum 30 days

Sending price, amount or unitPrice on any item is rejected with 400. Swop always prices from your catalogue.

curl -X POST https://apps.apiswop.co/api/v5/merchant/checkout-intents \
  -H "Authorization: Bearer $SWOP_MERCHANT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [ { "productId": "66a1b2c3d4e5f6a7b8c9d0e1", "quantity": 1, "selectedOptions": { "Color": "Black" } } ],
    "customerInfo": {
      "name": "Ada Buyer",
      "email": "ada@example.com",
      "address": { "line1": "1 Main St", "city": "Austin", "state": "TX", "postalCode": "78701", "country": "US" }
    },
    "paymentRail": "buyer_choice"
  }'

Response 201

{
  "success": true,
  "data": {
    "intentId": "co_7Hk2mPq9xR4s",
    "status": "active",
    "paymentRail": "crypto",
    "checkoutMode": "online",
    "description": "Swop Classic Card",
    "amount": { "value": 30, "currency": "USDC" },
    "fees": {
      "currency": "USDC",
      "feesPayer": "merchant",
      "subtotalAmount": 30,
      "platformFeeBps": 50,
      "platformFeeAmount": 0.15,
      "royaltyAmount": 0,
      "merchantReceivesAmount": 29.85,
      "totalDueAmount": 30
    },
    "lineItems": [
      {
        "productId": "66a1b2c3d4e5f6a7b8c9d0e1",
        "name": "Swop Classic Card",
        "quantity": 1,
        "unitAmount": 25,
        "totalAmount": 25,
        "requiresShipping": true,
        "shippingAmount": 5,
        "productType": "physical",
        "selectedOptions": { "Color": "Black" }
      }
    ],
    "merchant": { "id": "65f0c1…", "name": "Acme", "wallet": { "address": "…" } },
    "customerInfo": { "name": "Ada Buyer", "email": "ada@example.com", "address": { "line1": "1 Main St", "city": "Austin", "state": "TX", "postalCode": "78701", "country": "US" } },
    "checkoutUrl": "https://www.swopme.app/checkout/co_7Hk2mPq9xR4s",
    "paymentRequest": {
      "rail": "solana_pay",
      "recipient": "…",
      "amount": 30,
      "currency": "USDC",
      "tokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "tokenDecimals": 6,
      "reference": "…",
      "memo": "swop:co_7Hk2mPq9xR4s",
      "url": "solana:…",
      "status": "awaiting_payment",
      "expiresAt": "2026-10-30T18:00:00.000Z"
    },
    "cardOffered": false,
    "marketplaceOrder": null,
    "expiresAt": "2026-10-30T18:00:00.000Z",
    "createdAt": "2026-10-29T18:00:00.000Z",
    "updatedAt": "2026-10-29T18:00:00.000Z"
  }
}

Key fields

FieldTypeMeaning
intentIdstringco_…. Save it with your order.
statusstringSee statuses
paymentRailstringThe rail in use, e.g. crypto
amount.valuenumberTotal due, USDC
fees.totalDueAmountnumberWhat the buyer pays (shipping included)
fees.platformFeeBpsnumber50 = 0.5%
fees.platformFeeAmountnumberThe fee in USDC
fees.merchantReceivesAmountnumberWhat you receive
lineItems[]arrayPriced lines, including shippingAmount and requiresShipping
checkoutUrlstringSwop's hosted page for this checkout
paymentRequestobject | nullThe USDC payment request. null while the buyer is choosing card or crypto.
paymentRequest.urlstringA solana: link. Show as a link and a QR code.
cardOfferedbooleanWhether card can be used for this checkout
marketplaceOrderobject | nullThe order created once paid
expiresAtISO 8601When it stops being payable

Errors

StatusWhen
400A price on an item; bad productId; product unavailable; invalid options; bad paymentRail (paymentRail must be omitted (crypto) or "buyer_choice".); bad expiresAt
400 SHIPPING_DETAILS_REQUIREDPhysical item without name, email or address; see missing
403Key lacks commerce.checkout
404A product that isn't yours

Retrieve a checkout

GEThttps://apps.apiswop.co/api/v5/merchant/checkout-intents/{intentId}

Scope: commerce.read

Returns the same object as create (without cardOffered). Only checkouts that belong to you are found; anything else is 404 (No such checkout.).

curl https://apps.apiswop.co/api/v5/merchant/checkout-intents/co_7Hk2mPq9xR4s \
  -H "Authorization: Bearer $SWOP_MERCHANT_KEY"

Public payment endpoints

These are called without an API key. The unguessable intentId authorises them, so your buyer's browser can call them directly. Base: https://apps.apiswop.co/api/v5/checkout-intents. Rate limit: 20 requests per 15 minutes per client.

MethodPathBodyDoes
POST/{intentId}/select-cryptononeBuyer chose USDC. Read the checkout again for paymentRequest.
POST/{intentId}/card-payment-intentsnoneBuyer chose card. Returns clientSecret and publishableKey for Stripe's Payment Element.
GET/{intentId}/card-paymentCard payment state. Treat transfer_pending, transfer_in_progress or transferred as paid.
POST/{intentId}/card-payment/releasenoneAbandon card so the buyer can switch back to USDC

On this page