Skip to content

Why Flint is orders-first

In Flint, the order is the record of a sale: what was sold, which discounts applied, what it costs, and how much has been paid and refunded. You create the order, and every way of collecting money pays it. A checkout session, a payment in your own form, and an invoice are different ways for the buyer to pay the same order, so refunds, webhooks, reports, and support all start from one order_id.

A charge-first API asks only for an amount and a card. What the amount was for stays in your database, and the charge ID is the only link back to it. With Flint, you send the line items and let Flint compute the total, and you read payment state from the order instead of reconciling it yourself.

The decision is about who keeps the record. If Flint should record the sale, create an order. If your own system already records it and you only need money moved, use a standalone payment intent.

An order's settlement_amounts.net_collected_money is paid_money - refunded_money - dispute_lost_money, which can be negative when refunds and lost disputes exceed payments. A lost dispute does not reopen outstanding_money. See Read dispute state on an order.

What each object records#

ObjectWhat it recordsHow long it livesReference
OrderWhat was sold, what it costs, and what has been paid or refundedPermanent. open while it accepts changes and payments, closed once it is paid or closedOrders API
Checkout sessionOne buyer's hosted or headless payment page for an orderUntil it is paid, closed, replaced, or expiresCheckout Sessions API
Payment intentOne payment from a buyer, and whether it succeeded. It pays an order, or stands alone with no orderOne paymentPayments API
InvoiceWho owes the order's balance, by when, and how much is still dueUntil it is paid or voidedInvoices API
Payment linkA public URL that starts a new sale for each buyerUntil you deactivate itPayment Links API

A payment link is the one object that doesn't pay an existing order. Each buyer who opens it gets a new order of their own.

Create the order#

Send the line items, any discounts, and the metadata you want back later. Amounts are integers in the currency's minor unit, so 24000 is $240.00. external_reference_id holds your own ID for the sale, and GET /v1/orders filters on it.

<!-- docs-test {"scenario":"main","status":201} -->

cURL
curl -X POST https://api.withflintpay.com/v1/orders \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-print-7781" \
  -d '{
    "external_reference_id": "studio-sale-7781",
    "line_items": [{
      "type": "custom",
      "name": "Framed print, 24 x 36",
      "quantity": 1,
      "unit_price_money": {"amount": 24000, "currency": "USD"},
      "fulfillment": {"requirement": "none"}
    }],
    "discounts": [{
      "manual": {
        "name": "Newsletter subscriber",
        "amount_money": {"amount": 2000, "currency": "USD"}
      }
    }],
    "metadata": {"channel": "studio-newsletter"}
  }'
Response
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "status": "open",
    "payment_status": "unpaid",
    "refund_status": "none",
    "origin": "api",
    "version": 1,
    "external_reference_id": "studio-sale-7781",
    "line_items": [...],
    "discounts": [...],
    "pricing_amounts": {
      "subtotal_money": {"amount": 24000, "currency": "USD"},
      "discount_money": {"amount": 2000, "currency": "USD"},
      "charge_money": {"amount": 0, "currency": "USD"},
      "additive_tax_money": {"amount": 0, "currency": "USD"},
      "inclusive_tax_money": {"amount": 0, "currency": "USD"},
      "tax_money": {"amount": 0, "currency": "USD"},
      "requested_tip_money": {"amount": 0, "currency": "USD"},
      "total_money": {"amount": 22000, "currency": "USD"}
    },
    "settlement_amounts": {
      "paid_money": {"amount": 0, "currency": "USD"},
      "refunded_money": {"amount": 0, "currency": "USD"},
      "disputed_money": {"amount": 0, "currency": "USD"},
      "dispute_lost_money": {"amount": 0, "currency": "USD"},
      "net_collected_money": {"amount": 0, "currency": "USD"},
      "written_off_money": {"amount": 0, "currency": "USD"},
      "overpaid_money": {"amount": 0, "currency": "USD"},
      "settled_tip_money": {"amount": 0, "currency": "USD"},
      "outstanding_money": {"amount": 22000, "currency": "USD"}
    },
    "checkout_session_ids": [],
    "payment_intent_ids": [],
    "refund_ids": [],
    "metadata": {"channel": "studio-newsletter"}
  },
  "request_id": "req_..."
}

A custom line needs fulfillment. {"requirement": "none"} means nothing ships, which suits services and digital goods. Catalog lines (type: "variant" or "bundle") take their delivery settings from the catalog instead, and Delivery options covers lines that ship.

The response answers two questions separately:

  • pricing_amounts is the price. total_money is subtotal_money - discount_money + charge_money + additive_tax_money + requested_tip_money, never below zero. inclusive_tax_money is already inside the prices and isn't added again.
  • settlement_amounts is the money. paid_money came in, refunded_money went back out, written_off_money is invoice debt no longer owed, released_money is debt discharged by a successful final capture, removed_money is value order edits took off the order, and outstanding_money is what is still left to collect. Before any payment, outstanding_money equals total_money.

Change it while it is open#

An open order accepts changes, and Flint recomputes the totals after each one. Add line items, discounts, and fees through their own routes under the order. Set the requested tip, tax, metadata, customer, or delivery destination with PATCH /v1/orders/{order_id}.

<!-- docs-test {"scenario":"main","status":200} -->

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/line-items \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-print-7781-hardware" \
  -d '{
    "expected_order_version": 1,
    "line_items": [{
      "type": "custom",
      "name": "Wall mounting hardware",
      "quantity": 1,
      "unit_price_money": {"amount": 1500, "currency": "USD"},
      "fulfillment": {"requirement": "none"}
    }]
  }'
Response
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "status": "open",
    "payment_status": "unpaid",
    "version": 2,
    "pricing_amounts": {
      "subtotal_money": {"amount": 25500, "currency": "USD"},
      "discount_money": {"amount": 2000, "currency": "USD"},
      "charge_money": {"amount": 0, "currency": "USD"},
      "additive_tax_money": {"amount": 0, "currency": "USD"},
      "inclusive_tax_money": {"amount": 0, "currency": "USD"},
      "tax_money": {"amount": 0, "currency": "USD"},
      "requested_tip_money": {"amount": 0, "currency": "USD"},
      "total_money": {"amount": 23500, "currency": "USD"}
    },
    "settlement_amounts": {
      "paid_money": {"amount": 0, "currency": "USD"},
      "outstanding_money": {"amount": 23500, "currency": "USD"}
    }
  },
  "request_id": "req_..."
}

New orders start at version 1 and advance on changes. Existing orders continue from their current version. Versions are concurrency tokens, not Unix timestamps: pass the latest returned version as expected_version, or expected_order_version on child creates. Never derive it from updated_at. The order’s updated_at records wall-clock time, so several changes can share a timestamp.

Send the value you last read as expected_version, and the change fails with 409 VERSION_CONFLICT if someone else changed the order first, so two systems editing one order can't overwrite each other. It is optional on most order writes. Line item and charge creates use expected_order_version for this order fence.

Edits keep an open checkout session open, so a buyer on the hosted page pays the new total. The Orders API lists every change route. Tips and charges covers tips and charges, and Sales tax covers tax.

Collect the balance#

Every path below pays the same order. Pick the one that matches who is paying and when.

PathThe buyer paysYou create
Hosted checkoutNow, on a page Flint hostsA checkout session
Your own payment formNow, in your UI with Stripe ElementsNothing; your backend pays the order, or confirms its payment intent
InvoiceLater, by a due dateAn invoice

Hosted checkout#

Create a checkout session for the order and send the buyer to its url.

<!-- docs-test {"scenario":"main","status":201} -->

cURL
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-print-7781" \
  -d '{
    "type": "order",
    "order_id": "ord_1kmn0aExample",
    "redirects": {
      "success_url": "https://example.com/orders/7781/thanks",
      "cancel_url": "https://example.com/orders/7781"
    }
  }'
Response
{
  "data": {
    "checkout_session_id": "cs_1kmn0aExample",
    "type": "order",
    "surface": "hosted",
    "status": "open",
    "order_id": "ord_1kmn0aExample",
    "expires_at": "2026-10-21T15:00:00Z",
    "url": "https://checkout.withflintpay.com/checkout/cs_1kmn0aExample#checkout_token=..."
  },
  "request_id": "req_..."
}

After payment, Flint sends the buyer to success_url with checkout_session_id and order_id added as query parameters. The redirect doesn't prove payment, so confirm it from the order, as Confirm the outcome shows. In a sandbox, pay with this card:

Test cardAny future expiry, any CVC.

Testing runs this path end to end, and Checkout sessions covers expiry, replacement, and the headless surface.

Your own payment form#

Read the order, pass data.payment_collection.stripe to the browser, and mount Stripe Elements with it. The browser creates a payment method, and your backend pays the order with it. action: "pay" charges the full outstanding balance, so you don't create a payment intent first. You can instead create the order's payment intent with POST /v1/payment-intents and order_id, then confirm it with the same payment_source: Server-confirmed payments shows both requests. Use pay when the order takes several payment methods or gift cards.

<!-- docs-test {"scenario":"main","status":200,"card":"pm_card_visa"} -->

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/pay \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: pay-print-7781-pm_1kmn0aExample" \
  -d '{
  "action": "pay",
  "payment_source": {
    "credential_type": "stripe_payment_method",
    "stripe": {
      "payment_method": "pm_1kmn0aExample"
    }
  },
  "expected_outstanding_money": {
    "amount": 23500,
    "currency": "USD"
  },
  "expected_version": 2
}'
Response
{
  "data": {
    "order": {
      "order_id": "ord_1kmn0aExample",
      "status": "closed",
      "closed_reason": "paid",
      "payment_status": "paid",
      "settlement_amounts": {
        "paid_money": {"amount": 23500, "currency": "USD"},
        "outstanding_money": {"amount": 0, "currency": "USD"}
      }
    },
    "order_payment_attempt": {
      "order_payment_attempt_id": "opat_1kmn0aExample",
      "status": "succeeded",
      "mode": "payment",
      "is_resumable": false,
      "expected_outstanding_money": {"amount": 23500, "currency": "USD"},
      "payment_intents": [{
        "payment_intent_id": "pi_1kmn0aExample",
        "status": "succeeded",
        "amount_money": {"amount": 23500, "currency": "USD"}
      }],
      "pending_actions": [],
      "gift_card_redemptions": []
    }
  },
  "request_id": "req_..."
}

expected_outstanding_money is the balance the buyer approved. If the order changed after the buyer saw it, the payment is refused instead of charging a different amount. Read order_payment_attempt.status rather than the HTTP status: a 3D Secure challenge returns requires_action, and a decline returns failed. Embedded payments with Stripe Elements has the browser code, 3D Secure, retries, and the cases that need a payment intent you create yourself with POST /v1/payment-intents and order_id: split tender, partial payment, and manual capture.

Save the card while they pay#

To keep the card for later charges, set customer_id on the order and add "save_payment_method": true to the same request. Flint saves the card for that customer with usage: "off_session" once the payment is approved, with one bank authentication for both, and sends payment_method.activated. Send it only when the buyer agreed on your page to later charges, and use a ConfirmationToken created with setupFutureUsage: "off_session" or a raw card sent with credential_type: "stripe_payment_method". Your API key needs payments.payment_methods.write. Save a card while the customer pays has the request, the refusals, and how to read the saved card's ID.

Invoice#

When the buyer pays later, create an invoice for the order. With issue in the same request, Flint issues it at once and emails recipient_email a link to the hosted invoice page with the PDF attached. Flint emails reminders on your cadence while a balance remains, and you can record a check or wire against it.

<!-- docs-test {"skip":"Invoice collection is an alternative to the paid-order flow; invoice lifecycle is outside payment-request coverage."} -->

cURL
curl -X POST https://api.withflintpay.com/v1/invoices \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: invoice-print-7781" \
  -d '{
    "type": "order",
    "order_id": "ord_1kmn0aExample",
    "collection": {"mode": "buyer_initiated"},
    "payment_due": {"type": "date", "due_date": "2026-11-30"},
    "recipient_email": "accounts@example.com",
    "memo": "Due within 30 days of delivery.",
    "issue": {"delivery_mode": "email"}
  }'
Response
{
  "data": {
    "invoice_id": "inv_1kmn0aExample",
    "status": "open",
    "order_id": "ord_1kmn0aExample",
    "pricing_amounts": {
      "total_money": {"amount": 23500, "currency": "USD"}
    },
    "settlement_amounts": {
      "outstanding_money": {"amount": 23500, "currency": "USD"}
    },
    "public_url": "https://checkout.withflintpay.com/i/inv_1kmn0aExample#invoice_token=..."
  },
  "request_id": "req_..."
}

The order must be open with nothing paid or refunded. Close any open checkout session and cancel any active payment intent first. From the moment you create the invoice, including as a draft, it owns collection on the order: collect through POST /v1/checkout-sessions with type: invoice and the invoice_id, not an order checkout session or a pay request. Invoicing covers drafts, payment schedules, reminders, partial and manual payments, and voiding.

One collection flow at a time#

An order has one owner for collection at a time, so two flows can never take payment for the same balance. A second flow is refused until you end the first:

  • HTTP 409
    On POST /v1/checkout-sessions, with param order_id: the order already has an open checkout session, returned in details[0].current_resource. Send that session's URL again, or create a replacement with replace_checkout_session_id set to its ID. On POST /v1/invoices: the order already has an invoice that isn't void.
  • HTTP 409
    On invoice create or issue: an open checkout session or an active payment intent still claims the order. Close or cancel what details[0].blocking_resources lists, then retry. On an order checkout session or pay request: an invoice owns the order, so collect through the invoice.
  • HTTP 409
    On invoice create, with details[0].reason payment_collected: the order already has a payment or refund. Bill what is left with a separate quick_pay invoice.

To switch a sale from pay now to pay later, close the open session with POST /v1/checkout-sessions/{checkout_session_id}/close, then create the invoice for the same order_id. The line items and total carry over, because they never left the order.

Confirm the outcome on the order#

However the money arrived, read the result from the order.

<!-- docs-test {"scenario":"main","status":200} -->

cURL
curl https://api.withflintpay.com/v1/orders/ord_1kmn0aExample \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "status": "closed",
    "closed_reason": "paid",
    "closed_at": "2026-10-20T15:04:05Z",
    "payment_status": "paid",
    "refund_status": "none",
    "external_reference_id": "studio-sale-7781",
    "pricing_amounts": {
      "total_money": {"amount": 23500, "currency": "USD"}
    },
    "settlement_amounts": {
      "paid_money": {"amount": 23500, "currency": "USD"},
      "refunded_money": {"amount": 0, "currency": "USD"},
      "disputed_money": {"amount": 0, "currency": "USD"},
      "dispute_lost_money": {"amount": 0, "currency": "USD"},
      "net_collected_money": {"amount": 23500, "currency": "USD"},
      "written_off_money": {"amount": 0, "currency": "USD"},
      "outstanding_money": {"amount": 0, "currency": "USD"}
    },
    "checkout_session_ids": ["cs_1kmn0aExample"],
    "payment_intent_ids": ["pi_1kmn0aExample"],
    "refund_ids": [],
    "metadata": {"channel": "studio-newsletter"}
  },
  "request_id": "req_..."
}

Fulfill when payment_status is paid:

payment_status on order
  • unpaid
    Nothing has been collected. outstanding_money equals total_money.
  • partially_paid
    Part of the total is collected, and the order stays open for the rest. This happens with split tender, a partial invoice payment, or a payment schedule.
  • paid
    Collection is complete and the order is closed. An invoice write-off also completes collection; written_off_money holds the amount that was never received.

Check payment_status, not status. An order can also close without payment, and closed_reason says why: closed_by_merchant when you close it, or checkout_expired for an unpaid payment link or shop order. refund_status is a separate field, so a refunded order still reads paid, with the refunded amount in refunded_money. Statuses and supported actions has every value.

checkout_session_ids, payment_intent_ids, and refund_ids list every checkout session, payment intent, and refund on the order, whichever path took the payment.

Order webhooks carry the order, so one handler serves hosted checkout, your own form, and invoices alike:

  • order.paid
    The order is fully collected. Fulfill from here, after you check dispute_status.
  • order.partially_paid
    The order first became partially paid. A balance remains.
  • order.closed
    The order closed. Read closed_reason before acting, because a closed order isn't necessarily paid.
  • order.refunded
    Everything collected was refunded.

Webhooks covers signatures, retries, and ordering.

What the order gives you#

One total, computed once. The price lives on the order and nowhere else. Every collection path reads it from there, so a hosted page and an invoice for the same order can't show different numbers.

A failed or abandoned attempt doesn't lose the sale. A buyer leaves the hosted page, a card is declined, or a customer asks to be invoiced after the order was built. An order you created stays open when its checkout session expires. Create a new session, pay it from your form, or invoice it, and the line items and balance carry over.

Payment link and shop orders are the exception, because each one exists only for its buyer. When a payment link or shop checkout expires unpaid, Flint closes its order with closed_reason: "checkout_expired" and sends order.closed, unless something was paid or authorized, an invoice or another flow owns it, or it belongs to a return. The next buyer to open the link or shop gets a new order.

Every refund and payment points back to the sale. A refund names its order_id, the order lists its payment intents and sessions, and GET /v1/orders?external_reference_id=studio-sale-7781 finds the order from your own ID. Refunds and Reconciliation work from these fields.

Shortcuts that still create an order#

You don't always have to call POST /v1/orders first. These paths create the order for you.

Quick pay#

Send a name and an amount in a checkout session with type: "quick_pay". Flint creates a one-line order and returns its order_id with the session.

<!-- docs-test {"scenario":"quick-pay","status":201} -->

cURL
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"}
  }'
Response
{
  "data": {
    "checkout_session_id": "cs_1kmn0aQuickPay",
    "type": "quick_pay",
    "status": "open",
    "order_id": "ord_1kmn0aQuickPay",
    "url": "https://checkout.withflintpay.com/checkout/cs_1kmn0aQuickPay#checkout_token=..."
  },
  "request_id": "req_..."
}

Store the returned order_id: refunds and reports for this payment reference the order, not the session. Invoices have the same shortcut. Send type: "quick_pay" with a quick_pay object on invoice create instead of an order_id.

A payment link is one URL that many buyers can open. Each checkout through it creates its own order with origin: "payment_link" and the link's payment_link_id, and the link's metadata is copied onto every order. GET /v1/orders?payment_link_id=... lists a link's orders. Use a link for a public offer, and an order or invoice when one named customer owes one amount.

Subscriptions#

A subscription bills through orders too. Each renewal creates an order with origin: "subscription" and the subscription_id, so a renewal is refunded and reported like a one-time sale, and GET /v1/orders?subscription_id=... lists them.

When to skip the order#

If your own system already records what was sold and you only need Flint to move money, create a standalone payment intent with an amount and the payment options to offer.

<!-- docs-test {"scenario":"standalone","status":201,"expect":{"data.status":"requires_payment_method"}} -->

cURL
curl -X POST https://api.withflintpay.com/v1/payment-intents \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: pi-balance-topup-311" \
  -d '{
    "amount_money": {"amount": 5000, "currency": "USD"},
    "payment_options": ["card"],
    "external_reference_id": "topup-311"
  }'

A payment intent with no order_id has no line items or totals in Flint, and an invoice can't bill it. Link it to your records with its external_reference_id and metadata. Collect it in your own UI as Server-confirmed payments describes. Flint's hosted pages always collect an order, so for a hosted page use a quick pay checkout session instead, and Flint creates a one-line order for the amount.

You needCreate
Line items, discounts, tax, or tips computed by FlintAn order
A hosted payment page or an invoiceAn order, or a quick pay checkout session or invoice
Refunds by line item, fulfillment, or returnsAn order
One amount moved, with the sale recorded in your systemA standalone payment intent

Common mistakes#

Reading the sale from the checkout session. The session is one attempt to collect, and the success redirect isn't proof of payment. Line items, totals, and payment state belong to the order. Fetch it, or handle order.paid.

Using a payment link for one customer's balance. A link creates a new order for each buyer, so it can't represent an amount a specific customer already owes. Create an order, then a checkout session or an invoice for it. Payment links vs checkout sessions vs invoices walks through the choice.

Computing totals in your own code. Change the order and let Flint recompute. A payment intent with an amount you calculated gives one sale two prices.

Treating the order as a checkout feature. The order matters most after the payment. Refunds, disputes, returns, reports, and support all start from it, whichever path collected the money.

Replace items after payment#

Use an order edit to swap unshipped items on a paid order. Preview with POST /v1/order-edit-previews, then send the same additions and removals to POST /v1/orders/{order_id}/edits, with expected_order_version from the preview and an Idempotency-Key.

Removed value and released charges pay for the added lines first; the rest is refunded. Added lines use catalog, price-list, or customer pricing and the order's tax settings, without reapplying promotions. Only variant, bundle, and custom lines with a delivery requirement can be added. Their units wait for you to fulfill them and do not join the order's delivery selection.

A preview can report amount_due_money. Send it as expected_amount_due_money and set balance_due_behavior: "collect" to create a pending edit, then confirm its payment_intent_id to collect the balance. Fulfill the added items on order_edit.completed. The order stays paid and closed throughout, and cancellation or expiry leaves its items and money unchanged. Without the opt-in, a balance still returns 409 LIMIT_EXCEEDED with reason order_edit_balance_due. The paid-order edit reference covers card payments, authentication, cancellation and expiry.

Next steps#

TestingCreate an order, pay it on hosted checkout with a test card, and verify the result.Embedded payments with Stripe ElementsPay an order from your own form, with 3D Secure, retries, and split tender.InvoicingBill an order's balance with due dates, reminders, and manual payments.Payment links vs checkout sessions vs invoicesWhich collection path fits which sale.

Was this helpful?