> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sleetpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Accept a payment

> Create hosted checkouts, sell in several currencies, seats and pay-what-you-want.

A **checkout** is a hosted payment page for one product. You create it with the API and redirect the buyer to its `url`.

```ts theme={null}
const checkout = await sleetpay.checkouts.create({
  productId: "prod_...",
  customerEmail: "ada@example.com",     // prefill (optional)
  externalCustomerId: user.id,          // your own user id (optional, recommended)
  successUrl: "https://yourapp.com/welcome?checkout={CHECKOUT_ID}",
  metadata: { plan: "pro" },
});
redirect(checkout.url);
```

| Behaviour | Detail |
| - | - |
| Expiry | Sessions expire after 24 hours. Create a fresh one per attempt. |
| After payment | The buyer is sent to `success_url`. `{CHECKOUT_ID}` is replaced with the checkout id; `checkout_id=<id>` is also appended as a query parameter. |
| `metadata` | Up to 20 flat keys. It is copied to the customer, order and subscription and echoed in webhooks. |
| `external_customer_id` | Becomes the customer's `external_id` when the checkout succeeds. Unique per organization and immutable once set. |
| Discount codes | Buyers can enter them on the hosted page unless you pass `allowDiscountCodes: false`. |

> [!WARNING]
>
> **Redirects are not proof of payment**
>
> A buyer can open your `success_url` without paying. Unlock access from the [`order.paid` or `checkout.succeeded` webhook](https://docs.sleetpay.com/guides/webhooks), or by reading [`customers.state`](https://docs.sleetpay.com/guides/customers).

## Prices and currencies

A product can have one price per currency. Pass `currency: "eur"` to sell in a currency the product has a price in; otherwise the first active price is used. Pass `priceId` to be exact.

Amounts are integers in the currency's **minor unit**: cents for USD and EUR, whole units for zero-decimal currencies (`1000` JPY is ¥1,000, `1000` USD is \$10.00). Supported: USD, EUR, GBP, CAD, AUD, CHF, SEK, NOK, DKK, JPY, KRW. The buyer pays exactly the listed amount; nothing is converted.

Prices are tax-inclusive: the buyer pays the listed price minus any discount, and receipts say "Includes VAT". SleetPay remits it.

## Pay what you want

For a pay-what-you-want price, pass `amount` in minor units.

```ts theme={null}
await sleetpay.checkouts.create({ productId, amount: 1500 }); // $15.00
```

## Seats

For a seat-based product the total is `price x seats`. Pass `seats` to preselect a number; the buyer can still change it on the page within the product's minimum and maximum. See [Seats](https://docs.sleetpay.com/guides/seats.md).

## Reusable checkout links

For links you share by email, social posts or a README, not from code, use a **checkout link** (**Dashboard > Checkouts**, or **Products > Copy checkout link**). It looks like `https://buy.sleetpay.com/<org>/<slug>`, **never expires**, and every visit starts a fresh checkout. A link can offer several plans on one page.

A checkout created by the API has its own address, `https://buy.sleetpay.com/sleetpay_cl_<id>`, valid for 24 hours. If a buyer opens it after it expires, SleetPay starts a fresh checkout for the same product, price, seats, discount and success URL instead of showing an error.

## Related

* [`POST /api/v1/checkouts`](https://docs.sleetpay.com/api-reference/introduction)
* [Webhooks](https://docs.sleetpay.com/guides/webhooks.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.