Skip to main content
A checkout is a single pay-for-this session; a checkout link is a reusable, shareable URL that opens one. Both turn your published price variants into money. You can ask Crevio to “send Jane a checkout for the $99 course with the LAUNCH20 code” and the agent builds it through the same API below. For programmatic flows — custom websites, “buy now” buttons, invoicing — you’ll create checkouts directly.

Creating a checkout

POST /checkouts takes one or more line items, each pointing at a price variant by id:
curl -X POST https://api.crevio.co/v1/checkouts \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane@example.com",
    "line_items": [
      { "price_variant": "price_abc123", "quantity": 1 }
    ]
  }'
The response is a checkout ("object": "checkout", id like co_...) with a URL the buyer visits to pay. When they complete it, an order is created.

Checkout fields

FieldTypeNotes
line_itemsarrayEach item is { price_variant (required), quantity }. Add multiple to sell a bundle in one checkout.
emailstringThe buyer’s email. Use this for a brand-new buyer.
customerstringAn existing customer id (cus_...). Use instead of email to attach the purchase to a known customer.
discount_codestringA discount code applied to this checkout. See Discounts.
invoicestringAn invoice id (inv_...) to pay — an alternative to line_items. See below.

Multiple line items

curl -X POST https://api.crevio.co/v1/checkouts \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": "cus_xyz789",
    "discount_code": "LAUNCH20",
    "line_items": [
      { "price_variant": "price_abc123", "quantity": 1 },
      { "price_variant": "price_def456", "quantity": 2 }
    ]
  }'

Paying an invoice

Instead of line items, pass an invoice id to create a checkout that settles that invoice:
curl -X POST https://api.crevio.co/v1/checkouts \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "invoice": "inv_abc123" }'
See Subscriptions & billing for creating and managing invoices.

Worked example: sell to a customer end-to-end

import { Crevio } from "@crevio/sdk";

const crevio = new Crevio({ apiKeyAuth: "YOUR_API_TOKEN" });

// 1. Create (or look up) the customer.
const customer = await crevio.customers.create({
  email: "jane@example.com",
  name: "Jane Doe",
  customer_type: "lead",
});

// 2. Create a checkout for them, applying a launch discount.
const checkout = await crevio.checkouts.create({
  customer: customer.id,
  discount_code: "LAUNCH20",
  line_items: [{ price_variant: "price_abc123", quantity: 1 }],
});

// 3. Send the buyer to the checkout URL to pay.
console.log(checkout.url);
When the buyer pays, listen for the order.paid webhook event to fulfill the purchase. When you want one durable URL to share — in a bio link, an email, a “buy now” button — create a checkout link with POST /checkout_links:
curl -X POST https://api.crevio.co/v1/checkout_links \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Guitar course launch",
    "price_variants": ["price_abc123"],
    "discount": "disc_launch20",
    "allow_discount_codes": true,
    "success_url": "https://example.com/thanks",
    "metadata": { "campaign": "summer-launch" }
  }'
FieldTypeNotes
namestringInternal label for the link.
price_variantsarrayThe price variant ids (price_...) the link sells.
discountstringA discount id (disc_...) applied automatically. See Discounts.
allow_discount_codesboolWhether buyers can enter their own code at checkout.
success_urlstringWhere to send the buyer after a successful purchase.
metadataobjectArbitrary key/values that flow through to the resulting order — handy for attribution.
The response includes an id (cl_...) and the shareable URL. Checkout links support full CRUD — update, list, retrieve, and delete them like any other resource.
Use a checkout for a one-off, often personalized sale (you know the buyer), and a checkout link for an evergreen, shareable offer (anyone can open it).

Next steps

Discounts

Build the promo codes you apply via discount_code and discount.

Subscriptions & billing

Orders, invoices, refunds, and managing recurring revenue after checkout.

Products & pricing

Create the price variants your checkouts and links reference.

Webhooks

React to checkout.created, order.paid, and other events in real time.