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.
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.
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 credit held beyond the total. It is the difference betweensettlement_amounts.outstanding_moneyandsettlement_amounts.overpaid_moneyat that moment. Use it to show the balance next to each row.balance_delta_moneyis how much the row changed what the buyer owes. 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. Apaymentrow is negative by the amount collected plus any debt discharged by that payment's final capture. For example, a final capture of $1.50 from a $2.00 hold can discharge the remaining $0.50, giving the row a delta of -$2.00. Released money is not collected money. Rows that record a step or a failure carry0:payment_failed,refund_failed, checkout session rows, fulfillment rows, andclosed.
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 |
| 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 few rows need a closer look:
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.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, 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.
