Server-confirmed payments
Use this flow to charge an amount on your own page with a standalone PaymentIntent: a balance top-up, a deposit, or a payment for something you track outside Flint. The browser collects the buyer's card, wallet, or bank account with Stripe Elements and turns it into a ConfirmationToken. Your server sends that token to Flint, and Flint confirms the payment.
Your server sends the first confirmation through your risk rules and Flint's idempotency. The create response has no client secret. When the buyer must act, current_payment_action tells you how to complete the step. Flint's API returns a Stripe client secret only when the request sends client_action_type: "stripe", while url is the default; with url, your page never receives one, and Stripe's authentication page receives what it needs to run the challenge. Take the payment outcome from your server. Cards, Apple Pay, Google Pay, ACH debit, and Affirm all use this flow.
If you're selling items, create an order instead. An order carries line items, tax, and totals, and you pay it from your page as Embedded payments describes: pay the order in one call, or confirm its payment intent as Confirm an order payment shows. A checkout session gives you a Flint-hosted page. The overview and Orders first help you choose.
How it works#
- Your server sends POST /v1/payment-intents to Flint
- Flint returns payment_collection to Your server
- Browser sends mount Elements, create a ConfirmationToken to Stripe
- Browser sends the token's ctoken_ ID to Your server
- Your server sends POST /confirm with the token to Flint
- Flint returns status, and current_payment_action if the buyer must act to Your server
- Browser sends Open the Flint authentication URL to Stripe
- Your server sends POST /confirm without payment_source to Flint
- Flint returns the outcome, also sent by webhook to Your server
The calls this guide uses:
Your API key needs payments.payment_intents.write. To save the card as well, it also needs payments.payment_methods.write. Apple Pay and Google Pay buttons appear only on hostnames you've registered.
Take a payment#
Act on the result#
A confirmation that Flint runs returns 200, whether the payment succeeded, needs the buyer, or was declined. Branch on status, not the HTTP status:
status | What happened | What to do |
|---|---|---|
succeeded | The payment was collected. | Fulfill, or wait for payment_intent.succeeded if you fulfill from webhooks. |
requires_capture | A manual capture hold is in place. | Capture or cancel it before authorization_expires_at. |
processing | The payment was submitted, and Flint is waiting for or confirming its outcome. | Wait for payment_intent.succeeded or payment_intent.payment_failed, or read the payment again. Don't start another payment. |
requires_action | The buyer must act, usually for 3D Secure, or to approve an Affirm plan. | Run the buyer action. |
requires_payment_method | The payment was declined or blocked, and last_payment_error says why. | Ask for another payment method. |
Your server can return status and current_payment_action to the browser. Keep your API key and the rest of the payment on the server.
If the processor doesn't answer after Flint sends the confirmation, Flint records the payment as processing and returns 200. Flint resolves the outcome without another confirmation from you, so wait for the payment's events or read it again, and never confirm with a new credential meanwhile. A same-key retry replays that stored 200 response, even after the payment concludes; read the payment or use its events for the current state. If Flint can't save the uncertain outcome, the response is 503 SERVICE_UNAVAILABLE with reason outcome_unknown.
Choose a credential#
The first confirmation sends exactly one payment_source object. Its credential_type selects the credential:
credential_type | Field | Use it for |
|---|---|---|
stripe_confirmation_token | payment_source.stripe.confirmation_token | A ConfirmationToken the browser created from payment_collection.stripe. This is the normal case. |
stripe_payment_method | stripe.payment_method | A processor payment method ID, such as the pm_... that stripe.createPaymentMethod returns. |
payment_method | payment_method_id | A saved payment method that belongs to the PaymentIntent's customer. |
reader | reader_id, optional tip | Presenting a card on an active reader. Requires payments.readers.write. |
To continue with an attached source, omit payment_source. In requires_confirmation, Flint confirms what is attached. In requires_action, it refreshes and returns the current state and action. With no source attached, omission returns 400 INVALID_REQUEST, detail REQUIRED at payment_source.
Send only the field that belongs to your credential_type. A field from another type returns 400 INVALID_REQUEST with detail code NOT_ALLOWED, and an empty string returns 400 INVALID_REQUEST. Create and update never take a credential; only confirm does. To help risk evaluation, you can also send a Flint-Buyer-Device header: a random 32-character lowercase hex ID that you keep for the buyer's device. Send the buyer's IP address as buyer_ip_address too; without buyer_ip_address, the payment has no IP address for risk rules and block lists.
Handle 3D Secure and other buyer actions#
For a standalone payment intent, confirm returns a Flint URL by default when the buyer must act. Open current_payment_action.client_action.url as a redirect, popup, or iframe. Flint's API returns a URL for this action, without a Stripe client secret. Stripe's authentication page receives what it needs to run the challenge. The step expires 12 hours after the confirm call that returned the action; use current_payment_action.expires_at as its deadline.
You can also send payment_return_url on confirm to choose where the buyer returns. Flint adds only payment_intent_id to that destination. The return URL must use HTTPS, or a native app scheme other than http, javascript, data, file, blob, or about, and cannot contain credentials, a query, or a fragment. Test mode accepts HTTP loopback URLs too. Without a destination, the completion page posts {type: "flint.payment_action.completed", payment_intent_id: "pi_..."} to its parent and opener. Before trusting this message, check that event.origin equals the origin of the returned Flint payment-action URL (the payment-return host). Read the payment intent to learn whether it succeeded; a completed browser step alone does not establish payment success.
{
"payment_return_url": "https://merchant.example/payments/complete",
"payment_source": {
"credential_type": "stripe_payment_method",
"stripe": {
"payment_method": "pm_1AbcExample"
}
}
}
Omitting client_action_type selects url for a new confirmation. You can select it explicitly for Stripe.js with client_action_type: "stripe". A continuation keeps the original action type; requesting a different one returns 409 ACTION_NOT_ALLOWED, reason field_locked, with param: client_action_type and current_status: requires_action.
If the payment method needs a step that cannot open as a URL, confirm returns 409 ACTION_NOT_ALLOWED, reason provider_action_unsupported, and publishes no URL action. Continue with client_action_type: "stripe" to get the Stripe.js handoff. This refusal does not lock the action type.
A URL action looks like this:
{
"pending_action_id": "pendact_1kmn0aExample",
"action_type": "payment_authentication",
"subject": {"payment_intent": {"payment_intent_id": "pi_1kmn0aExample"}},
"expires_at": "2026-11-12T00:00:00Z",
"client_action": {"type": "url", "url": "https://payment-returns.example/payment-returns/actions/pendact_1kmn0aExample/bearer-token"}
}
Treat the URL as a bearer secret: keep it out of logs and analytics, and give it only to the buyer completing this step. Stripe's hosted 3DS2 page receives the PaymentIntent client secret in its URL, so the browser holds that secret during the challenge. Flint strips provider query parameters before sending the buyer to your return destination.
If a payment is confirmed with a payment method Flint didn't approve, Flint doesn't count the charge and returns it to the buyer. The payment intent ends canceled with cancellation_reason: payment_returned.
Opt in to Stripe.js#
When you select client_action_type: "stripe" and the bank asks the buyer to authenticate, the confirm response has status: "requires_action" and a current_payment_action:
{
"data": {
"payment_intent_id": "pi_1kmn0aExample",
"status": "requires_action",
"supported_actions": ["confirm", "cancel"],
"current_payment_action": {
"pending_action_id": "pendact_1kmn0aExample",
"subject": {
"payment_intent": {"payment_intent_id": "pi_1kmn0aExample"}
},
"action_type": "payment_authentication",
"expires_at": "2026-11-12T00:00:00Z",
"client_action": {
"type": "stripe",
"stripe": {
"account_id": "acct_Example",
"publishable_key": "pk_test_Example",
"payment_intent": {
"stripe_js_call": "handle_next_action",
"client_secret": "pi_Example_secret_Example"
}
}
}
}
},
"request_id": "req_01KWM6WAHG3N9Q8T2V5XRZ7C4F"
}
Every confirm response includes current_payment_action, and it's null when the buyer has nothing to do. Only confirm responses carry it: reads, lists, and webhooks leave it out. Act on the typed action, never on status alone, and never on payment_collection. The stripe action carries a Stripe PaymentIntent client secret for this step. It can also confirm the payment at Stripe with a different card, so pass it only to handleNextAction, never to confirmPayment or confirmCardPayment, and read the outcome from your backend.
For a split payment, the Stripe action's account_id is null. Load Stripe.js with the action's publishable_key and omit stripeAccount. The action's on_behalf_of identifies the settlement account. It isn't an argument to handleNextAction. Confirm the same PaymentIntent again without payment_source after the challenge.
In the browser, run the Stripe.js call that stripe_js_call names, with a Stripe instance for the action's own publishable_key and account_id. Then ask your server to continue, even if Stripe.js reported an error, because Flint reads the real outcome from the processor:
// result is {status, current_payment_action} as your server relays it.
async function handleResult(result, continuations = 0) {
if (["succeeded", "requires_capture", "processing"].includes(result.status)) {
return showConfirmation();
}
if (result.status === "requires_payment_method") {
return showMessage("Your payment was declined. Try another card or payment method.");
}
if (result.status !== "requires_action" || continuations >= 3) {
return showMessage("We couldn't finish your payment. Try again in a moment.");
}
if (!result.current_payment_action) {
// Flint couldn't produce the action yet. Continue to fetch it.
return continuePayment(continuations + 1);
}
const handoff = result.current_payment_action.client_action;
if (handoff.type === "url") {
window.location.assign(handoff.url);
return;
}
const action = handoff.stripe;
if (action.payment_intent?.stripe_js_call !== "handle_next_action") {
throw new Error("Unsupported payment action");
}
const actionStripe = Stripe(action.publishable_key, action.account_id ? {stripeAccount: action.account_id} : {});
const {error} = await actionStripe.handleNextAction({
clientSecret: action.payment_intent.client_secret,
});
if (error) showMessage(error.message);
await continuePayment(continuations + 1);
}
async function continuePayment(continuations) {
const response = await fetch("/api/topups/1001/continue", {method: "POST"});
await handleResult(await response.json(), continuations);
}
For an explicit Stripe action with Affirm, handleNextAction sends the buyer to Affirm, and they come back through a return page instead. Affirm payments covers that page.
Continue with the attached credential#
After the browser action, your server calls the same confirm route without payment_source. Don't send a new credential: the continuation uses the payment attempt, credential, and risk decision of the first confirmation.
<!-- docs-test {"skip":"Requires a completed browser 3DS challenge before continuation; API-only test does not complete authentication."} -->
curl -X POST https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample/confirm \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: continue-pi_1kmn0aExample-pendact_1kmn0aExample" \
-d '{}'
While the confirmation is unfinished, Flint reads the payment's state from the processor first, and confirms again only if the processor still needs a confirmation. Otherwise it confirms nothing and returns the current PaymentIntent:
- The buyer authenticated: the result is
succeeded,requires_capture, orprocessing. - The buyer hasn't finished: the result is still
requires_action, withcurrent_payment_actionagain. This is also how you get the action back after a lost response. - Authentication failed: the result is
requires_payment_methodwithlast_payment_error.codeauthentication_required. Treat it as a decline.
If status is requires_action but current_payment_action is null, Flint couldn't produce the action yet. The confirmation already happened, so don't send a new credential. Confirm again without payment_source, and contact support with the request_id if the action stays null.
Repeating a continuation never starts another charge. Two continuations at once, even with different idempotency keys, lead to one confirmation at the processor. A fresh continuation can return the state refusal below once Flint has recorded the outcome.
If the Flint action page or a webhook already finished the standalone payment, a fresh confirm returns 409 ACTION_NOT_ALLOWED with current_status. Reason already_applied with current_status: "succeeded" means the payment is paid. Read GET /v1/payment-intents/{payment_intent_id} or use the payment webhook to recover the recorded outcome; don't treat that refusal as a decline or start another payment.
Continuation uses a source already attached to the PaymentIntent:
- With no source attached, it returns
400 INVALID_REQUESTwith detail codeREQUIREDonpayment_source. Send the buyer's credential instead. - Once
statusissucceeded,canceled,expired,processing, orrequires_capture,supported_actionsno longer listsconfirm, and confirm returns409 ACTION_NOT_ALLOWEDwithcurrent_status. The exception is a confirmation Flint started and hasn't finished recording: confirming withoutpayment_sourcefinishes it and returns its result.
Handle a decline#
A declined or blocked payment isn't an API error. Confirm returns 200 with the PaymentIntent back at requires_payment_method, and last_payment_error says why:
{
"data": {
"payment_intent_id": "pi_1kmn0aExample",
"status": "requires_payment_method",
"supported_actions": ["confirm", "cancel"],
"selected_payment_option": "card",
"last_payment_error": {
"code": "insufficient_funds",
"message": "The payment method has insufficient funds. Ask the customer to use a different payment method.",
"failed_at": "2026-10-28T18:04:12Z",
"remediation": {
"retry": "none",
"next_steps": "Ask the customer to use a different payment method.",
"next_actions": [
{
"action_type": "confirm_payment_intent",
"reason_code": "provide_a_different_payment_method",
"required_fields": ["payment_method_id"],
"required_scope": "payments.payment_intents.write"
}
]
}
},
"current_payment_action": null
},
"request_id": "req_01KWM6WAHG3N9Q8T2V5XRZ7C4G"
}
Show the buyer a message based on code, not message, which is written for you. Then let them try again with the same Elements instance: create a new ConfirmationToken and confirm with it, using a new idempotency key. Replaying the declined request's key returns the same decline and charges nothing.
Declines and payment attempts lists every code, which ones to show the buyer, and when last_payment_error is set and cleared.
Recovery and idempotency#
If your server loses a response, recover the existing payment. Don't create another PaymentIntent or ask for a new token.
- Retry the lost request with the same
Idempotency-Keyand body. A request Flint finished replays its result withIdempotency-Replayed: true. If that result isprocessing, it staysprocessingon every replay, so read the payment for its current state. - If you no longer have the key, read the PaymentIntent with
GET /v1/payment-intents/{payment_intent_id}. The read doesn't includecurrent_payment_action. - If
statusisrequires_action, confirm withoutpayment_sourceto get the action. Run it in the browser if the buyer hasn't, then confirm again withoutpayment_sourceto continue. - If
statusisrequires_confirmation, a confirmation was interrupted. Confirm withoutpayment_sourceto finish it. - If
statusisprocessing, Flint is waiting for or confirming the outcome. Wait forpayment_intent.succeededorpayment_intent.payment_failed, or read again. Don't confirm again. - Stop when
statusissucceeded,requires_capture,canceled, orexpired. Atrequires_payment_method, readlast_payment_error: if it's set, the payment was declined.
Sending the same ConfirmationToken again is also safe. A token this PaymentIntent already used returns the current PaymentIntent instead of an error, and Flint doesn't confirm it twice. A token another PaymentIntent used, or one that expired, returns 409 ACTION_NOT_ALLOWED.
A lost response never leaves you guessing whether Flint sent the payment. After Flint sends it to the processor, the answer is the payment in its current state, possibly processing, and last_payment_error stays null until a failure is known. A 503 with reason outcome_unknown means Flint couldn't record the outcome: keep the key, read the PaymentIntent before you do anything else, and contact support with the request_id if it still doesn't settle. Idempotency covers keys, replays, and conflicts for every route.
Save the card for later charges#
Send save_payment_method: true with the first confirm to keep the card the buyer pays with. Flint saves it for the PaymentIntent's customer as a payment method with usage: "off_session", so you can charge it later without the buyer: for a subscription, an automatic invoice, or as the customer's default card. The buyer enters the card and completes any authentication once, for both the payment and the save.
Saving here works for standalone PaymentIntents and order legs. An order leg saves for the order's customer_id for off-session reuse. To save the card while your backend pays an order with POST /v1/orders/{order_id}/pay, see Save a card while the customer pays. To save a card without taking a payment, see Save a card and charge it later.
Show the buyer what they agree to#
A card with usage: "off_session" can be charged while the buyer is away, so save it only when the buyer agreed to that on your page before they paid. Put the wording next to the pay button, and say:
- that you will keep the card,
- what you will charge it for, and
- when, or how often, you will charge it.
For example: "Save this card. Cedar & Stone Coffee will charge it for each monthly coffee delivery until you cancel." When saving is optional, ask with an unchecked checkbox, and send save_payment_method: true only when the buyer checked it.
With setupFutureUsage: "off_session", the Payment Element also shows a line saying the buyer allows future charges. Keep it, since a card saved this way does receive them. It doesn't say what you will charge or when, so show your own wording as well.
Before you confirm#
- The PaymentIntent has a customer. Flint saves the card for the PaymentIntent's
customer_id. Set it when you create the PaymentIntent, or withPATCH /v1/payment-intents/{payment_intent_id}while the status isrequires_payment_method. - Your credential can save cards. The API key or partner token needs
payments.payment_methods.writeas well aspayments.payment_intents.write. - The credential is new. Send a card, Apple Pay, or Google Pay credential collected for this confirm: a
payment_source.stripe.confirmation_tokencreated withsetupFutureUsage: "off_session", or apayment_source.stripe.payment_method. A savedpayment_method_idis already kept, so it can't be sent withsave_payment_method: true. - Card payments are enabled for the environment. Until they are, the save fails with
409 MERCHANT_NOT_READY, with reasoncapability_not_requestedoronboarding_required.
Create the PaymentIntent with the customer:
<!-- docs-test {"scenario":"save","status":201,"fixtures":{"customer":true},"expect":{"data.status":"requires_payment_method"}} -->
curl -X POST https://api.withflintpay.com/v1/payment-intents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: subscription-start-1002" \
-d '{
"amount_money": {"amount": 4200, "currency": "USD"},
"payment_options": ["card", "apple_pay", "google_pay"],
"customer_id": "cus_1kmn0aExample"
}'
Create the token with setupFutureUsage#
Stripe saves the card from the ConfirmationToken, so the token carries the buyer's choice. Set setupFutureUsage: "off_session" on Elements before you call stripe.createConfirmationToken, and clear it when the buyer unchecks the option:
const saveCard = document.querySelector("#save-card");
saveCard.addEventListener("change", () => {
elements.update({setupFutureUsage: saveCard.checked ? "off_session" : null});
});
Wait for the Elements update-end event after a change before you create the token, then send the token and the buyer's choice to your server. When the purchase always saves the card, pass setupFutureUsage: "off_session" when you create Elements instead.
The token must match the request:
save_payment_method: truewith a token created withoutsetupFutureUsage, or with"on_session", returns400 INVALID_REQUESTwith detail codeNOT_ALLOWEDonpayment_source.stripe.confirmation_token. Create a new token afterelements.updatefinishes.- A token created with
setupFutureUsage, sent withoutsave_payment_method: true, returns the same error. Send the buyer's choice, or create the token withoutsetupFutureUsage. - Only a card, Apple Pay, or Google Pay can be saved. A bank account or Affirm with
save_payment_method: truereturns400 INVALID_REQUESTwith detail codeNOT_ALLOWED. When the PaymentIntent also offers ACH debit or Affirm, clearsetupFutureUsagebefore creating a token for one, and leavesave_payment_methodout.
Confirm with save_payment_method#
<!-- docs-test {"scenario":"save","status":200,"card":"pm_card_visa","expect":{"data.status":"succeeded","data.current_payment_action":null}} -->
curl -X POST https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample/confirm \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: confirm-pi_1kmn0aExample-ctoken_Example-save" \
-d '{
"save_payment_method": true,
"payment_source": {
"credential_type": "stripe_confirmation_token",
"stripe": {
"confirmation_token": "ctoken_Example"
}
}
}'
Leaving save_payment_method out and sending false do the same thing: nothing is saved.
If the bank asks the buyer to authenticate, run the action as for any payment. That one authentication covers both the payment and the saved card. Then continue with {} and no save_payment_method. The payment attempt keeps the first confirmation's choice: sending true returns 400 INVALID_REQUEST with detail code REQUIRED on save_payment_method, and false doesn't cancel the save.
Wait for payment_method.activated#
Flint saves the card after the payment is approved: when the PaymentIntent is succeeded, or requires_capture for manual capture. That happens after the confirm response, so the response doesn't include the saved card.
- Handle the
payment_method.activatedwebhook. Its object is the saved card, with itspayment_method_id,customer_id,status: "active", andusage: "off_session". You can charge it from then on. - To link the card to this payment, read the PaymentIntent.
payment_source.card.payment_method_idnames the saved card. Flint sets it after saving the card and sendspayment_intent.updatedwhen it does, sopayment_method.activatedcan arrive first. If the field isn't there yet, wait for thatpayment_intent.updated.
<!-- docs-test {"scenario":"save","status":200,"waitFor":"data.payment_source.card.payment_method_id"} -->
curl https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": {
"payment_intent_id": "pi_1kmn0aExample",
"customer_id": "cus_1kmn0aExample",
"status": "succeeded",
"payment_source": {
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"payment_method_id": "pm_1kmn0aExample"
}
}
},
"request_id": "req_01KWM6WAHG3N9Q8T2V5XRZ7C4H"
}
- A declined payment saves nothing. The PaymentIntent returns to
requires_payment_method, and the next confirmation with a new credential uses that request'ssave_payment_method. Send it again if the buyer still wants the card saved. - Canceling an uncaptured payment, or refunding it after approval, doesn't remove the saved card. Remove it with
DELETE /v1/payment-methods/{payment_method_id}when you don't want to keep it. - If the customer is deleted before the save finishes, Flint saves nothing and sends no event.
Errors#
An error response is a refusal, not a payment outcome. Read param for the field to change and details[0].reason where a row names one, and fix what the error describes before you send a corrected request with a new idempotency key. OPERATION_IN_PROGRESS is the exception: resend the same request.
Order-linked PaymentIntents#
/confirm also starts a single order leg covering the balance or continues its holding attempt. Checkout credentials can confirm their own session’s legs. See Confirm an order payment for owner restrictions and card saving.
Capture, cancel, and refunds work the same for both kinds. See Manual capture and Refunds.
Webhooks#
Confirm responses are enough to drive the browser, but outcomes that arrive later, such as an ACH debit settling, reach you only by webhook. Subscribe to these on the endpoint that tracks payments:
Disputes and refunds send their own dispute.* and refund.* events. Deliveries can be duplicated, delayed, or out of order: verify signatures, deduplicate by event ID, and read the PaymentIntent when order matters. See Webhooks.
Test the flow#
In the sandbox, the browser flow works with any test card. Use for a payment that succeeds, and for one that asks for 3D Secure, each with any future expiry date and any CVC.
To script the flow without a browser, confirm with one of Stripe's fixed test aliases. Create the PaymentIntent as in step 1, then send the alias as a stripe_payment_method credential:
<!-- docs-test {"scenario":"test-card","status":200,"fixtures":{"payment":{"amount":4200}},"expect":{"data.status":"succeeded","data.current_payment_action":null}} -->
curl -X POST https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample/confirm \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: confirm-pi_1kmn0aExample-test" \
-d '{"payment_source": {"credential_type": "stripe_payment_method", "stripe": {"payment_method": "pm_card_visa"}}}'
| Alias | Outcome |
|---|---|
pm_card_visa | The PaymentIntent is succeeded. |
pm_card_chargeDeclined | The PaymentIntent is back at requires_payment_method with last_payment_error.code of card_declined. |
pm_card_chargeDeclinedInsufficientFunds | The same, with insufficient_funds. |
pm_card_authenticationRequired | The PaymentIntent is requires_action, with a 3D Secure step for the browser. |
The same alias works on any number of payments in a sandbox. Testing lists more aliases, including ones for disputes, reviews, and fraud warnings. To rehearse an order instead, pay it with a test token.
Test a decline, a 3D Secure step that succeeds, one that fails, and a lost response: send the same confirm twice with the same key, and the second response carries Idempotency-Replayed: true.
Related guides#
Declines and payment attempts3D SecureManual captureACH debit paymentsSave a card and charge it laterDivide a payment between sellers#
A collecting merchant can create a standalone PaymentIntent with splits to send fixed shares of one payment to sellers. This divides the payment's funds. Split tender means the buyer pays with several payment methods.
Use the collecting merchant's own credentials. Each seller must install the same partner app owned by that merchant, approve receiving splits in the payment's mode, and be ready to receive payouts. First set payment_splits.seller_terms_url on the app, then send each seller through authorization. Test mode needs no platform review. Live payments require the app's active payment_splits capability and an account Flint supports for splits.
{
"amount_money": {"amount": 10000, "currency": "USD"},
"payment_options": ["card"],
"splits": [
{
"partner_app_install_id": "pinst_01KF3A8C2D4E6F8G0H2J4K6M8N",
"amount_money": {"amount": 6000, "currency": "USD"},
"description": "Order 1042: mugs",
"external_reference_id": "1042-mugs"
}
]
}
Send 1 to 25 entries, once per install, each with an amount above zero in the payment's currency. Optional description is 1 to 500 characters; optional external_reference_id is 1 to 255. Both are shown to the seller. The total must leave enough for Flint's largest fee across the offered payment options and at least one minor unit for the collecting merchant. A total that doesn't fit returns INVALID_REQUEST, with INVALID_VALUE at splits and maximum_money.
For a split payment, payment_collection.stripe.account_id is null and payment_collection.stripe.on_behalf_of is the collecting merchant's Stripe account ID. Initialize Stripe.js with publishable_key, omitting stripeAccount. Pass on_behalf_of as the onBehalfOf option when you create Stripe Elements, then create the confirmation token.
A token created with stripeAccount returns INVALID_VALUE at payment_source.stripe.confirmation_token. If the token's settlement account is missing or differs from the payment's, confirmation returns last_payment_error.code: "confirmation_token_account_mismatch". Create Elements with the account from the collection guidance, collect a fresh token, and submit a new confirmation request.
Saved payment methods, payment_source.stripe.payment_method, save_payment_method: true, install tokens, and platform_fee can't be used for split payments. A Flint customer_id can still link the customer to the sale.
Splits are fixed after create, except for final amounts at capture. PATCH never accepts splits. Before confirmation, cancel the PaymentIntent and create another to change the sellers. Changing amount_money or tip_money below what the stored splits need returns LIMIT_EXCEEDED with minimum_money at the changed field.
Read current split state in PaymentIntent.splits or through the payment split routes. Changes send payment_split.* events. After the payment succeeds, sellers' shares wait until the payment's funds are available and any dispute has closed. A split credits the seller's Flint balance; the seller's normal payouts send it to its own bank. A marketplace can't pay a seller's bank directly or send a split outside a payment.
Confirm an order payment#
With merchant credentials, use the same POST /v1/payment-intents/{payment_intent_id}/confirm request for a staged order leg, including a checkout-session leg or an exchange balance. A single leg must cover the order balance, with no other unpaid staged legs or selected gift cards. Flint applies the order's payment effects. If the leg is held by an open attempt, omit payment_source to continue that attempt.
Create the leg with order_id, then confirm it. Omit amount_money and the leg takes the order's outstanding balance:
<!-- docs-test {"scenario":"order-leg","status":201,"fixtures":{"order":2500},"expect":{"data.status":"requires_payment_method"}} -->
curl -X POST https://api.withflintpay.com/v1/payment-intents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: leg-ord_1kmn0aExample-1" \
-d '{"order_id": "ord_1kmn0aExample"}'
<!-- docs-test {"scenario":"order-leg","status":200,"card":"pm_card_visa","expect":{"data.status":"succeeded","data.current_payment_action":null}} -->
curl -X POST https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample/confirm \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: confirm-pi_1kmn0aExample-ctoken_Example" \
-d '{"payment_source": {"credential_type": "stripe_confirmation_token", "stripe": {"confirmation_token": "ctoken_Example"}}}'
A decline returns 200 with the leg back at requires_payment_method, as for a standalone payment. A success also pays the order, so fulfill from order.paid.
For a deposit, create a leg with the deposit's amount_money, then call POST /v1/orders/{order_id}/pay with action: "confirm_payment_intents", that leg and its payment_source in payment_intents, expected_outstanding_money set to the order's current balance, and completion_behavior: "partial_payment". The order stays open for the remaining balance. Starting a deposit through the leg's /confirm route returns 409 ACTION_NOT_ALLOWED with reason managed_by_owner naming pay_order; refreshing an unchanged order won't make the deposit cover its balance.
For an order with tracked items, Flint reserves the stock before attempting the deposit. A successful deposit holds the stock for 24 hours after the payment finishes processing. Later deposits use and renew the same hold while it is active. Paying the balance commits the stock. Once the hold expires, the next payment must reserve stock again. If the first attempt fails or is canceled before collecting money, Flint releases any new hold from that attempt. Refunding a deposit keeps the hold while the order stays open, even when you refund the full deposit. Closing the order releases the deposit hold.
Authentication returns a url action by default. Send client_action_type: "stripe" for a Stripe.js handoff. An omitted choice on a continuation keeps the stored type; a different explicit type returns 409 ACTION_NOT_ALLOWED with reason field_locked on client_action_type. Reader payments keep their Stripe behavior.
Check supported_actions before starting. When the order needs several payments together, managed_by_owner names pay_order in remediation.next_actions. With merchant credentials, invoice confirmation names collect_invoice; subscription confirmation names create_subscription_payment_retry. These owner refusals apply to both start and continuation. A checkout credential can start and continue its own session's legs through this confirm route, including invoice checkout legs. Other sessions' intents and standalone intents return 404 RESOURCE_NOT_FOUND. Checkout credentials cannot send save_payment_method; use order pay to save a buyer card.
save_payment_method: true keeps a newly collected card for the order's customer_id for off-session use. It requires payments.payment_methods.write in addition to payments.payment_intents.write. Set the order's customer first; an order without one returns configuration_required on the order.