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 keyReturns a url on your store's checkout. Send the buyer there to pay. The link works for 24 hours.
Body (JSON)
| Name | Type | Description |
|---|---|---|
items | array | Required. 1–50 packages. |
items[].packageId | string | The package's id. |
items[].quantity | integer | 1–99. Default 1. |
player | string | The buyer's Minecraft name. When set, the buyer can't change it. |
email | string | Pre-fills the buyer's e-mail (they can change it). |
coupon | string | A discount code from your dashboard. When set, it's applied and locked. |
successUrl | string | https:// address the buyer is sent to after paying. order_id and checkout_id are added to it. |
cancelUrl | string | https:// address the buyer is sent to if they cancel the payment. |
metadata | object | Up 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 keystatus 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