A payment-first API starts with the charge. You send an amount, and the API tells you whether the money moved. What was sold, what it cost after the discount, and what a refund should return stay in your code and your database.
An order-first API starts with the sale. You send the line items, the API computes the total, and every payment, refund, and webhook points back to one order.
Flint is an order-first API that runs on Stripe's card processing, so Stripe moves the money either way. What changes is how much payment code you write and keep correct.
At a glance#
| Payment-first (Stripe) | Order-first (Flint) | |
|---|---|---|
| First thing you create | Payment-first (Stripe)A payment or a Checkout Session | Order-first (Flint)An order with line items |
| Total computed by | Payment-first (Stripe)Your code, or Checkout | Order-first (Flint)Flint, after discounts and tax |
| Paid signal | Payment-first (Stripe)Two Checkout Session events | Order-first (Flint)One event, order.paid |
| Getting the line items | Payment-first (Stripe)A second API call | Order-first (Flint)Already in the event |
| Refund one item | Payment-first (Stripe)An amount you work out | Order-first (Flint)A line item and a quantity |
Every Stripe entry comes from Stripe's documentation; the sources are at the end.
One order.paid handler covers every way to pay#
On a payment-first API, the paid signal depends on how the buyer paid. Stripe's fulfillment guide has you handle checkout.session.completed, add checkout.session.async_payment_succeeded for bank payments that settle later, and retrieve the Checkout Session with its line items before you fulfill.
On Flint, order.paid fires when the order is paid in full, whatever paid it: hosted checkout, a payment link, your own payment form, or an invoice. A bank debit that settles days later sends the same event when the money arrives. The event carries the order, with its line items, totals, and payment state:
// event is the delivery after you verify its signature
if (event.event_type === "order.paid") {
await fulfillOnce(event.data.object.order_id);
}
Add an invoice flow or a payment link later, and this handler already covers it. Webhooks has the signature check and the retry schedule.
Flint does the money math#
You send the line items, discounts, and tax settings. Flint computes the subtotal, each discount, the tax on each line, and the total, and every way of collecting reads that one total from the order. A hosted page and an invoice for the same order can't show different numbers.
When the buyer pays in your own form, send the balance they saw as expected_outstanding_money. If the balance changed after they saw it, Flint refuses the payment instead of charging a different amount.
A refund names the item that came back#
A payment-first refund is an amount. Stripe's refund API takes a charge or PaymentIntent and an optional amount, so refunding one item from a discounted, taxed order means your code works out that item's share.
On Flint, name the line item and the quantity:
curl -X POST https://api.withflintpay.com/v1/refunds \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: refund-ord-1042-mug" \
-d '{
"refund_type": "targets",
"order_id": "ord_1kmn0aExample",
"reason": "customer_changed_mind",
"line_items": [
{"order_line_item_id": "li_1kmn0aExample", "quantity": 1}
]
}'
Flint refunds that unit at the price the buyer paid, including its share of the discount and tax. Flint refuses a refund for more than is left on the line, so the same item can't be refunded twice. Refunds covers amount refunds, restocking fees, and store credit.
A declined card doesn't lose the sale#
An order you create stays open when a card is declined or its checkout session expires. Open a new session, pay it from your own form, or send an invoice for the same order, and the line items and balance carry over.
Two flows can't charge the same balance#
An order has one owner for collection at a time. While a checkout session is open, a second session or an invoice for the same order is refused, so a buyer can't pay the same balance on two pages.
Support and accounting start from one ID#
The order lists its payments, checkout sessions, and refunds. A refund names its order_id, a dispute carries the order_id of the sale it contests, and the balance transactions in a payout carry the order_id behind each payment and refund. "What did this customer buy, and where did the money go?" starts from one ID. Reconciliation has the queries.
The next feature is an API call#
Each subscription renewal is an order, so a renewal is refunded and reported like any other sale. A coupon is a promotion on the order, and paying later is an invoice for the same order. None of them adds money math to your code.
Start with one call#
You don't have to build a cart to start. A checkout session with type: "quick_pay" takes a name and an amount, and Flint creates a one-line order and returns its order_id:
curl -X POST https://api.withflintpay.com/v1/checkout-sessions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: checkout-sitting-fee-042" \
-d '{
"type": "quick_pay",
"quick_pay_item": {
"name": "Portrait sitting fee",
"amount_money": {"amount": 12500, "currency": "USD"}
},
"redirects": {"success_url": "https://example.com/booked"}
}'
Send the buyer to the returned url and fulfill on order.paid. A payment link does the same from one URL you share with every buyer. When your own system already records the sale, POST /v1/payment-intents moves one amount with no order, on the same account and keys.
If an AI agent writes your integration#
An agent building on an order-first API writes API calls, not money math. There are no totals to compute and no refund arithmetic to get wrong. Add Flint's docs MCP server, and the agent reads the current API as it builds:
claude mcp add --transport http flint-docs https://developers.withflintpay.com/mcp
Build with AI agents covers Claude Code, Codex, and Cursor.
FAQ#
What is an order-first payment API?#
A payment API where you create the order first and payments settle against it. The order holds the line items, discounts, tax, and balance, and checkouts, invoices, refunds, and webhooks all reference it. Flint is an order-first payment API that runs on Stripe's processing.
What is a payment-first API?#
A payment API whose central object is a request to move money: an amount, a currency, and a payment method. It records whether the money moved, and your own database records what was sold. Stripe's PaymentIntents work this way.
Is an order-first API more work to start?#
No. A quick pay checkout session or a payment link creates the order from a name and an amount in one call. You add line items, discounts, and tax when you need them.
Does Flint use Stripe?#
Yes. Stripe processes every card payment on Flint, and card details go from the buyer's browser to Stripe, so neither your server nor Flint sees card numbers.
Can I take a payment without an order?#
Yes. POST /v1/payment-intents with an amount creates a standalone payment that you collect with Stripe Elements on your own page.
Sources#
Everything attributed to Stripe above comes from its documentation, checked on 2026-11-30.
- Fulfill orders: the
checkout.session.completedandcheckout.session.async_payment_succeededevents, and the fulfillment function's steps: retrieve the session withline_itemsexpanded, checkpayment_status, fulfill, and record the fulfillment status. - Create a refund: a refund specifies a Charge or a PaymentIntent, with an optional
amount; no parameter names a line item. - Create a PaymentIntent: the example request sends an
amountand acurrency.
Build it#
Why Flint is orders-firstAccept your first paymentWebhooksRefundsSign up for a sandbox. Flint's sandbox is free and needs no credit card. Create an order, pay it with test card 4242 4242 4242 4242, and watch order.paid arrive. Stripe vs order-first payment APIs follows one order through both models with code, and Payment API vs commerce API covers plans, seats, and upgrades.