Skip to content

Overview

Flint is a payments API built around the order. You create an order for what the buyer is paying for, collect payment on a Flint-hosted page or in your own UI, and the order keeps the totals, payments, refunds, and fulfillment for that sale in one record. Buyers can pay by card, Apple Pay, Google Pay, Affirm, or ACH debit. The same API sends invoices, bills subscriptions, and handles the refunds, returns, and disputes that follow a sale.

To see a payment go through before reading further, Accept your first payment takes one request and a browser, or pay a test order from your server with curl alone.

Your test API key

Sign in and we'll fill your sandbox test key into every code example automatically.

No account yet? Sign up, or run flint signup.

Test card

Any future expiry, any CVC. Works on every test-mode checkout. See Testing for declines and 3D Secure.

What are you building?#

Choose a guide by goal#

You want toStart withThen
See a payment go throughAccept your first paymentSandboxes & test mode
Add checkout to a Next.js or Express appAccept a payment with Next.jsWebhooks
Sell a course, download, service, or product onceSell with hosted checkoutCatalog setup
Pick how buyers pay: a hosted page, a link, an invoice, or your UIChoose how to collect paymentPayment links vs checkout sessions vs invoices
Charge a plan every month or yearSubscription billingCustomer accounts
Bill a customer with a due dateInvoicingCredit notes
Take payment in an iOS or Android appPayments in mobile appsEmbedded payments
Give money backRefundsDisputes and chargebacks
Let an AI agent build or run your integrationBuild with AI agentsNode.js and PHP SDKs
Move from Stripe or SquareMigrating from Stripe, Migrating from SquareTesting
Go liveGoing liveAPI key security

When you need more#

You want toGuide
Ship goods, or offer pickup or local deliveryAdd shipping to a checkout
Track stock per locationTrack inventory
Collect sales taxSales tax
Offer discounts, promo codes, or gift cardsPromotions, Sell, redeem, and refund gift cards
Take merchandise backYour first return
Build the cart and checkout yourselfBuild your own checkout
Answer a chargebackDisputes and chargebacks
Know what reached your bankPayouts, Reconciliation
Authorize now and capture laterManual capture
Create merchant accounts from your backendAPI & agent onboarding

How a sale works#

A typical hosted sale takes two requests from your server, a buyer on Flint's checkout page, and one webhook back to you:

A sale on Flint-hosted checkoutResponse
Your serverFlintBuyerPOST /v1/orders with the line itemsthe order, unpaid, with its totalsPOST /v1/checkout-sessions for the orderthe session and its urlredirect to urlpays on hosted checkoutredirect to your success_urlorder.paid webhookGET /v1/orders/{order_id} to confirm, then fulfill
  1. Your server sends POST /v1/orders with the line items to Flint
  2. Flint returns the order, unpaid, with its totals to Your server
  3. Your server sends POST /v1/checkout-sessions for the order to Flint
  4. Flint returns the session and its url to Your server
  5. Your server sends redirect to url to Buyer
  6. Buyer sends pays on hosted checkout to Flint
  7. Flint returns redirect to your success_url to Buyer
  8. Flint sends order.paid webhook to Your server
  9. Your server sends GET /v1/orders/{order_id} to confirm, then fulfill to Flint

Create the order with what the buyer is buying. A line item names a catalog variant, a bundle, or a custom item with its own name and price. Flint computes the totals:

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-pottery-class-001" \
  -d '{
    "line_items": [{
      "type": "custom",
      "name": "Pottery class",
      "quantity": 1,
      "unit_price_money": {"amount": 2500, "currency": "USD"},
      "fulfillment": {"requirement": "none"}
    }]
  }'
Response
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "status": "open",
    "payment_status": "unpaid",
    "refund_status": "none",
    "line_items": [{
      "order_line_item_id": "li_1kmn0aExample",
      "name": "Pottery class",
      "quantity": 1,
      "unit_price_money": {"amount": 2500, "currency": "USD"},
      "total_money": {"amount": 2500, "currency": "USD"}
    }],
    "pricing_amounts": {
      "subtotal_money": {"amount": 2500, "currency": "USD"},
      "total_money": {"amount": 2500, "currency": "USD"}
    },
    "settlement_amounts": {
      "paid_money": {"amount": 0, "currency": "USD"},
      "outstanding_money": {"amount": 2500, "currency": "USD"}
    }
  },
  "request_id": "req_01KWM677QX312R3DEKK123WZ48",
  "meta": {"api_version": "2026-09-07"}
}

The response is abbreviated. fulfillment is required on a custom line item: {"requirement": "none"} fits services, digital goods, and items handed over in person. Catalog line items take their delivery settings from the catalog instead.

Then create a checkout session for the order and send the buyer to its url:

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-pottery-class-001" \
  -d '{
    "type": "order",
    "order_id": "ord_1kmn0aExample",
    "redirects": {
      "success_url": "https://example.com/thanks",
      "cancel_url": "https://example.com/cart"
    }
  }'
Response
{
  "data": {
    "checkout_session_id": "cs_1kmn0aExample",
    "type": "order",
    "status": "open",
    "surface": "hosted",
    "order_id": "ord_1kmn0aExample",
    "url": "https://checkout.withflintpay.com/checkout/cs_1kmn0aExample#checkout_token=cklt_v1...",
    "checkout_auth_token": "ckat_v1...",
    "expires_at": "2026-10-28T18:30:00Z"
  },
  "request_id": "req_01KWM67Q32H15VBMRXQA9VYRDH",
  "meta": {"api_version": "2026-09-07"}
}

The response is abbreviated. Redirect the buyer to url exactly as returned, including the #checkout_token fragment. checkout_auth_token is the credential for a checkout you embed or build yourself; on hosted checkout, url is all the buyer needs. In test mode, the buyer can pay with a test card.

When the buyer pays, the order's payment_status becomes paid and Flint sends order.paid to your webhook endpoint. Fulfill from that event, not from the browser landing on success_url: a buyer can close the tab before the redirect, and a redirect alone doesn't prove payment.

Note: Read the order afterward

Whichever way the money arrived, the order is what you read afterward. payment_status and refund_status say where collection stands, and settlement_amounts says what was paid, refunded, and is still outstanding. Refunds, webhooks, reports, and support all key on order_id.

Why Flint is orders-first explains the model in depth. If you're coming from Stripe or Square, those APIs start from the charge and Flint starts from the order; Migrating from Stripe and Migrating from Square map the objects field by field.

Choose how to collect payment#

Every way below except a standalone payment intent collects an order, and the order is the same whichever you use. What changes is who starts the payment, where the buyer pays, and when the money is due.

Way to collectUse it whenGuide
Checkout sessionOne buyer pays now on a Flint-hosted page, or in a checkout you embedCheckout sessions
Payment linkMany buyers share one URL, and each gets their own orderPayment links
InvoiceA balance is due later, with a due date, reminders, and a PDFInvoicing
Order payment in your UICheckout lives on your domain and Stripe Elements collects the card; your server pays the order with POST /v1/orders/{order_id}/payEmbedded payments
SubscriptionA plan bills a saved payment method every cycle, with a new order for each renewalSubscription billing
Standalone payment intentYou charge an amount with no order behind itServer-confirmed payments

Payment links vs checkout sessions vs invoices compares the three hosted options. To build every checkout screen yourself, including the cart and delivery, see Build your own checkout.

Around these, most integrations also use:

  • Products in the catalog, so line items take their name and price from a variant or bundle instead of the request.
  • Customers, with saved payment methods and a hosted account for orders, returns, and subscriptions.
  • Refunds against an order, covered in Refunds, and returns when goods come back.

What every request shares#

  • One host, one secret key. Every request goes to https://api.withflintpay.com with your key in the Authorization: Bearer header. Keys are secret and belong on your server. A key's access is full, read_only, or restricted to the scopes you choose, and a request outside them returns 403. See Authentication.
  • The key selects test or live. A flint_test_... key works in one sandbox, with its own test data. A flint_live_... key moves real money. The hostname and request shapes are the same.
  • Money is an integer in minor units. {"amount": 2500, "currency": "USD"} is $25.00. See Money & currency.
  • IDs carry a prefix that names the object: ord_ for an order, cs_ for a checkout session, pl_ for a payment link, inv_ for an invoice, sub_ for a subscription, pi_ for a payment intent, ref_ for a refund, and cus_ for a customer.
  • Request bodies are JSON, up to 1 MiB. Send Content-Type: application/json. A larger body returns 413 with REQUEST_BODY_TOO_LARGE, unless an operation documents a lower limit. Split a large write into several requests, such as adding an order's line items in batches.
  • Updates change only what you send. A PATCH leaves omitted fields as they are. Send null to clear a field that can be cleared, or to delete a metadata key. An empty string is never a value or a clear: "" returns 400 INVALID_REQUEST, with param naming the field.
  • Every response uses one envelope. A success returns the object, or an array for a list, under data, with request_id and meta. meta.api_version is the version that shaped the response. A list adds next_page_token when there are more results; see Pagination.
  • Errors carry a code to branch on. A failure returns error with type, code, message, request_id, and remediation, which says whether and how to retry. Field errors add param and details. See Error handling and the error code reference.
  • Writes take an Idempotency-Key. Retry with the same key within 24 hours and you get the original result instead of a second write. Routes that move money or stock require one, including refunds, paying an order, and creating an invoice or subscription. See Idempotency.
  • Versions are dated. Your merchant account is pinned to the version current at its first request, and a Flint-Version header tries another version on one request. See API versions and upgrades.
  • Rate limits return 429. Wait for Retry-After, then retry the same request. See Rate limits.
  • Webhooks tell your server what happened. Flint sends each event as a signed POST and retries a failed delivery for about three days. Deliveries can repeat and arrive out of order, so deduplicate on webhook_event_id. See Webhooks.

Tools#

  • SDKs. @flintpay/node for TypeScript and JavaScript and flintpay/flint for PHP give every public operation a typed method.
  • CLI. Call any /v1 route from a terminal, and forward your sandbox's webhook events to localhost with flint listen, without a public tunnel.
  • AI agents. A docs MCP server that searches the Flint docs and returns any endpoint's schema, a one-file API reference at /SKILL.md, the OpenAPI spec, and flint mcp serve for an agent that calls the API in your sandbox.
  • API & agent onboarding. Create a merchant account and its first sandbox key from your backend, when your product provisions merchants itself.

Where to go next#

  1. Accept your first payment: create a payment link, pay it with a test card, and find the payment in your dashboard.
  2. Accept a payment with Next.js: send the buyer to hosted checkout from your server and grant access from a verified order.paid webhook.
  3. Sandboxes & test mode: where test data lives and why each test key belongs to one sandbox.
  4. Authentication: send your key as a bearer token and scope keys to what each service needs.
  5. Webhooks: receive order.paid and the other events your integration acts on.
  6. Error handling: branch on error codes and know which failures to retry.
  7. Idempotency: retry a create without making a second order.
  8. Testing: test cards for declines and 3D Secure, then refunds and renewals in your sandbox.
  9. Going live: finish verification, create a live key, and switch over.

Guides and reference#

Core guides by topic, the reference pages that apply across the API, then advanced guides for features you add as your product needs them. Each resource's endpoints are in the API reference.

Get started

Read these in order: a first test payment, sandboxes and keys, webhooks, errors and retries, testing, and going live.

Build end to end

Complete builds: the calls, events, deadlines, and rules for one kind of integration.

Tools

SDKs, the CLI, keyless access from CI and cloud workloads, tools for AI agents, and request logs.

Invoicing and subscriptions

Bill a balance that is due later, correct it without moving money, and run plans, renewals, and failed-payment recovery.

Migrations

Field-by-field maps from Stripe and Square objects to Flint's.

Advanced

Payment methods and capture

Apple Pay and Google Pay, Affirm, ACH debit, authorize-then-capture, and risk rules.

Delivery and stock

Ship, deliver, or hand over what was paid for, and track stock per location.

Pricing and catalog extras

Tips and fees, sales tax, promotions, gift cards, and product images.

Headless

Own the checkout, the buyer account, or both, on your own domain.

Customer accounts

Where buyers track orders, manage subscriptions, and start returns.

Operations

Run Flint in production: payouts, fees, reports, disputes, rate limits, and key hygiene.

Platforms and partner apps

Create merchant accounts from your backend, and build apps that merchants install.

Was this helpful?