Build your own customer account
You want buyers to manage their purchases on your own site, behind your own login: order history and tracking, subscriptions, saved cards and addresses, invoices, and Returns. Flint gives you two pieces for this. A customer session is a credential your backend creates for one signed-in buyer, and /v1/me is the part of the API that credential can call.
The session decides whose data comes back. No /v1/me route takes a customer_id, and an ID that belongs to another buyer returns 404, so a bug in your pages can't show one buyer another buyer's order. Flint also applies your store's rules, such as whether buyers may pause a subscription, on every request.
To keep Flint's hosted account and build only your own checkout, see Use Flint's account with your own checkout.
The whole loop#
Relay /v1/me through your backend#
Flint has no browser credential for /v1/me, so the browser calls your backend and your backend calls Flint with the session secret. See Keep the secret on your server.
A checkout relay needs one route per job, because it holds credentials that reach more than one buyer. An account relay can forward /v1/me as a whole: the customer session limits every request to the signed-in buyer, customer_id is refused, and another buyer's IDs return 404. A request the browser invents can still reach only that buyer's data.
The relay is the part an attacker can reach, so it still has rules:
- Forward only
/v1/mepaths. Accept a path only when it matches^/v1/me(/[A-Za-z0-9_-]+)*$, and return404for anything else, so the relay never becomes a proxy for the rest of the API. - Take the credential from your session store. Never read
Authorizationfrom the browser's request, and never attach your API key. - Forward the request as it arrived. Send the method, query string, JSON body, and
Idempotency-Keyunchanged, so a retried click replays instead of repeating. - Don't forward the browser's
X-Request-Id. Flint stores it asclient_request_id, and a value that isn't 1 to 128 visible ASCII characters returns400 INVALID_REQUEST. - Set
Flint-Versionin the relay, so an API upgrade is a change you make and test. - Protect every method except
GETandHEADagainst CSRF. Check theOriginheader and require a CSRF token, as for any route that a cookie authenticates. - Refresh once on
INVALID_CREDENTIAL. Refresh the session and resend the request with the sameIdempotency-Key. The usual reason isexpired. A page that makes several calls at once can also getunknown, because a parallel request already refreshed and replaced the secret; refreshing with the session's fixed key returns that same new pair. When the refresh fails, end your session so the buyer signs in again. - Pass the status, body, and
Retry-Afterthrough. Flint's errors are written for your front end to act on. - Give sign-out its own route, so your session ends with Flint's, and keep
/v1/me/session/revokeout of the relay. - Offer less by forwarding less. Your store's settings decide what a buyer may do. To offer fewer jobs than they allow, list only the routes your pages use instead of the pattern.
const FLINT = "https://api.withflintpay.com";
const FLINT_VERSION = "2026-09-07"; // Pin it, and change it when you test an upgrade.
const ME_PATH = /^\/v1\/me(\/[A-Za-z0-9_-]+)*$/;
const PASSED_HEADERS = ["content-type", "content-disposition", "retry-after"];
// The browser calls /flint/v1/me/orders. JSON bodies pass through as text,
// so Flint sees exactly what the browser sent. csrfProtection skips GET and HEAD.
app.use(
"/flint",
express.text({ type: "application/json", limit: "100kb" }),
requireSession,
csrfProtection,
limitPerSession("account"),
async (req, res) => {
const path = req.path;
if (!ME_PATH.test(path) || path === "/v1/me/session/revoke") return res.sendStatus(404);
const query = new URL(req.originalUrl, "http://relay.invalid").search;
const send = (secret) => {
const headers = { Authorization: `Bearer ${secret}`, "Flint-Version": FLINT_VERSION };
const idempotencyKey = req.get("Idempotency-Key");
if (idempotencyKey) headers["Idempotency-Key"] = idempotencyKey;
const hasBody = typeof req.body === "string" && req.body.length > 0;
if (hasBody) headers["Content-Type"] = "application/json";
return fetch(`${FLINT}${path}${query}`, {
method: req.method,
headers,
body: hasBody ? req.body : undefined,
});
};
// { customerSessionId, secret, refreshToken }, from your session store.
const flint = req.session.flint;
let response = await send(flint.secret);
if (response.status === 401 && (await isInvalidCredential(response))) {
// Expired, or replaced by a parallel refresh. The fixed key returns the same new pair.
const secret = await refreshCustomerSession(flint);
if (secret) response = await send(secret);
}
// Still 401: the refresh failed, so the session is over. The buyer signs in again.
if (response.status === 401) await new Promise((done) => req.session.destroy(done));
res.status(response.status);
for (const name of PASSED_HEADERS) {
const value = response.headers.get(name);
if (value) res.set(name, value);
}
res.send(Buffer.from(await response.arrayBuffer()));
},
);
async function isInvalidCredential(response) {
const body = await response.clone().json().catch(() => null);
return body?.error?.code === "INVALID_CREDENTIAL";
}
app.post("/sign-out", requireSession, csrfProtection, async (req, res) => {
// The session's own secret ends it, even after it expired. No API key is involved.
await fetch(`${FLINT}/v1/me/session/revoke`, {
method: "POST",
headers: { Authorization: `Bearer ${req.session.flint.secret}`, "Flint-Version": FLINT_VERSION },
}).catch(() => {});
// End your own session whatever Flint answered.
req.session.destroy(() => res.sendStatus(204));
});
refreshCustomerSession is the function in Send one fixed Idempotency-Key per session: it rotates the pair with one fixed key per session, saves it, and returns the new secret, or null when the buyer has to sign in again. requireSession, csrfProtection, and limitPerSession are your own middleware. The SDKs cover every /v1/me route too, with the session secret passed as customerToken.
What the buyer can do#
Every route below takes the customer session secret. Lists page with page_size and page_token.
| Job | Routes |
|---|---|
| Profile | GET /v1/me. PATCH /v1/me changes name, phone, and default_payment_method_id. |
| Sign out | POST /v1/me/session/revoke |
| Email address | POST /v1/me/email-change-requests, then POST /v1/me/email-change-requests/{email_change_request_id}/confirm |
| Email preferences | GET and PATCH /v1/me/email-preferences |
| Addresses | List, create, get, update, and delete at /v1/me/addresses and /v1/me/addresses/{customer_address_id} |
| Saved cards | List, add, get, and delete at /v1/me/payment-methods and /v1/me/payment-methods/{payment_method_id} |
| Orders | GET /v1/me/orders, GET /v1/me/orders/{order_id}, GET /v1/me/orders/{order_id}/activities, GET /v1/me/orders/{order_id}/receipt-pdf, and POST /v1/me/orders/{order_id}/send-receipt |
| Payments and refunds | List and get at /v1/me/payment-intents and /v1/me/refunds |
| Delivery | List and get at /v1/me/fulfillments, /v1/me/shipments, and /v1/me/packages, plus GET /v1/me/fulfillment-events |
| Invoices | GET /v1/me/invoices, GET /v1/me/invoices/{invoice_id}, its /pdf, GET /v1/me/credit-notes?invoice_id= with each note's PDF, and POST /v1/me/checkout-sessions with type: invoice |
| Subscriptions | GET /v1/me/subscriptions and GET /v1/me/subscriptions/{subscription_id}. PATCH the subscription to change the card, delivery, or billing interval, or to undo a scheduled cancellation. POST to its /pause, /resume, /cancel, /skip-cycle, /renew, /change-plan, /change-quantity, and /payment-retries. PATCH a line at /line-items/{subscription_line_item_id} to swap its variant. POST /v1/me/subscription-previews estimates the next renewal, a plan change, or a quantity change, or lists delivery options. |
| Returns | POST /v1/me/return-previews, list, create, and get at /v1/me/returns, POST /v1/me/returns/{return_id}/cancel, and GET /v1/me/return-resolutions/{return_resolution_id}. Pay a resolution's balance with POST /v1/me/checkout-sessions and type: return_resolution. |
| Gift cards | Save, list, get, and remove at /v1/me/gift-cards; list history at /v1/me/gift-card-transactions?gift_card_id={gift_card_id} |
| Account deletion | Create, list, and get at /v1/me/deletion-requests |
The customer account reference has every route's parameters and errors. The /v1/me/flint-wallet/cards routes serve only Flint's hosted account, for cards saved with Flint, and answer customer sessions with 404.
Several guides describe a buyer job in depth: buyer-initiated Returns, buyer subscription changes, invoice pages, and account deletion. Use the /v1/me route with the customer session wherever they show a merchant route with customer_id.
For a "Download receipt" button, call GET /v1/me/orders/{order_id}/receipt-pdf from your server with the buyer's customer session and pass the application/pdf response through. It works once the order has a successful payment or gift card redemption, even after a refund, and returns 409 ACTION_NOT_ALLOWED with reason status_not_reached before then. An order paid only by a recorded cash, check, or wire payment returns reason unsupported_state; send that buyer to the invoice PDF. A session opened from an order access link can download that order's receipt too. See Receipts and buyer links.
Show what the buyer can do next#
Orders, subscriptions, invoices, and Returns read through /v1/me carry buyer_actions. It lists every action the resource has, in a fixed order, with whether the buyer can take it now, whether the store needs them to, and by when. Flint works it out with the same rules it enforces when the request arrives, including your store's buyer_capabilities, so your pages don't reimplement them.
| Resource | kind values, in order |
|---|---|
| Order | start_return, resend_receipt |
| Subscription | cancel, pause, resume, reactivate, update_payment_method, retry_payment, update_delivery, skip, update_billing_interval, update_quantity, swap_items, change_plan, renew |
| Invoice | pay |
| Return | withdraw, ship_items, pay_balance |
The update_quantity action points to POST /v1/me/subscriptions/{subscription_id}/change-quantity. Use the subscription's frozen line_items to find its adjustable line and min_quantity and max_quantity. Send that line's subscription_line_item_id and quantity, billing_starts: "period_end" or eligible "prorated_now", and optional expected_version, with an Idempotency-Key. Physical quantities use period_end. A full customer session is required. Pending quantities use scheduled_plan_change and cancel with PATCH {"scheduled_plan_change": null}. The existing buyer PATCH quantity remains available under its existing rules.
An active subscription that ships, at a store that turned pausing off and kept the default cancellation settings, with one offered billing interval, no frozen adjustable line, no item swaps, and no plan_change_options, whose card expires before the next charge, reads:
"buyer_actions": [
{
"kind": "cancel",
"is_available": true,
"is_required": false,
"cancel": { "cancellation_reasons": [], "timing": "end_of_period" }
},
{ "kind": "pause", "is_available": false, "is_required": false, "unavailable_reason": "store_policy" },
{ "kind": "resume", "is_available": false, "is_required": false, "unavailable_reason": "not_in_state" },
{ "kind": "reactivate", "is_available": false, "is_required": false, "unavailable_reason": "not_in_state" },
{ "kind": "update_payment_method", "is_available": true, "is_required": true, "due_at": "2026-11-01T00:00:00Z" },
{ "kind": "retry_payment", "is_available": false, "is_required": false, "unavailable_reason": "not_in_state" },
{ "kind": "update_delivery", "is_available": true, "is_required": false },
{ "kind": "skip", "is_available": true, "is_required": false },
{ "kind": "update_billing_interval", "is_available": false, "is_required": false, "unavailable_reason": "store_policy" },
{ "kind": "update_quantity", "is_available": false, "is_required": false, "unavailable_reason": "store_policy" },
{ "kind": "swap_items", "is_available": false, "is_required": false, "unavailable_reason": "store_policy" },
{ "kind": "change_plan", "is_available": false, "is_required": false, "unavailable_reason": "store_policy" },
{ "kind": "renew", "is_available": true, "is_required": false }
]
Render from it:
- Show what needs attention. An action with
is_required: trueis one the store needs the buyer to take, bydue_atwhen there is a deadline: a card to replace before the next charge, an invoice that's due, items to send back. - Pick the primary button. Use the first available action.
- Build controls from the options. An available
cancel,pause, orpay_balanceentry carries an object of the same name with the choices it accepts. See Build cancel and pause controls and Pay a Return balance. Theretry_paymententry carriesremaining_retries,max_retries, and anyactive_subscription_payment_retry_idwhenever the subscription ispast_due, including when unavailable. Other kinds carry no options. - Explain what's out of reach.
unavailable_reasonis present exactly whenis_availableisfalse:not_in_state,store_policy,limit_reached(the skip or payment retry limit),in_progress(an action already running),window_closed,nothing_to_return,collection_unavailable,delivery_hold, orsign_in_required. Bothkindandunavailable_reasoncan gain values, so show a general message for one you don't recognize. - Read one order before offering a return. A list of orders leaves
start_returnout, because only a read of one order checks return eligibility.
renew reads delivery_hold while the subscription has an active or upcoming delivery hold. Read delivery_hold or upcoming_delivery_hold for the cause and who can fix it, and offer the available delivery update action. Reload the subscription after the delivery problem is resolved before offering order now.
sign_in_required appears only in Flint's hosted account, on sessions an email link opens for one order, subscription, or Return. Sessions you create with POST /v1/customer-sessions never get it. change_plan reads it on any such link, including a subscription_manage link, because a plan change can charge the buyer. Merchant order and subscription reads omit buyer_actions.
For a past-due subscription, show retry_payment.remaining_retries out of max_retries when some retries have been used. Retries started by the store count too. The count starts again when a later billing period becomes past due. If active_subscription_payment_retry_id is present, show processing and poll GET /v1/me/subscriptions/{subscription_id}/payment-retries/{subscription_payment_retry_id} until succeeded or failed. Do this on page load as well as after Pay; don't show a payment-failed message while it runs. A missing options object from an older server means the count is unknown.
When inventory_wait is present, show that the next shipment is waiting for stock. The field contains started_at only. Show that an already-paid delivery has no additional charge when remaining_prepaid_deliveries is above zero. For a renewal, say the charge happens when the shipment can go out. Offer skip and cancel when available, and the store's contact. A stock wait does not require changing the card, unless the card itself needs replacing.
Build cancel and pause controls#
When a subscription's cancel or pause entry is available, it carries the choices this subscription accepts, worked out from your store's settings and the subscription's state:
"buyer_actions": [
{
"kind": "cancel",
"is_available": true,
"is_required": false,
"cancel": {
"cancellation_reasons": ["too_expensive", "unused", "switched_service", "other"],
"timing": "buyer_chooses",
"retention_offer": { "kind": "pause_instead", "pause_duration_cycles": 2 }
}
},
{
"kind": "pause",
"is_available": true,
"is_required": false,
"pause": { "max_pause_duration_cycles": 3 }
}
]
Reasons. cancel.cancellation_reasons lists the reasons to offer, in the store's order. Send the one the buyer picks as cancellation_reason_code. A reason is always optional, and an empty list means don't ask.
Timing. cancel.timing says what to send as cancel_immediately:
timing | What to build |
|---|---|
end_of_period | One cancel button. Omit cancel_immediately. The subscription ends at its next boundary: current_period_end_at, the end of a trial, or in place of the next payment retry of a past-due subscription. |
buyer_chooses | Let the buyer pick. Send cancel_immediately: true to end it now, or omit it to end at the boundary. |
immediately | One button that ends it now. Send cancel_immediately: true. The subscription has no boundary to wait for, as when it's paused. An active subscription whose delivery hold has passed its period end also reads immediately, and ends now even without the flag. |
timing can gain values. For one you don't recognize, show one cancel button that omits cancel_immediately, and resend with true if Flint answers with reason period_end_unavailable.
curl -X POST https://api.withflintpay.com/v1/me/subscriptions/sub_1kmn0aExample/cancel \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: cancel-sub_1kmn0aExample-1" \
-d '{ "cancellation_reason_code": "too_expensive", "expected_version": 7 }'
{
"data": {
"subscription_id": "sub_1kmn0aExample",
"status": "active",
"cancel_at_period_end": true,
"scheduled_cancel_at": "2026-11-28T17:00:00Z",
"cancellation_reason": "buyer",
"version": 8
},
"request_id": "req_01KWM6P19KJRRC7B8BBEAQQ1KB"
}
A cancellation set for the end of the period sends subscription.cancellation_scheduled, with cancellation_details.requested_by set to buyer. To undo it, send {"cancel_at_period_end": false} with PATCH /v1/me/subscriptions/{subscription_id} while reactivate is available; that sends subscription.reactivated. Webhooks for buyer changes lists the rest.
Retention offer. cancel.retention_offer appears only when the store offers a pause instead of canceling and that pause is available now. To accept it, call POST /v1/me/subscriptions/{subscription_id}/pause with its pause_duration_cycles. The buyer can always decline and cancel. Ignore an offer kind you don't recognize.
Pause length. When pause.max_pause_duration_cycles is present, pause_duration_cycles is required, from 1 to that value. When it's absent, the buyer can choose a length, or you omit pause_duration_cycles to pause until they resume.
Resume. POST /v1/me/subscriptions/{subscription_id}/resume applies only to a paused subscription. It returns 202 Accepted with Retry-After: 2, and the subscription stays paused with resume_requested_at set until Flint applies the request. Show a pending resume while resume_requested_at is set, and poll the subscription. It clears when Flint resumes the subscription (subscription.resumed) or can't (subscription.updated).
Show and undo a pending plan change#
period_end keeps the current plan until the next renewal Flint charges; next_renewal changes the plan immediately and charges its price from the next payment. A buyer subscription always includes scheduled_plan_change, either null or the frozen target terms with a subscription_plan summary. Show the target and its nullable effective_at as a pending change. Keep access tied to the current subscription_plan_id.
When cancel_plan_change is available, offer "Keep current plan" and send:
curl -X PATCH https://api.withflintpay.com/v1/me/subscriptions/sub_1kmn0aExample \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-d '{"scheduled_plan_change": null, "expected_version": 7}'
Only null is accepted on PATCH. Clear when nothing is pending returns 200 without changing version or sending an event. Buyers can clear only changes with requested_by: "buyer"; a merchant-scheduled change reports store_policy on the action, and a clear returns reason not_offered. The action uses the same session requirement as reactivate.
A pause or skip can move effective_at, and it is null without a next billing date. Order now applies the pending terms before charging. A pending change blocks cadence, quantity, and item swaps with reason plan_change_scheduled; their buyer actions report not_in_state. To replace it, use the buyer change-plan route again.
Refresh the display on subscription.plan_change_scheduled, subscription.plan_change_canceled, and subscription.plan_changed. The first two are subscription snapshots; a change in the effective date alone sends no replacement event. Delivery is at least once and unordered, so deduplicate and re-read current state. Flint sends no plan change email.
When Flint refuses a change#
Your settings and the subscription can change between the buyer's page load and their click, so Flint checks every request again. A change the store doesn't allow returns one of these:
A subscription whose own status or schedule refuses the action returns 409 ACTION_NOT_ALLOWED too, with details[0].current_status set to its status and remediation.retry set to none. Don't offer an action that reads not_in_state; the error is for a subscription that changed after the buyer loaded your page. Branch on details[0].reason:
reason | What to show the buyer |
|---|---|
terminal_status | The subscription is canceled. Show it as ended, and offer a new subscription. |
cancellation_scheduled | It's set to cancel at the end of the period, so pausing, resuming, Order now, and a new payment retry are refused. Offer to keep it first. |
period_end_unavailable | A cancellation without cancel_immediately on a subscription with no boundary. Send cancel_immediately: true. |
not_paused | Resume on a subscription that isn't paused. Reload it. |
payment_required | Resume on a past_due subscription. Recover the payment instead. |
delivery_hold or inventory_wait | A payment retry during a delivery hold or while the renewal waits for stock. Ask the buyer to fix delivery, or to wait. |
trial_in_progress, external_billing_schedule, or in_progress | Order now during a trial, on a schedule your integration owns, or while a renewal payment runs. A skip on a schedule your integration owns also returns external_billing_schedule. Hide the action. |
field_locked | A pause on a paused subscription with a different pause_duration_cycles. Resume it first. |
unsupported_state | Any other status that doesn't allow the action. Reload the subscription. |
Flint can add reasons. For one you don't recognize, reload the subscription and render it from buyer_actions. When a subscription refuses an action lists which states refuse each action.
Recover a past-due subscription#
A past_due subscription's renewal payment failed. Its update_payment_method action is required, and retry_payment is available when another attempt is allowed. Let the buyer fix the card, then retry:
- Change the card if needed. Send
payment_method_idwithPATCH /v1/me/subscriptions/{subscription_id}. The card must beactive: a card whose setup hasn't finished returns409 ACTION_NOT_ALLOWEDwith reasonstatus_not_reached. Wait until it's active, then send the request again. The refusal'snext_stepssays whether you can reuse itsIdempotency-Key. - Keep the subscription if a cancellation is scheduled. A buyer retry while cancellation is scheduled returns
409 ACTION_NOT_ALLOWEDwith reasoncancellation_scheduled. Send{"cancel_at_period_end": false}with the samePATCH, in the same request aspayment_method_idif you like. The subscription stayspast_due. - Start the retry.
POST /v1/me/subscriptions/{subscription_id}/payment-retrieswith no body, or{}.Idempotency-Keyis required; reuse it if the response is lost.
curl -X POST https://api.withflintpay.com/v1/me/subscriptions/sub_1kmn0aExample/payment-retries \
-H "Authorization: Bearer flint_cses_example" \
-H "Idempotency-Key: recover-sub_1kmn0aExample-1"
{
"data": {
"subscription_payment_retry_id": "spr_1kmn0aExample",
"subscription_id": "sub_1kmn0aExample",
"status": "pending",
"created_at": "2026-10-28T17:00:00Z",
"updated_at": "2026-10-28T17:00:00Z"
},
"request_id": "req_01KWM6P19KJRRC7B8BBEAQQ1KC"
}
Poll GET /v1/me/subscriptions/{subscription_id}/payment-retries/{subscription_payment_retry_id} until it finishes:
status on buyer subscription payment retryEvery retry, whether the buyer or you started it, sends subscription_payment_retry.created, then subscription_payment_retry.succeeded or subscription_payment_retry.failed, each with the retry as data.object. Use them to update your page or email the buyer without polling. See the webhook events catalog.
One retry can run at a time, and a buyer can start one while fewer than 3 have been created in the current billing period, counting retries the store started. Past those limits, Flint returns 409 ACTION_NOT_ALLOWED with reason in_progress, or 409 LIMIT_REACHED with reason payment_retries_per_period. Flint checks the Idempotency-Key first, so a reused key returns its original retry even after a limit is reached. To find a retry after a lost response, list GET /v1/me/subscriptions/{subscription_id}/payment-retries?idempotency_key=....
Profile, addresses, and email preferences#
PATCH /v1/me changes the buyer's name, phone, and default_payment_method_id. It rejects address fields: the profile's billing_address and shipping_address are read-only copies of the buyer's default saved addresses, always present, and null when no saved address holds that default.
Saved addresses and defaults#
Create an address with POST /v1/me/addresses. recipient_name and address are required, and a US address needs state and postal_code. When creating or replacing a saved US or Canadian address, send a state, province, or territory that belongs to its country: a code such as TX or ON, an ISO-prefixed code such as US-TX or CA-ON, or a name such as Texas or Ontario. Matching ignores case and surrounding whitespace; US military codes AA, AE, and AP are accepted too. An invalid subdivision returns 400 INVALID_REQUEST at address.state with detail code INVALID_VALUE. Ask the buyer to correct it before trying again. Other countries have no subdivision membership check, and Flint doesn't check whether postal codes exist.
For example:
curl -X POST https://api.withflintpay.com/v1/me/addresses \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: address-cus_1kmn0aExample-1" \
-d '{
"recipient_name": "Maya Chen",
"label": "Home",
"address": {
"line1": "2100 Main St",
"city": "Irvine",
"state": "CA",
"postal_code": "92614",
"country": "US"
},
"is_default_shipping": true
}'
An address becomes a default only when you send is_default_billing or is_default_shipping as true, at creation or later with PATCH /v1/me/addresses/{customer_address_id}, and that includes the buyer's first address. The address that held the default loses it. Sending false in the PATCH clears a default the address holds, and changes nothing on an address that doesn't hold it. A PATCH that sends address replaces the whole postal address, so send every field you want to keep.
Flint uses the defaults: the billing default is the tax location for orders and subscription renewals that have no other, and a Flint-hosted checkout for a linked customer prefills a missing billing or shipping address from them. An address you send in the checkout's prefill still takes priority.
DELETE /v1/me/addresses/{customer_address_id} returns the address as it was, and a later GET of it returns 404. Deleting a default, or clearing it, leaves the buyer without that default. Flint doesn't choose another saved address, so ask the buyer to pick one when your pages need it.
Email preferences#
GET /v1/me/email-preferences says which of your optional emails the buyer's address receives: shipping_updates and checkout_reminders. A category the buyer never changed is on. PATCH with {"checkout_reminders": false} turns one off and leaves the other as it is. Receipts and other transactional email always send.
The response includes the buyer's current email. The setting belongs to that address, the same one Flint's unsubscribe links change, so it also covers guest checkouts with that address. A customer without an email has no email preferences, and both routes return 404 RESOURCE_NOT_FOUND with an explanation that an email is required. Your server can read the same preferences with GET /v1/customers/{customer_id}/email-preferences, or look up any address with POST /v1/email-preferences/lookup and email in the JSON body. Both merchant reads need customers.read; lookup returns the same shape, with customer_id and version as null for a guest. They don't change preferences. For a buyer who arrives from an unsubscribe link without signing in, see Unsubscribe without sign-in.
Avoid overwriting another change#
The buyer can have your account open in two tabs, your support team can edit the same customer, and an unsubscribe link can change a preference while the page is open. The profile, each saved address, and the email preferences return a version for this. Keep the version from the read your form started from, and send it as expected_version when the buyer saves. Don't take it from a background refresh, or the save could overwrite a change the buyer never saw.
curl -X PATCH https://api.withflintpay.com/v1/me/email-preferences \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: prefs-cus_1kmn0aExample-2026-10-28-1" \
-d '{ "expected_version": 3, "checkout_reminders": false }'
{
"data": {
"customer_id": "cus_1kmn0aExample",
"email": "maya@example.com",
"shipping_updates": true,
"checkout_reminders": false,
"version": 4
},
"request_id": "req_01KWM6P19KJRRC7B8BBEAQQ1KD"
}
| Request | Checks the version of |
|---|---|
PATCH /v1/me | The customer |
PATCH /v1/me/addresses/{customer_address_id}, and DELETE with ?expected_version= | That address |
PATCH /v1/me/email-preferences | The email preferences, one version for both categories |
A request that sends both email categories saves both or neither, so take both toggles from the response. Setting a default address advances the new default, the address that lost it, and the customer.
When something changed since your read, the request returns 409 VERSION_CONFLICT and saves nothing. Keep what the buyer entered, read the resource again, show the buyer what changed, and save what they confirm with the new version and a new Idempotency-Key. expected_version is optional on every one of these routes.
Email change uses codes only#
When the buyer changes their email, you start the change with POST /v1/me/email-change-requests and new_email. Flint emails a six-digit code to the current address and another to the new one. With merchant_hosted, those emails carry only the code and no confirmation link, so ask for the codes on the page where the buyer started the change:
curl -X POST https://api.withflintpay.com/v1/me/email-change-requests/cecr_1kmn0aExample/confirm \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-d '{ "current_email_code": "482913", "new_email_code": "730215" }'
Read GET /v1/me/email-change-requests to recover the current pending request after a page reload. It returns zero or one request and has no pagination. Read GET /v1/me/email-change-requests/{email_change_request_id} to recover a lost confirmation response: after signing in with the new email, status: "confirmed" identifies the completed change. Confirmation immediately removes the request's personal data, so new_email is null on that read. Read GET /v1/me for the account's current email. Superseded requests return not found.
A wrong code returns 400 INVALID_REQUEST; param names current_email_code or new_email_code, with the current address reported first when both are wrong.
Send current_email_code when the change request's current_email_confirmation_required is true; a customer with no email confirms only the new address. Codes work for 30 minutes and 8 wrong tries, and a buyer can start 3 changes in 15 minutes.
A confirmed change ends the buyer's access to your store on all devices. Flint revokes the customer's sessions and emailed access links at your store, including the session that confirmed. The buyer stays signed in to Flint and their other stores. Sign the buyer in again with the new email and create a new customer session.
With merchant_hosted, you can also change the email yourself, for example after your own login confirms the new address: send email with PATCH /v1/customers/{customer_id}. That revokes the buyer's customer sessions and emailed access links, cancels a change they had started, and sends customer.updated. In flint_hosted mode, PATCH can set, correct, or clear an email until the buyer authenticates or verifies ownership. After that, use an email change request, including when setting a missing email.
Let the buyer add a card#
Adding a card never needs a Flint call from the browser. Your backend starts the save with the customer session, and the browser talks only to Stripe:
curl -X POST https://api.withflintpay.com/v1/me/payment-methods \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: add-card-cus_1kmn0aExample-1" \
-d '{ "type": "card" }'
{
"data": {
"payment_method_id": "pm_1kmn0aExample",
"customer_id": "cus_1kmn0aExample",
"type": "card",
"status": "pending",
"usage": "off_session",
"is_default": false,
"client_setup": {
"stripe": {
"account_id": "acct_1kmn0aExample",
"publishable_key": "pk_test_1kmn0aExample",
"setup_intent": {
"client_secret": "seti_1kmn0aExample_secret_example",
"stripe_js_call": "confirm_setup"
}
}
}
},
"request_id": "req_01KWM6P19KJRRC7B8BBEAQQ1KE"
}
Hand client_setup.stripe to your page. It loads Stripe.js with publishable_key and account_id, mounts the Payment Element with the setup intent's client_secret, and performs the named stripe_js_call, as Collect the card in the browser shows. Use the publishable key from the response rather than a hardcoded one: it's Flint's platform key for the current payment mode, not a key you own.
The card starts pending and becomes active when the processor confirms, which Flint reports with payment_method.activated rather than in the create response. Don't show the card as usable, make it the default, or put it on a subscription until then. Handle the webhook, or poll GET /v1/me/payment-methods/{payment_method_id} until status is active.
GET /v1/me/payment-methods lists cards in every status except archived, so it includes pending, failed, and expired ones. Add status=active where the buyer picks a card to pay with or a default. Each card carries is_default, so the list needs no second read. DELETE /v1/me/payment-methods/{payment_method_id} returns the card with status: "archived", and deleting it again returns the same.
Set the default with PATCH /v1/me:
curl -X PATCH https://api.withflintpay.com/v1/me \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: default-card-cus_1kmn0aExample-1" \
-d '{ "default_payment_method_id": "pm_1kmn0aExample", "expected_version": 3 }'
The card must be one of the buyer's own active cards with usage: "off_session", so a card the buyer saved in checkout for faster payment can't be the default. A card that isn't theirs returns 404. Send null to clear the default. Each change, including deleting the default card, advances the customer's version and sends customer.updated; sending the current default changes nothing.
Show orders and deliveries#
GET /v1/me/orders lists the buyer's orders, newest first. It takes buyer-visible filters such as status, fulfillment_status, and query, which searches the order ID, order number, buyer note, and line item names.
List a subscription's receipts#
Every paid subscription charge is an order with a numbered PDF receipt. To show a subscription's charges with a download link on each, filter the buyer's orders by the subscription. There is no separate receipt list.
curl "https://api.withflintpay.com/v1/me/orders?subscription_id=sub_1kmn0aExample" \
-H "Authorization: Bearer flint_cses_example"
Each order's subscription_cycle says which cycle it charged, and its order_number is the receipt number. For each row, call GET /v1/me/orders/{order_id}/receipt-pdf from your server and pass the PDF through, as in what the buyer can do. The receipt shows the plan name, cycle, and paid period, plus your tax identity and the buyer's. Flint records both tax identities when the charge is paid, so a tax ID the buyer adds later appears only on later charges.
An order with no successful payment or gift card redemption, such as a zero-amount order that only ships an already-paid cycle, returns 409 ACTION_NOT_ALLOWED instead of a PDF, so check the order's payment state before you show a link. Download receipts lists which subscription charges have one.
Read one payment, refund, delivery, or resolution#
Other buyer resources carry IDs you can open, such as a package's shipment_id or a Return's return_resolution_ids. Each of these has a read for one record:
GET /v1/me/payment-intents/{payment_intent_id}GET /v1/me/refunds/{refund_id}GET /v1/me/fulfillments/{fulfillment_id}GET /v1/me/shipments/{shipment_id}GET /v1/me/packages/{package_id}GET /v1/me/return-resolutions/{return_resolution_id}
They take no query parameters: any parameter, including expand, returns 400 INVALID_REQUEST with param naming it. An ID that doesn't exist, belongs to another buyer, or is in the other environment returns 404 RESOURCE_NOT_FOUND, with param and details[0].resource_type naming the resource you asked for, so a shipment or package error never reveals its order. A payment read through a customer session has no processor client secret and no collection details, so it can't take a payment.
Show delivery history#
GET /v1/me/fulfillment-events?order_id=... lists what happened to an order's deliveries, newest first, so your order page can show a tracking timeline. order_id is required. Narrow it with fulfillment_id, shipment_id, or package_id, and page with page_size and page_token.
curl "https://api.withflintpay.com/v1/me/fulfillment-events?order_id=ord_1kmn0aExample" \
-H "Authorization: Bearer flint_cses_example"
{
"data": [
{
"fulfillment_event_id": "fev_1kmn0aExample",
"order_id": "ord_1kmn0aExample",
"fulfillment_id": "ful_1kmn0aExample",
"shipment_id": "shp_1kmn0aExample",
"event_type": "status_changed",
"previous_status": "in_transit",
"current_status": "delivered",
"location_description": "Austin, TX",
"occurred_at": "2026-10-03T18:42:00Z",
"created_at": "2026-10-03T18:42:05Z"
}
],
"request_id": "req_01KWM6P19KJRRC7B8BBEAQQ1KF"
}
Each event has fulfillment_event_id, order_id, fulfillment_id, event_type, occurred_at, and created_at, plus shipment_id, package_id, previous_status, current_status, and location_description when they apply. The buyer view leaves out what only you should see, such as your fulfillment partner's identifiers, custom details, and reasons, and reports a held fulfillment as pending.
Invoices and Return balances#
Show an invoice document#
GET /v1/me/invoices/{invoice_id} returns the document your invoice page renders: ordered issue_rows and balance_rows, the payment_options the buyer can use, collection_mode, and your branding and support details. active_payment_attempt appears while a payment is under way. GET /v1/me/invoices leaves these document fields out. Draft invoices never appear to buyers.
Render the rows in order and keep rows with is_informational: true out of your sums. Show the returned balances rather than working out payment state from the rows. Build your own invoice page has an example, and Read an invoice document lists every field.
An invoice's own access token, from its emailed link, can also read that invoice, download its PDF and credit notes, and start its checkout, without a customer session. It can't list invoices or read another one.
Pay an invoice#
A customer session can't charge a card, in your account or in Flint's. Paying an invoice, or a balance on a Return, goes through a checkout session:
curl -X POST https://api.withflintpay.com/v1/me/checkout-sessions \
-H "Authorization: Bearer flint_cses_example" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: pay-inv_1kmn0aExample-1" \
-d '{
"type": "invoice",
"invoice_id": "inv_1kmn0aExample",
"return_url": "https://cedarandstone.com/account/invoices/inv_1kmn0aExample"
}'
The response's data is the checkout session. It's 201 when Flint creates the session and 200 when it returns the open one again; read the invoice again with GET /v1/me/invoices/{invoice_id}. The session is hosted unless you send "surface": "headless": redirect the buyer to data.url. Hosted launches omit checkout_auth_token; headless launches return it instead of a hosted URL. To take the payment on your own page, see Collect an invoice or a return balance, including how page_origin works for these launches.
Offer the checkout while the invoice's pay action is available. While a payment is under way, such as a bank debit that hasn't cleared or an automatic charge to a saved card, the invoice stays open with its balance due, pay reads not_in_state in both the read and the list, and active_payment_attempt shows the payment. A checkout the buyer opened and left unpaid keeps pay available, and the create returns that checkout.
return_url is optional and brings the buyer back to your account after paying. With merchant_hosted, it must be an HTTPS address on the host of your merchant_account_url, or Flint returns 400 INVALID_REQUEST on return_url. In test mode, http://localhost and other loopback addresses, on any port, also work. Once a payment starts on the session, it keeps the return_url it has.
Pay a Return balance#
A Return whose buyer owes money, such as an exchange for something more expensive, has an available, required pay_balance entry in its buyer_actions. It lists the resolutions to pay, oldest first:
{
"kind": "pay_balance",
"is_available": true,
"is_required": true,
"pay_balance": { "return_resolution_ids": ["retres_1kmn0aExample"] }
}
Read each resolution to show what the buyer owes in buyer_payment_amount_money:
curl https://api.withflintpay.com/v1/me/return-resolutions/retres_1kmn0aExample \
-H "Authorization: Bearer flint_cses_example"
Then create a checkout session for each one the buyer pays, with POST /v1/me/checkout-sessions, sending type: return_resolution and the return_resolution_id. It takes the same return_url rules as an invoice and returns the checkout session itself. A hosted launch returns data.url and omits checkout_auth_token; a headless launch returns data.checkout_auth_token and no hosted URL. The Return's completion_blockers name the same resolutions with resolution_pending or resolution_requires_action.
pay_balance reads not_in_state when nothing is owed, or when no resolution can collect its balance in checkout yet. Return resolutions covers what happens when the payment fails.
Saved gift cards#
A buyer can save a gift card to follow its balance and anonymous history. POST /v1/me/gift-cards needs proof that they hold it: {"credential_type": "code", "code": "..."} for a code they typed, or {"credential_type": "recipient_access", "grant_id": "...", "recipient_access_token": "..."} from the private recipient link. Parse a pasted link on the page, without fetching it, and keep codes and tokens out of URLs, browser storage, and logs. Saving doesn't give the buyer ownership or let them spend the card from the account.
Cards assigned to the authenticated buyer by customer_id, including refund and Return store credit, appear alongside saved cards. Read either card's anonymous history with GET /v1/me/gift-card-transactions?gift_card_id={gift_card_id}. The list takes page_size and page_token. Keep the same gift_card_id on later pages.
Offer Remove when the card returns can_remove: true. DELETE /v1/me/gift-cards/{gift_card_id} removes that buyer's saved access. After that the buyer gets 404 for the card. Save a card in a buyer account has the rest of the rules.
Point Flint's email at your pages#
Flint's receipts, delivery updates, subscription and dunning email, Return email, invoices, and unsubscribe links all link to a customer account. Set customer_account.mode to merchant_hosted so they open yours:
curl -X PATCH https://api.withflintpay.com/v1/settings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: account-url-1" \
-d '{
"customer_account": {
"mode": "merchant_hosted",
"merchant_account_url": "https://cedarandstone.com/account",
"route_templates": {
"order": "/orders/{resource_id}",
"subscription": "/subscriptions/{resource_id}",
"return": "/returns/{resource_id}",
"invoice": "/invoices/{resource_id}",
"email_preferences": "/email-preferences"
}
}
}'
Each route template is a path under merchant_account_url. The order, subscription, return, and invoice templates contain {resource_id} exactly once, and email_preferences has no placeholder. A resource without a template links to merchant_account_url itself. The invoice page is where the "Pay invoice" button in Flint's invoice email lands, so let the buyer pay from it.
Links resolve when the buyer clicks, so the setting also repoints email sent before you launched your account. Saving merchant_account_url registers its hostname as a payment method domain, and the save waits for that domain to be active. Build your own account instead covers the URL and template rules, switching modes, and the errors a save can return.
Keep the link through sign-in#
The buyer usually arrives signed out. Flint adds flint_ query parameters to every link it sends to your pages, and they're what take the buyer to the right page once they sign in:
https://cedarandstone.com/account/orders/ord_1kmn0aExample?flint_action=view&flint_merchant_id=mer_1kmn0aExample&flint_mode=live&flint_resource_id=ord_1kmn0aExample&flint_resource_type=order&flint_source=order_receipts
- Buyer sends opens View order in a receipt to Flint
- Flint returns redirect to your order route with flint_ parameters to Buyer
- Buyer sends GET /account/orders/ord_... to Your site
- Your site returns sign-in page, with the requested path saved to Buyer
- Buyer sends signs in to Your site
- Your site sends POST /v1/customer-sessions to Flint
- Your site sends GET /v1/me/orders/ord_... with the secret to Flint
- Flint returns the order, or 404 to Your site
- Your site returns the order page to Buyer
- Before you redirect to your login, save the path and query string of the page the buyer asked for, as a relative path you've checked is on your own site.
- After login, send the buyer back to that saved path with the
flint_parameters still on it. - Use
flint_modeandflint_environment_idto choose the live or sandbox API key for the buyer's customer session. Then open the resource thatflint_resource_typeandflint_resource_idname through/v1/me, such asGET /v1/me/orders/{order_id}. - On
404, the resource belongs to another buyer or doesn't exist. Show the account home, not an error that says which.
| Parameter | Value |
|---|---|
flint_merchant_id | Your merchant ID. |
flint_resource_type | order, subscription, return, invoice, email_preferences, or account for a link to the account itself. |
flint_resource_id | The ID of the order, subscription, Return, or invoice. Omitted for email_preferences and account. |
flint_action | view for an order or invoice, manage for a subscription, Return, or email preferences, and home for the account. |
flint_buyer_action | The control the email asked the buyer to use: skip, update_delivery, or pause. Only on subscription links that carry one. It matches a kind in the subscription's buyer_actions. |
flint_mode | live, or sandbox for a link from a sandbox. |
flint_environment_id | The sandbox the link came from. Present only when flint_mode is sandbox. |
flint_source | The email family that sent the link, such as order_receipts or invoices. Omitted for unsubscribe links and for email no family covers, such as refund receipts. |
Flint can add resource types, actions, and sources. Send the buyer to your account home for a value you don't recognize.
Emailed links are routing hints#
The flint_ parameters prove nothing. The customer session you create for the signed-in buyer decides what they can see, and Flint checks each request. Before you show the control flint_buyer_action names, read the subscription with the buyer's session and check that the matching buyer_actions entry is available.
In Flint's hosted account, an email link can open a session limited to the linked order, subscription, or Return, so a buyer can act on it without signing in. Those sessions exist only in Flint's account. With merchant_hosted, a link carries no grant and opens no session: you sign the buyer in with your own login and create a full customer session with POST /v1/customer-sessions.
Unsubscribe without sign-in#
Flint's shipping update and checkout reminder emails carry an unsubscribe link. With merchant_hosted, it opens your email_preferences page, and the buyer has to be able to use it without signing in. Don't put that page behind your login: a sign-in redirect can drop the token.
The emailed link goes to Flint first, which sends the buyer on to your page with a token in the URL fragment, never in the path or query string:
https://cedarandstone.com/account/email-preferences?flint_action=manage&flint_merchant_id=mer_1kmn0aExample&flint_mode=live&flint_resource_type=email_preferences#flint_email_preference_token=...
Browsers don't send the fragment to your server, so read it in the page's script, remove it from the address bar, and post it to your backend:
const params = new URLSearchParams(window.location.hash.slice(1));
const token = params.get("flint_email_preference_token");
history.replaceState(null, "", window.location.pathname + window.location.search);
const response = await fetch("/account/email-preferences/lookup", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ token }),
});
Your backend redeems the token with the API key of the environment the link came from, named by flint_mode and flint_environment_id. The token is a credential: it goes in the request body and stays out of logs and URLs.
curl -X POST https://api.withflintpay.com/v1/email-preference-links/unsubscribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "token": "flint_email_preference_token_example" }'
{
"data": {
"email": "maya@example.com",
"email_preference": "shipping_updates",
"enabled": false,
"customer_id": "cus_1kmn0aExample"
},
"request_id": "req_01KWM6P19KJRRC7B8BBEAQQ1KG"
}
emailis the address the email went to. Show it, so the buyer knows which address they're unsubscribing.email_preferenceis the preference the link controls, such asshipping_updatesorcheckout_reminders, the same names as/v1/me/email-preferences. Show a general label for a value you don't recognize.enabledis the preference's current state for that address.customer_idisnullwhen no customer has the address, as for a guest.- A token that is malformed, unknown, from another merchant, or from the other environment returns
404 RESOURCE_NOT_FOUND, and the error never says which. - Customer sessions and publishable keys can't call these routes.
Mail apps with their own unsubscribe button use the email's one-click List-Unsubscribe-Post header, as RFC 8058 defines. Flint handles those requests directly and sends customer_email_preferences.updated when a customer's preference changes. If you send your own shipping updates or checkout reminders, subscribe to that event and honor the opt-out. Guest changes send no event, so look up the address before each guest send. See Honor unsubscribes in email you send.
Link a buyer's guest purchases#
A buyer who checked out as a guest has orders with their email and no customer. That includes a guest who typed the email of a customer that already existed: a typed email never attaches an order to an existing customer, so the order stays unlinked and out of that customer's /v1/me and hosted account until the buyer claims it. Once they sign in, you can attach those purchases to their customer, after Flint confirms they control the email. A signed-in session isn't proof that they own an email address, and neither is an email or order ID they type.
status on customer verificationA verification links once. After a lost response, repeat the link request with the same Idempotency-Key to get the first result.
Read the current state from your server before linking, or recover it after a page reload, with an API key that has customers.read or customers.write:
curl https://api.withflintpay.com/v1/customer-verifications/cver_1kmn0aExample \
-H "Authorization: Bearer YOUR_API_KEY"
Reading before linking is optional. Linking checks that the verification is still confirmed, the customer's email has not changed, and the purpose is link_guest_purchases.
To find a customer's verifications, send GET /v1/customer-verifications?customer_id=cus_1kmn0aExample. customer_id is required. The list includes every status, ordered by created_at descending, then customer_verification_id descending. Use page_size and page_token to continue through it.
Both reads return the same fields as create and confirm. Flint computes status and supported_actions when you read. supported_actions is ["confirm"] while a verification is pending and has tries left. It is empty in every other case, including a pending verification whose 5 tries are used. Once a code is confirmed, expires_at is the end of the time to link.
Flint deletes a verification 8 days after its code and its time to link have expired. Customer deletion also removes the customer's verifications. Reading a deleted or unknown ID returns 404 RESOURCE_NOT_FOUND, and the list no longer includes it.
Errors when you send, confirm, or read a verification:
Flint checks a verification's state before it compares the code, and details[0].current_status carries that state on each ACTION_NOT_ALLOWED 409.
Errors when you link:
What /v1/me refuses#
/v1/me isn't the merchant API with a filter added. Reads are trimmed to what a buyer should see, and writes to what a buyer should be able to do.
customer_idis rejected, not ignored. Acustomer_idin the query string, or anywhere in a JSON body, returns400 INVALID_REQUESTwith detail codeNOT_ALLOWEDandparam: customer_id. Ignoring it would let a caller believe they had scoped a request when they hadn't.- Another buyer's resource returns
404, not403, so the namespace never confirms that someone else's ID exists. expandisn't available. Buyer responses already include what an account page needs: a subscription read includessubscription_plan, the plan's current summary.- Merchant filters are refused. A list filter on a field buyers can't see, such as
external_reference_id, returns400 INVALID_REQUESTwith detail codeUNKNOWN_FIELD. - Merchant fields are left out. For example, a subscription read omits the order and invoice IDs in
inventory_waitand keepsdelivery_holdandupcoming_delivery_hold, so you can warn a buyer before a renewal is held. A Return read through a customer session omits merchantsupported_actions, keeps its buyer tasks inbuyer_actions, and carries only thecompletion_blockersa buyer can clear. A narrowed projection, not an alias lists what each resource omits.
If your account needs something the buyer view doesn't carry, read it on your backend with your API key and decide whether the buyer should see it. Don't put a wider credential in the buyer's request path. Rate limits apply to each session.
Use Flint's account with your own checkout#
You can build your own checkout and keep Flint's hosted account. Leave customer_account.mode as flint_hosted, so Flint's email keeps linking to Flint's account, and connect the two through the customer:
- When you create a customer, set
external_reference_idto your own user ID. To find the customer later, list withGET /v1/customers?external_reference_id=.... - For a signed-in buyer, set
customer_idon the order before checkout, so the purchase appears in their account. A guest's typed email doesn't link the order to an existing customer, so it stays unlinked until the buyer confirms a code in checkout or claims it withlink-guest-purchases, as Build your own checkout describes. - To send a signed-in buyer from your site into their account without a second login, create a link with
POST /v1/customers/{customer_id}/access-linksand redirect the buyer to itsurl. It works for 15 minutes and one open, and only withflint_hosted. See Send a buyer into Flint's account.
Develop locally#
In test mode, merchant_account_url can be http://localhost, http://127.0.0.1, or http://[::1] on any port, so links in sandbox email open the account running on your machine. A loopback URL skips payment method domain registration. Live mode needs HTTPS on a hostname you own.
The return_url for invoice and Return checkout accepts loopback addresses in test mode too.
Next steps#
Customer sessionsCustomer account API referenceCollect an invoice or a return balanceCustomer email deliveryCards saved with Flint when changing email#
An email change applies to this store's customer account. Links in earlier emails stop working after confirmation. Other stores keep the previous email. The Flint account and its saved cards also keep the previous email unless the buyer asks to move them.
Before sending codes, an eligible Flint-hosted account can read GET /v1/me/flint-wallet/cards. When at least one card is returned, offer an unchecked choice to also move the saved cards. Keep the choice until confirmation; don't check the new email for a wallet first.
Send optional move_flint_wallet: true with the codes to POST /v1/me/email-change-requests/{email_change_request_id}/confirm only if the buyer chose to move the cards. Omission and false keep them at the previous email. The confirm result includes flint_wallet_outcome for these sessions when the previous email had saved cards:
| Outcome | What happened |
|---|---|
moved | The cards now belong to the new email. |
kept | The cards stayed at the previous email because no move was requested. |
new_email_has_wallet | The new email already has a Flint wallet, so nothing moved. |
Only a customer session from a live email-code sign-in at a Flint-hosted account can send the choice or receive the outcome. A merchant-created session must omit move_flint_wallet, including false; sending it returns 400 INVALID_REQUEST, detail NOT_ALLOWED, at that field. Merchant credentials never learn whether the buyer has a Flint wallet. Creating an email-change request is unchanged.