Order activities
Each order keeps an activity log: one row for each thing that happened to it, such as the order being created, an item being added, a checkout session opening or expiring, or a payment succeeding. Use the log to show a support agent or a buyer the order's history, and to work out what happened when an order looks wrong.
The log tells the story; the resources hold the facts. Each row has a description to display and, when it is about one specific resource, that resource's ID. For anything you act on, read the resource:
| To know | Read |
|---|---|
| What the order costs, what's paid, and what's owed | The order's pricing_amounts and settlement_amounts |
| Whether a payment succeeded, failed, or needs the buyer | The PaymentIntent in payment_intent_id |
| Whether a refund went through, and for how much | The refund in refund_id |
| Whether checkout is still open | The checkout session in checkout_session_id |
Three things the log isn't:
- A trigger for your code. To act when an order changes or a payment succeeds, subscribe to webhooks. Rows are for reading on demand, not for polling.
- A ledger. Don't add up
balance_delta_moneyto get the order's balance. The order'ssettlement_amountshas it. - A request log. For the API requests and webhook deliveries that touched an order, use its resource timeline. The activity log records what happened to the order; the timeline records what your integration and Flint's webhooks did.
Review activity rows use payment_review_opened and payment_review_closed, identify the review in payment_review_id, and carry zero balance_delta_money. A close description names the outcome, such as approved, declined, or expired. Buyer activity lists omit these rows.
A refund row can include actor with resource_type, resource_id, and the recorded label. This identifies the teammate, API key, or app that initiated the refund. Buyer activity lists omit this field.
Read an order's history#
The log is newest first by default. For a timeline that reads top to bottom, pass sort_direction=asc:
curl "https://api.withflintpay.com/v1/orders/ord_01KWJZ8ZD3EDT7F78T82TZ6JXD/activities?sort_direction=asc" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": [
{
"order_activity_id": "oact_01KQM9S346Q3D25VT4F5V37E3S",
"activity_type": "created",
"balance_delta_money": { "amount": 4500, "currency": "USD" },
"running_balance_money": { "amount": 4500, "currency": "USD" },
"description": "Order created with 2 line item(s)",
"created_at": "2026-10-20T15:02:11Z"
},
{
"order_activity_id": "oact_01KQ3E28JT97KB6CQ643DZVMXX",
"activity_type": "line_item_added",
"balance_delta_money": { "amount": 500, "currency": "USD" },
"running_balance_money": { "amount": 5000, "currency": "USD" },
"description": "Line item added: Gift wrap (qty: 1)",
"order_line_item_id": "li_01KQQKFBF5KZNWJ47TAN9ZT24M",
"created_at": "2026-10-20T15:04:40Z"
},
{
"order_activity_id": "oact_01KQNPZX45HY43KWJRP1XPA7Z3",
"activity_type": "checkout_session_created",
"balance_delta_money": { "amount": 0, "currency": "USD" },
"running_balance_money": { "amount": 5000, "currency": "USD" },
"description": "Checkout session created",
"checkout_session_id": "cs_01KQDJ8FSSZ5AWSH8VHTPRE95B",
"created_at": "2026-10-20T15:05:02Z"
},
{
"order_activity_id": "oact_01KQ9EE0ZBGJ09TQM83XSSSS6Y",
"activity_type": "checkout_session_expired",
"balance_delta_money": { "amount": 0, "currency": "USD" },
"running_balance_money": { "amount": 5000, "currency": "USD" },
"description": "Checkout session expired",
"checkout_session_id": "cs_01KQDJ8FSSZ5AWSH8VHTPRE95B",
"created_at": "2026-10-21T15:05:02Z"
},
{
"order_activity_id": "oact_01KQS3C4DWA7N36096Q14DR9GP",
"activity_type": "checkout_session_created",
"balance_delta_money": { "amount": 0, "currency": "USD" },
"running_balance_money": { "amount": 5000, "currency": "USD" },
"description": "Checkout session created",
"checkout_session_id": "cs_01KQQY77ZXYYK596NGYA1DQ91K",
"created_at": "2026-10-21T18:30:15Z"
},
{
"order_activity_id": "oact_01KQ5GQAPENECFSECZP11HYGCP",
"activity_type": "payment",
"balance_delta_money": { "amount": -5000, "currency": "USD" },
"running_balance_money": { "amount": 0, "currency": "USD" },
"description": "Payment succeeded",
"payment_intent_id": "pi_01KQWPQ5E6EYCNDY0YP57RCYBV",
"created_at": "2026-10-21T18:31:48Z"
}
],
"request_id": "req_01KQN5SXS5AA819X9YP981068V"
}
Read in order, the rows answer a support question like "why did it take the buyer a day to pay?":
created: the order opened with two items for $45.00. Its delta is the starting total, so the balance is $45.00.line_item_added: gift wrap added $5.00, raising the balance to $50.00.order_line_item_idnames the item on the order.checkout_session_created: you sent the buyer to checkout. A delta of0: opening checkout doesn't change what the order costs.checkout_session_expired: the buyer left without paying, and the session expired.checkout_session_created: a second session, with a newcheckout_session_id.payment: the buyer paid $50.00 and the balance reached0. Read the PaymentIntent inpayment_intent_idfor the amount captured and how the buyer paid.
There is no next_page_token, so there are no more rows. Every row carries order_activity_id, description, balance_delta_money, and running_balance_money.
When Flint records the initiating teammate, API key, or app, the row includes actor with resource_type, resource_id, and label. The label is empty if Flint could not resolve a name. Older rows and automatic actions can have no actor. Buyer activity lists omit it.
Balance delta and running balance#
Both are signed amounts in minor units, as money and amounts describes.
running_balance_moneyis the order's balance just after the row: what was still owed, less any money paid beyond the total. It issettlement_amounts.outstanding_moneyminussettlement_amounts.overpaid_moneyat that moment, so it is negative while the order is overpaid. Use it to show the balance next to each row.balance_delta_moneyis exactly how much the row changed that balance: itsrunning_balance_moneyminus the balance before it. Rows that change what the order costs carry that change:createdcarries the starting total, and line item, discount, tax, tip, charge, andorder_updatedrows carry their own effect. A final capture that also releases order debt records apaymentrow for the amount collected and a separateadjustmentrow for the debt released. For a $1.50 final capture from a $2.00 hold, the rows have deltas of -$1.50 and -$0.50. If the capture also changes the order total, for example by changing the tip, a separateadjustmentrow records that change. A payment can move the balance by a different amount than it collected, for example less when part of the order was written off, and the delta says how far the balance moved. Rows that record a step or a failure carry0:payment_failed,refund_failed, checkout session rows, fulfillment rows, andclosed.- A
refundrow usually carries0. A refund returns money already collected, which doesn't change what is owed. A refund of an overpayment moves the balance toward0, and the delta is that change. The amount refunded is on the refund inrefund_idand in the row'sdescription.
The delta is the change, not the money moved. For how much a payment collected or a refund returned, read the PaymentIntent or the refund.
For the balance now, read the order. A later row, such as a refund or a write-off, can change the balance, and the order always reports its current settlement_amounts.
Page through a long log#
An order that was edited many times or sent through checkout repeatedly can have more rows than one page. page_size defaults to 20 and goes up to 100. When next_page_token is present, pass it as page_token, with the same sort_direction and activity_type, to get the next page. Rows with the same created_at come back in order_activity_id order, so pages don't skip or repeat rows. Pagination covers the token rules.
async function listOrderActivities(orderId) {
const rows = [];
let pageToken;
do {
const params = new URLSearchParams({ sort_direction: "asc", page_size: "100" });
if (pageToken) params.set("page_token", pageToken);
const response = await fetch(
`https://api.withflintpay.com/v1/orders/${orderId}/activities?${params}`,
{ headers: { Authorization: `Bearer ${process.env.FLINT_API_KEY}` } },
);
if (!response.ok) throw new Error(`Flint returned ${response.status}`);
const page = await response.json();
rows.push(...page.data);
pageToken = page.next_page_token;
} while (pageToken);
return rows;
}
Filter by type#
To show only some rows, such as payments and refunds on a support screen, pass activity_type. Repeat it or separate values with commas; a row matches if it has any of the types you list.
curl "https://api.withflintpay.com/v1/orders/ord_01KWJZ8ZD3EDT7F78T82TZ6JXD/activities?activity_type=payment,payment_failed,refund,refund_failed" \
-H "Authorization: Bearer YOUR_API_KEY"
curl "https://api.withflintpay.com/v1/orders/ord_01KWJZ8ZD3EDT7F78T82TZ6JXD/activities?activity_type=checkout_session_created&activity_type=checkout_session_expired&activity_type=checkout_session_invalidated" \
-H "Authorization: Bearer YOUR_API_KEY"
The filter accepts only the types in the table below. An empty or unknown value is rejected before anything is read.
Activity types#
Each row carries at most one reference ID, for the resource it is about. Rows about the order as a whole carry none, and so do rows that cover several resources at once, such as a payment split across a gift card and a card, or several fulfillments created together.
| Group | activity_type | Reference field |
|---|---|---|
| Order | created, order_updated, adjustment, closed | None |
| Line items | line_item_added, line_item_updated, line_item_removed | order_line_item_id |
| Discounts | discount_applied, discount_removed | order_discount_id |
| Tax | tax_updated | None |
| Tips | requested_tip_added, requested_tip_updated, requested_tip_removed | order_tip_id |
| Charges | charge_added, charge_updated, charge_removed, charge_fulfillment_updated | order_charge_id |
| Payments | payment, payment_failed | payment_intent_id |
| Refunds | refund, refund_failed | refund_id |
| Disputes | dispute_opened, dispute_closed | dispute_id |
| Order edits | order_edited | None |
| Checkout sessions | checkout_session_created, checkout_session_expired, checkout_session_invalidated | checkout_session_id |
| Fulfillment | fulfillment_created, fulfillment_updated, fulfillment_state_changed | fulfillment_id |
A dispute activity carries the Flint du_ ID in dispute_id, and its description names the case, the principal and where it stands, for example Chargeback for $31.00 lost. The cardholder keeps the money. Its balance_delta_money is 0 because a lost dispute never reopens the order balance. Repeated observations create no duplicate activities. Buyer activity lists under /v1/me omit both dispute types.
A few rows need a closer look:
payment_failedrecords a payment attempt that failed, such as a declined card, or the part of a split payment that failed while the rest succeeded. Each failed attempt adds one row, however many times Flint retries or replays it.payment_intent_idnames the declined payment when exactly one card payment declined; otherwise the row has none, for example when the payment was made only with gift cards. A canceled or expired attempt adds no row.refundrecords a refund Flint accepted, not one that has settled. A laterrefund_failedrow with the samerefund_idmeans that refund failed or only partly succeeded. The refund'sstatussays which, and how much went back. When the failed refund was returning an overpayment, anadjustmentrow follows with the balance it restores, such as "Balance restored after refund of USD 20.00 failed".order_editedrecords that an order edit changed a paid order's items: it removed unfulfilled units, added items, or both. A refund of leftover credit gets its ownrefundrow, and a failure addsrefund_failed. An edit that collects a balance is followed by apaymentrow, as A paid-order edit that collects a balance shows. Read the order's edits for which lines and quantities changed.checkout_session_invalidatedmeans something outside the session ended it: the order was paid another way, an edit closed the order or left nothing to pay, you replaced the session, or the invoice it was collecting stopped needing it. The session'sterminal_reasonsays which, as Checkout sessions describes. Send the buyer a new session if the order still needs paying.closedmeans the order stopped accepting payment. Discounts canceled by the close appear as their owndiscount_removedrows.adjustmentrecords a change to the order's recorded balance, such as the overpayment a failed refund puts back, or an inventory exception being resolved.
Render rows safely#
Write your timeline so new types and new wording can't break it:
- Switch on
activity_type, never ondescription. Descriptions are display text and their wording can change. They can include names you or your staff entered, such as item names, so escape them like any other user input. - Show a generic row for a type you don't recognize. Flint adds activity types over time. A row whose type this API version can't name has no
activity_typeat all, so treat a missing value the same way. - Link the reference you find. Check the reference fields rather than assuming one from the type, since some rows have none.
const REFERENCE_FIELDS = [
"payment_intent_id",
"refund_id",
"checkout_session_id",
"order_line_item_id",
"order_discount_id",
"order_tip_id",
"order_charge_id",
"fulfillment_id",
];
function timelineRow(activity, knownTypes) {
const referenceField = REFERENCE_FIELDS.find((field) => activity[field]);
return {
id: activity.order_activity_id,
at: activity.created_at,
kind: knownTypes.has(activity.activity_type) ? activity.activity_type : "other",
text: activity.description, // escape before inserting as HTML
balanceChange: activity.balance_delta_money,
balanceAfter: activity.running_balance_money,
reference: referenceField ? { field: referenceField, id: activity[referenceField] } : null,
};
}
Show the history to the buyer#
GET /v1/me/orders/{order_id}/activities takes the same sort_direction, activity_type, page_size, and page_token parameters and returns the same row shape, authenticated by a customer session rather than your API key. It returns only the signed-in buyer's own orders. To keep internal detail out of the buyer's view, Flint replaces some descriptions with fixed text, such as "Payment failed" or "Tax updated", and leaves out fulfillment steps that don't change the buyer's progress, such as holds. A page can hold fewer rows than page_size for that reason, so keep paging while next_page_token is present.
Errors#
Next steps#
Orders firstWebhooksDebugging requestsA paid-order edit that collects a balance#
Creating a pending edit adds no order_edited activity because the order's items and money have not changed. At completion, order_edited records the edit's balance increase, followed by a payment row for the balance payment. Their balance deltas sum to zero. The order stays paid and closed, and sends no second order.paid. Canceling an unpaid edit leaves the original items and money unchanged.