Headless commerce API

Eight commerce services. One API. Zero glue code.

Most teams stitch together a payment gateway, an order database, a tax calculator, a coupon engine, an inventory tracker, and a billing cron job. Then they spend months keeping them in sync. Flint gives you all of it as a single, consistent API where the order is the source of truth.

No credit cardFree sandbox forever5 min to first order
Without Flint
Stripe API
Order DB
Tax Service
Coupon Engine
Inventory DB
Billing Cron
Reconciliation

Seven services. Your code holds them together.

With Flint Pay
flint.orders.create()

Orders, payments, tax, inventory, coupons, subscriptions. One API.

The problem

The commerce stack you're building today

You start with Stripe for payments. Then you need an order table, so you build one. Tax? That's Avalara or a tax API. Coupons need validation logic, expiry rules, and stacking policy. Inventory counts live in Redis or a separate table with their own locking. Subscriptions mean cron jobs and a state machine you pray never drifts.

A single refund now touches four systems: reverse the charge, recalculate tax, update the order total, restore inventory. If one step fails, your data is inconsistent. If two concurrent refunds race, you get double credits.

The "simple" refund is a distributed transaction across services that were never designed to coordinate. Every new feature touches every system. Every edge case is a new failure mode.

Flint collapses all of this into one API. The order is the coordination point. State is never split across systems. Computations are never duplicated. And every mutation is atomic.

Full ecommerce flow

From catalog to checkout in four API calls

Create items, build an order, apply a discount, and collect payment. Every step is a single SDK call. Totals, tax, and inventory are handled automatically.

1Create items in your catalog
create-items.ts
const coffee = await flint.items.create({
name: "Organic Coffee Beans",
type: "ITEM_TYPE_PRODUCT",
unitPriceMoney: { amount: 1999, currency: "USD" },
sku: "COFFEE-ORG-12OZ",
inventoryCount: 500,
});
const mug = await flint.items.create({
name: "Ceramic Pour-Over Mug",
type: "ITEM_TYPE_PRODUCT",
unitPriceMoney: { amount: 2400, currency: "USD" },
sku: "MUG-POUROVER-WHT",
inventoryCount: 120,
});
2Create an order with line items
create-order.ts
const order = await flint.orders.create({
customerId: "cus_01HZ4X8",
lineItems: [
{
itemId: coffee.id,
name: "Organic Coffee Beans",
quantity: 2,
unitPriceMoney: { amount: 1999, currency: "USD" },
},
{
itemId: mug.id,
name: "Ceramic Pour-Over Mug",
quantity: 1,
unitPriceMoney: { amount: 2400, currency: "USD" },
},
],
});
// order.netAmounts.subtotalMoney → { amount: 6398 }
// order.netAmounts.taxMoney → computed
// order.netAmounts.balanceMoney → computed
3Apply a coupon
apply-coupon.ts
await flint.orders.applyCoupon(order.orderId, {
couponCode: "SPRING20",
});
// 20% off applied to all line items.
// Subtotal, tax, and balance recalculated.
// Discount tracked in order.appliedDiscounts.
4Pay the order
pay-order.ts
const result = await flint.orders.pay(order.orderId, {
paymentSourceTokens: ["tok_visa"],
buyerEmail: "sarah@example.com",
});
// Payment amount derived from order balance.
// Inventory decremented automatically.
// Order status → PAID.

What's included

Eight services. One API key.

Everything you need to sell online - from catalog management to recurring billing - accessible through a single, consistent API. No microservice sprawl, no integration middleware.

Orders

The single source of truth

Create orders with structured line items, quantities, and prices. Totals, tax, discounts, and balance are computed on every response. Status follows a deterministic lifecycle.

Items & Inventory

Catalog and stock in one place

Create items with SKUs, prices, images, and inventory counts. Adjust stock with positive or negative deltas. Inventory is tracked per-item with full audit history.

Coupons

Discounts without a separate engine

Percentage or fixed-amount coupons with usage limits, expiration dates, and stacking rules. Apply to an order and totals recalculate instantly. No third-party discount service.

Payments

Derived from the order

Payment intents are created from orders. Amount, currency, and customer are derived automatically. Stripe handles card processing. No amount mismatch risk.

Subscriptions

Recurring billing, built in

Create subscription plans with billing intervals and line items. Subscriptions auto-generate orders on each cycle. Pause, resume, or cancel with a single API call.

Checkout

Hosted or headless

Generate checkout sessions with pre-built hosted pages, or go fully headless with your own UI. Payment links for one-off sales, donations, and events.

Customers

Profiles tied to everything

Create and manage customer profiles. Orders, payment methods, and subscriptions are linked automatically. Query order history by customer in a single call.

Refunds

Issue and forget

Refund by amount with idempotency keys. The order balance recalculates, tax adjusts proportionally, and the status transitions automatically. One call.

Server-side math

Computed fields mean you never calculate totals

Every order response includes a netAmounts object with computed subtotal, tax, discount, tip, total, paid, refunded, and balance fields. These are recalculated server-side on every mutation - you never derive them yourself.

Add a line item and the subtotal updates. Apply a coupon and the discount, tax, and total all recalculate. Issue a refund and the balance adjusts while tax corrects proportionally.

This matters most at the edges. When a partial refund changes the tax basis, when a coupon applies after tax has already been computed, when a tip is added to a discounted order - these are the cases that produce off-by-one bugs in client-side calculation. With Flint, the server handles all of it.

order-response.json
{
"netAmounts": {
"subtotalMoney": { "amount": 6398, "currency": "USD" },
"discountMoney": { "amount": 1280, "currency": "USD" },
"taxMoney": { "amount": 460, "currency": "USD" },
"tipMoney": { "amount": 0, "currency": "USD" },
"totalMoney": { "amount": 5578, "currency": "USD" },
"paidMoney": { "amount": 5578, "currency": "USD" },
"refundedMoney": { "amount": 0, "currency": "USD" },
"balanceMoney": { "amount": 0, "currency": "USD" }
}
}
// Every field is computed server-side.
// Mutation → recalculation → response.
// No stale data. No client math.

Lifecycle

Deterministic order status machine

Every order follows a predictable lifecycle. Transitions are enforced server-side - no ambiguous states, no manual bookkeeping.

OPENPAIDPARTIALLY_REFUNDEDREFUNDED
or
PAIDCLOSED
OPENOrder is mutable. Add line items, apply coupons, add tips. All amounts recompute on every change.
PAIDPayment captured. Inventory decremented. Only refunds and metadata updates are allowed.
PARTIALLY_REFUNDEDSome amount refunded. Balance, tax, and totals recalculated. Further refunds still allowed.
REFUNDEDFully refunded. Balance is zero. No further mutations allowed.
CLOSEDSettled and archived. Terminal state for completed transactions.

Comparison

Flint vs. building it yourself

What you get from one API versus what you build and maintain across multiple services.

CapabilityDIY stackFlint Pay
Order management
Line items, quantities, prices
Build from scratch
Built-in order object
Payment processing
Charge cards, handle failures
Stripe + custom amount logic
Amount derived from order
Tax calculation
Compute per-item tax breakdown
Avalara, TaxJar, or custom
Built-in, per line item
Discounts & coupons
Apply, stack, enforce limits
Build from scratch
Built-in with stacking rules
Inventory tracking
Stock counts, audit history
Redis or DB + cron
Atomic per-item tracking
Subscription billing
Plans, trials, retries, pausing
Cron jobs + state machine
Auto-billing with lifecycle
Refund handling
Refund, recalculate tax, update status
Multi-step across systems
One call, auto-reconciled
Customer profiles
Link orders, methods, history
Build from scratch
Built-in, auto-linked

Get started

Replace your commerce stack with one API.

Orders, payments, inventory, coupons, subscriptions, and refunds - all from a single API with computed fields, atomic mutations, and a deterministic lifecycle. Free to start.

No credit card requiredFree sandbox foreverProduction ready in minutes
quickstart.ts
const order = await flint.orders.create({
lineItems: [{
name: "Organic Coffee Beans",
quantity: 2,
unitPriceMoney: { amount: 1999, currency: "USD" },
}],
});
await flint.orders.pay({
orderId: order.id,
paymentSourceTokens: ["tok_visa"],
});
// Order paid. Inventory decremented.
// Tax computed. Status → PAID.