Skip to content

Stripe as your source of truth

Stripe is the source of truth for payment state: charges, refunds, disputes, and subscriptions. It can't be the source of truth for the sale. Stripe has no object for an order's fulfillment or stock, and its fulfillment guide has you record fulfillment status in your own system. So most Stripe integrations run two records, Stripe for the money and your database for the order, joined by a key in metadata.
Verified against official documentationReviewed Send a correction (opens in a new tab)

The answer depends on the fact you're storing. Facts that originate in Stripe can only be copied out, and facts Stripe never receives have to live with you. Below: which data goes where, what querying Stripe on each request costs, how to keep a copy honest, and the five ways the two records drift. If you'd rather keep one record, skip to the order on Flint.

Where to start

Where you areYour path
You're deciding what to keep in Stripe and what to keep in your databaseSplit it by data
You want to query Stripe on each request instead of keeping a copyWhat reads at request time cost
Your database and Stripe disagree, and you need to know which to believeThe five ways the copies drift
You sell products and need to decide where the order livesThe half Stripe can't hold
You want one record for the sale and its paymentsOne order record on Flint

Split the question by data

DataStripe as the source of truth?Why
Charge, refund, and dispute stateYes. They originate in StripeYour database can only hold a copy, written from webhooks and fresh reads, never from your own request having returned.
Subscription status and entitlementsYes, with a local copy for checksStripe holds the truth, but checking it on every request runs into the per-endpoint and read limits. Copy the few fields you gate on.
Customer identitySplit itYour user row owns identity, and the Stripe Customer owns the payment profile. Store the cus_ ID on your row. Copying the email too gives one fact two owners.
Product catalog and pricesEither, with one writerCatalogs fork when both the Dashboard and your admin can edit them. Pick the side that writes, and treat the other as read-only.
The order: items sold, fulfillment, stockNoA Checkout Session is a payment with line items attached. It has no fulfillment state and no stock, and Stripe's fulfillment guide has you record fulfillment status yourself.
Application state in metadataNo50 keys of up to 500 characters, with no validation or transactions. Stripe's docs say to keep larger data in your own database and store its ID in metadata.

Copy Stripe's payment state safely

Payment state is Stripe's to declare. A local copy stays correct under three rules, and each drift mode below breaks one of them.

Outcomes are read, never assumed. Your code records that it asked for a payment. Whether the payment succeeded enters your database only from a webhook or a fresh read of the object. The success redirect isn't proof: Stripe's fulfillment guide says customers aren't guaranteed to reach the success page.

Events are signals, not state. Stripe can deliver an event more than once and doesn't guarantee order, and its webhooks guide says not to order events by their created time. So record each event ID once, then read the object and write what the API returns:

JavaScript
// One handler writes your copy of Stripe's payment state.
// Checkout code records that it asked; only reads from Stripe
// record what happened.
const event = stripe.webhooks.constructEvent(rawBody, signature, secret);

await db.tx(async (t) => {
  // Stripe can deliver an event more than once: record its ID
  // in the same transaction as the write.
  const first = await t.result(
    `INSERT INTO processed_events (event_id) VALUES ($1)
     ON CONFLICT DO NOTHING`,
    [event.id],
  );
  if (first.rowCount === 0) return;

  // Delivery is unordered, so the payload may be stale. Read the
  // object and write what the API returns now.
  const pi = await stripe.paymentIntents.retrieve(event.data.object.id);
  await t.none(
    `UPDATE payments SET status = $1, updated_at = now()
     WHERE payment_intent_id = $2`,
    [pi.status, pi.id],
  );
});

Other writers exist. Refunds issued in the Dashboard, subscriptions canceled by support, payment methods changed in the customer portal, and disputes opened by the bank never pass through your code. Webhooks are the only complete feed of those changes, and a scheduled diff against the list endpoints catches deliveries that failed after Stripe's retries, which run for up to three days in live mode.

What querying Stripe on each request costs

The alternative to a copy is calling Stripe whenever you need a fact. Stripe's limits are sized for payment traffic:

  • Live mode allows 100 requests a second across the account, shared with the payment requests that must not fail. Sandboxes allow 25.
  • Most endpoints allow 25 requests a second, and every ID counts toward the same endpoint: retrieving 25 different subscriptions in one second uses the whole budget for that call. Search allows 20.
  • By default, live mode allows 50 requests in progress at once, and list requests and expansions are the slow ones that use it up.
  • Reads are allocated at an average of 500 per transaction over a rolling 30 days, with a minimum of 10,000 a month. Writes have no allocation.

The allocation ties your read budget to your sales, not your traffic. Take an app with 1,000 subscribers and about 1,000 payments a month: that allows 500,000 reads in 30 days. If the app checks the subscriber's plan in Stripe on every request, and each subscriber makes 50 requests a day, it needs 1,500,000 reads, three times the allocation, all of them counted against the 100 a second that renewals also use.

Search doesn't help on the request path. Stripe's docs say not to use it for read-after-write flows, because new data takes up to a minute to become searchable. For bulk reads, Stripe points to Sigma and Data Pipeline, which put your data in a warehouse for analytics, not for serving a page. That leaves a local copy for anything your app checks often: backfill from the list endpoints, webhooks for changes, and a scheduled reconciliation for what the webhooks missed.

The half Stripe can't hold

A store's record of a sale answers five questions: what was sold, what was paid, what was refunded against which items, what shipped, and what stock is left. Stripe answers the second. A Checkout Session carries line items, returned only when you expand them, and has no field for fulfillment. A refund is an amount against a payment, not a decision about items. Stock isn't tracked, and the object that once held orders was retired.

Stripe's fulfillment guide fills the gap with your code. Your fulfill_checkout function must handle being called more than once, even concurrently, for the same session; retrieve the session with line items expanded; check payment_status; and record fulfillment status. The guide also suggests saving the payment details and line items in your own database and updating your stock records. One sale then looks like this:

One sale recorded across Stripe and your databaseResponse
Your databaseYour serverStripeInsert order for cart 1842, status pendingCreate Checkout Session, metadata cart_id=1842checkout.session.completedRetrieve the session, expand line_itemsSession with payment_status paidFind cart 1842 by metadata, mark paid, save line itemsDecrement stock, record fulfillment status
  1. Your server sends Insert order for cart 1842, status pending to Your database
  2. Your server sends Create Checkout Session, metadata cart_id=1842 to Stripe
  3. Stripe sends checkout.session.completed to Your server
  4. Your server sends Retrieve the session, expand line_items to Stripe
  5. Stripe returns Session with payment_status paid to Your server
  6. Your server sends Find cart 1842 by metadata, mark paid, save line items to Your database
  7. Your server sends Decrement stock, record fulfillment status to Your database

Your database becomes the record of the sale, Stripe stays the record of the money, and a cart ID in metadata joins them. Every later question crosses that join. Was this order refunded? Your rows for the items, Stripe for the money. Why does finance's export disagree with the database? Check both. The reconciliation job that compares the two becomes infrastructure your store depends on.

The five ways the copies drift

  1. Paid state written from the redirect#

    A buyer who paid got nothing until support stepped in, and a session that never completed was fulfilled.

    The success page is a browser navigation, and Stripe's fulfillment guide says customers aren't guaranteed to reach it: a buyer can pay and lose their connection before it loads. A landing page that treats its own URL as proof of payment fulfills on arrival, not on money. When you listen for checkout.session.completed and set a success_url, Checkout waits up to 10 seconds for your webhook handler before redirecting, which shows which channel Stripe treats as the record.

    Confirm it

    Compare a week of checkout.session.completed events with your landing-page fulfillments. Each event with no matching fulfillment is a paid buyer your redirect code never saw.

    Fix

    Fulfill from the webhook. If the landing page also fulfills for speed, both paths call one idempotent function that retrieves the session and checks payment_status before acting.

  2. The copy only knows what your code did#

    A refund issued in the Dashboard three weeks ago is missing from your database, and finance found it first.

    Updating your tables from your own API responses records only the writes your code makes. Refunds issued in the Dashboard, subscriptions canceled by support, payment methods changed in the customer portal, and disputes opened by the bank all change Stripe without passing through your code.

    Confirm it

    List last month's refunds and canceled subscriptions in Stripe and diff them against your rows. Anything in Stripe and missing locally came through a path you don't sync.

    Fix

    Make webhooks the only writer of copied payment state, and back them with a scheduled diff against the list endpoints, because a delivery can fail after its retries run out.

  3. Events applied in arrival order#

    A canceled subscription flipped back to active after a burst of events.

    Stripe can deliver an event more than once and doesn't guarantee order, so the last payload to arrive isn't necessarily the current state. Stripe's webhooks guide warns against ordering by the event's created, which is in whole seconds. A handler that writes each payload as it arrives can apply an old state over a new one.

    Confirm it

    Retrieve a sample of active subscriptions from Stripe and compare their status with your rows. A mismatch with no failed delivery behind it is an out-of-order write.

    Fix

    Treat the event as a signal: record its ID once, then retrieve the object and write what the API returns, which is always current.

  4. Metadata used as the application database#

    Credits and plan flags live in customer metadata, and two support agents just overwrote each other.

    Metadata is 50 keys of up to 500 characters. Nothing validates it, and outside Radar rules Stripe doesn't read it. Updates merge key by key, so two writers to the same key overwrite each other, and search over metadata can lag a write by up to a minute. Stripe's docs say that when you need more, you store the data in your own database and keep its ID in metadata.

    Confirm it

    Search your code for branches on a metadata value. Each hit is application state that lives outside your schema and your transactions.

    Fix

    Keep metadata for join keys: your order ID, your user ID, a campaign tag. State that changes and matters belongs in a database with transactions.

  5. A join key held together by convention#

    A deploy bug left forty paid sessions with no order row, and nobody noticed until the packing bench ran out of work.

    Your half of the record and Stripe's half meet at a string in metadata. Stripe accepts any value there, your database can't hold a foreign key into Stripe, and no constraint checks that the two sides agree.

    Confirm it

    Walk yesterday's completed sessions and confirm each has exactly one order row, then walk your orders back to their sessions.

    Fix

    Run that query on a schedule in both directions and alert on any mismatch. Treat each hit as an incident to explain, not a row to patch.

    This is the running cost of splitting one sale across two systems, and it has to work during your busiest hour.

On Flint, the order is the one record

Flint is a payments API where the order holds the sale and its payment state together, and as a headless commerce API it keeps stock and fulfillment on the same order. Flint processes cards on Stripe, but you don't need a Stripe account or a mapping table: payment results land on the order. Create the order first, with your own ID in external_reference_id:

cURL
curl -X POST https://api.withflintpay.com/v1/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-cart-1842" \
  -d '{
    "external_reference_id": "cart-1842",
    "line_items": [{
      "type": "custom",
      "name": "Design workshop seat",
      "quantity": 2,
      "unit_price_money": {"amount": 45000, "currency": "USD"},
      "fulfillment": {"requirement": "none"}
    }],
    "metadata": {"campaign": "spring-workshops"}
  }'

Then collect it. Hosted checkout is one call, and your own payment form or an invoice pays the same order the same way:

cURL
curl -X POST https://api.withflintpay.com/v1/checkout-sessions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: checkout-cart-1842" \
  -d '{
    "type": "order",
    "order_id": "ord_1kmn0aExample",
    "redirects": {
      "success_url": "https://example.com/thanks",
      "cancel_url": "https://example.com/cart"
    }
  }'

Whichever way the buyer paid, the result is on the order, and your cart ID finds it without a metadata search:

cURL
curl "https://api.withflintpay.com/v1/orders?external_reference_id=cart-1842" \
  -H "Authorization: Bearer YOUR_API_KEY"
JSON
{
  "data": [
    {
      "order_id": "ord_1kmn0aExample",
      "external_reference_id": "cart-1842",
      "version": 1792512240,
      "status": "closed",
      "closed_reason": "paid",
      "payment_status": "paid",
      "refund_status": "none",
      "fulfillment_status": "not_applicable",
      "pricing_amounts": {
        "subtotal_money": {"amount": 90000, "currency": "USD"},
        "total_money": {"amount": 90000, "currency": "USD"}
      },
      "settlement_amounts": {
        "paid_money": {"amount": 90000, "currency": "USD"},
        "refunded_money": {"amount": 0, "currency": "USD"},
        "outstanding_money": {"amount": 0, "currency": "USD"}
      },
      "checkout_session_ids": ["cs_1kmn0aExample"],
      "payment_intent_ids": ["pi_1kmn0aExample"],
      "refund_ids": [],
      "metadata": {"campaign": "spring-workshops"}
    }
  ],
  "request_id": "req_..."
}

One object answers the questions two systems answered before. payment_status says whether the money arrived, refund_status whether any went back, and settlement_amounts holds what was paid, refunded, and still outstanding next to the pricing_amounts the buyer agreed to. Full payment closes the order with closed_reason paid; a later refund moves refund_status and refunded_money without reopening it. The checkout_session_ids, payment_intent_ids, and refund_ids link every collection and refund to the order.

The rest of the sale rides on the same record. For goods that ship, fulfillment_status moves from not_fulfilled through partially_fulfilled to fulfilled as you record fulfillments; a service like this workshop seat is not_applicable. Refunds name line items, and Flint works out the tax and the order's refunded totals. When you track stock in Flint, inventory_reservation_id names the reservation holding the order's units.

Keep a local copy without the drift

You can still copy orders into your database, and the copy has one upstream record instead of two halves. Flint webhooks also arrive at least once and in no guaranteed order, but every order carries a version that increases with each change. A late snapshot can't overwrite a newer one, so the handler writes the payload it received without a second API call:

JavaScript
// Flint order events: order.created, order.updated, order.paid,
// order.closed, order.partially_refunded, order.refunded.
// verifyFlintWebhook is the JWT check from the Webhooks guide.
const event = await verifyFlintWebhook(rawBody, headers);
const order = event.data.object; // the order, as GET returns it

await db.tx(async (t) => {
  const first = await t.result(
    `INSERT INTO processed_events (event_id) VALUES ($1)
     ON CONFLICT DO NOTHING`,
    [event.webhook_event_id],
  );
  if (first.rowCount === 0) return;

  // version increases with every change to the order, so a late
  // snapshot never overwrites a newer one. No extra API call.
  await t.none(
    `INSERT INTO orders (order_id, cart_id, version, payment_status,
                         refund_status, fulfillment_status)
     VALUES ($1, $2, $3, $4, $5, $6)
     ON CONFLICT (order_id) DO UPDATE SET
       version = EXCLUDED.version,
       payment_status = EXCLUDED.payment_status,
       refund_status = EXCLUDED.refund_status,
       fulfillment_status = EXCLUDED.fulfillment_status
     WHERE orders.version < EXCLUDED.version`,
    [order.order_id, order.external_reference_id, order.version,
     order.payment_status, order.refund_status, order.fulfillment_status],
  );
});

order.paid fires when the order becomes fully paid on any surface: hosted checkout, a payment link, an invoice, or a direct API payment. That makes it the one fulfillment trigger. For reconciliation, list what changed since your last run and compare versions:

cURL
curl "https://api.withflintpay.com/v1/orders?updated_after=2026-10-27T00:00:00Z&page_size=100" \
  -H "Authorization: Bearer YOUR_API_KEY"

Reads have their own rate limit class: 200 requests a second and 12,000 a minute for each merchant by default, separate from the budget that creates orders and checkouts, so a busy account page can't starve checkout. The budget is a rate, not a monthly allowance tied to your sales.

Stripe with your database, and Flint, side by side

Stripe plus your databaseFlint
What was soldYour orders table; session line items behind an expandline_items on the order
Whether money arrivedA column you write from webhooks and readspayment_status and settlement_amounts on the order
Refunds against itemsAmounts against a payment; item allocation is yoursLine-item refunds, with refunded totals on the order
Whether goods shippedA column only you updatefulfillment_status on the order
StockYour counters and holdsFlint inventory, with a reservation per order
Join to your systemA metadata key, by conventionexternal_reference_id, filterable on GET /v1/orders
A late webhookRetrieve the object on every eventCompare version and skip older snapshots
Read budgetShares 100 a second with payments; 500 reads per transactionIts own class, 200 a second per merchant

Questions, answered

Should I use Stripe as my source of truth?

For charge, refund, dispute, and subscription state, yes: those facts originate in Stripe, and your database can only hold a copy written from webhooks and fresh reads. For orders, fulfillment, and stock, no: Stripe has no objects for them, and its fulfillment guide has you record fulfillment status in your own system.

Should I store Stripe data in my own database?

Store the IDs and the few fields you query or gate on, such as payment and subscription status. Write them only from webhooks and fresh API reads, and reconcile on a schedule. Calling Stripe on every request runs into its per-endpoint limit of 25 requests a second and its read allocation of 500 reads per transaction.

Can I use Stripe as my database?

No. The general-purpose storage on Stripe objects is metadata: 50 key-value pairs, keys up to 40 characters, values up to 500, with no validation or transactions, and Stripe doesn't read it outside Radar rules. Stripe's docs say to store larger data in your own database and keep its ID in metadata.

Can I call the Stripe API instead of keeping a local copy?

At low traffic. Live mode allows 100 requests a second across the account, shared with your payment traffic, and most endpoints allow 25 a second for all IDs together. Reads are also allocated at an average of 500 per transaction over a rolling 30 days, with a minimum of 10,000 a month. Search allows 20 reads a second and can lag writes by up to a minute.

How do I keep my database in sync with Stripe?

Use three parts together. Backfill history by paging through the list endpoints. Apply webhooks idempotently: record each event ID once, then retrieve the object and write what the API returns rather than trusting arrival order. Reconcile on a schedule by diffing Stripe's lists against your rows, because the events list only goes back 30 days.

Is there a tool that syncs Stripe to my database?

Stripe's Sigma and Data Pipeline put your Stripe data in a warehouse for analytics. For an operational copy, Stripe's GitHub organization hosts an open-source sync engine for Postgres that you deploy and run yourself; its README says to use it at your own risk and deploy it only internally. Any of these copies payment data only: the order still lives in your tables.

Where do orders live when you take payments with Stripe?

In your database. Stripe's fulfillment guide has your fulfillment function retrieve the session with line items expanded, check payment_status, and record fulfillment status, and suggests saving the line items and updating stock in your own system. Stripe stays the record for the money, joined to your order by a key you put in metadata.

Does Stripe have an Orders API?

No. The original Orders API was deprecated in October 2019 because it couldn't support Strong Customer Authentication. A new Orders API entered beta in May 2022, and Stripe removed it from its SDKs that November. A Checkout Session is the closest current object.

How does Flint keep the sale and the payment in one record?

On Flint, the order is the record. It holds the line items, pricing_amounts, payment_status, refund_status, fulfillment_status, and settlement_amounts, plus the IDs of every checkout session, payment, and refund against it. Flint processes cards on Stripe, but you don't need a Stripe account or a mapping table: payment results land on the order.

Sources

Accessed October 28, 2026.