CraftPayDocs
API reference

Checkouts

Start a purchase from your own system. See the Checkout API guide for the whole flow.

Create a checkout

POST/v1/checkouts API key

Returns a url on your store's checkout. Send the buyer there to pay. The link works for 24 hours.

Body (JSON)

NameTypeDescription
itemsarrayRequired. 1–50 packages.
items[].packageIdstringThe package's id.
items[].quantityinteger1–99. Default 1.
playerstringThe buyer's Minecraft name. When set, the buyer can't change it.
emailstringPre-fills the buyer's e-mail (they can change it).
couponstringA discount code from your dashboard. When set, it's applied and locked.
successUrlstringhttps:// address the buyer is sent to after paying. order_id and checkout_id are added to it.
cancelUrlstringhttps:// address the buyer is sent to if they cancel the payment.
metadataobjectUp to 20 of your own text values, e.g. your cart id. Returned as-is.
Request
curl -X POST https://api.craftpay.net/v1/checkouts \
  -H "Authorization: Bearer cp_sk_..." \
  -H "Content-Type: application/json" \
  -d '{ "items": [{ "packageId": "cm3k9x8qw0004", "quantity": 1 }], "player": "Notch", "email": "notch@example.com", "successUrl": "https://myserver.com/thanks", "cancelUrl": "https://myserver.com/shop", "metadata": { "cartId": "42" } }'
Response · 201
{
  "data": {
    "id": "cs_Qm8v2kX4pLr9TzW1nBc7HdYe0aFg",
    "url": "https://mist.craftpay.net/checkout?session=cs_Qm8v2kX4pLr9TzW1nBc7HdYe0aFg",
    "status": "open",
    "orderId": null,
    "items": [{ "packageId": "cm3k9x8qw0004", "quantity": 1 }],
    "player": "Notch",
    "email": "notch@example.com",
    "coupon": null,
    "successUrl": "https://myserver.com/thanks",
    "cancelUrl": "https://myserver.com/shop",
    "metadata": { "cartId": "42" },
    "expiresAt": "2026-11-13T09:41:00.000Z",
    "createdAt": "2026-11-12T09:41:00.000Z"
  }
}

Get a checkout

GET/v1/checkouts/{id} API key

status is open, complete or expired. orderId is set once the order is paid.

Request
curl https://api.craftpay.net/v1/checkouts/cs_Qm8v2kX4pLr9TzW1nBc7HdYe0aFg \
  -H "Authorization: Bearer cp_sk_..."
Response · 200
{
  "data": {
    "id": "cs_Qm8v2kX4pLr9TzW1nBc7HdYe0aFg",
    "status": "complete",
    "orderId": "cm3kb1z7e0009",
    "metadata": { "cartId": "42" },
    …
  }
}

Stuck? Write to mail@craftpay.net