Building a Custom Checkout with NoPOS API
A practical checkout flow using product catalog, customer lookup, orders, payments, and server-side API-key handling.
The NoPOS developer relations team writes practical guides for building on the NoPOS REST API — from first smoke test to production POS.
A reliable NoPOS checkout starts with the real REST contract. Keep the API key on your server, verify it, then wire catalog, customer, order, and payment flows.
1. Verify the key
curl -s https://nopos.vercel.app/v1/auth/verify \
-H "X-API-Key: $NOPOS_API_KEY"2. Fetch products
const products = await nopos("/products");3. Find or create the customer
Use GET /v1/customers/search when the buyer may already exist. Use POST /v1/customers when your UI needs create-on-the-fly checkout.
4. Create the order
const order = await nopos("/orders", {
method: "POST",
body: JSON.stringify({
customer_id: selectedCustomerId,
items: cart.map((item) => ({
product_id: item.productId,
quantity: item.quantity,
})),
}),
});5. Take payment
const payment = await nopos("/payments", {
method: "POST",
body: JSON.stringify({
order_id: order.id,
amount: order.total,
payment_method: "card",
}),
});Server-side helper
async function nopos(path: string, init: RequestInit = {}) {
const res = await fetch(${NOPOS_BASE_URL}${path}, {
...init,
headers: {
"X-API-Key": process.env.NOPOS_API_KEY!,
"content-type": "application/json",
...init.headers,
},
});
if (!res.ok) {
const body = await res.json().catch(() => ({}));
throw new Error(body.error ?? body.message ?? NOPOS ${res.status});
}
return res.json(); } ```
Build from the current contract
Open the gateway for OpenAPI, Swagger, AGENTS.md, llms.txt, and the first X-API-Key smoke test.