Declines and payment attempts
When POST /v1/orders/{order_id}/pay doesn't end in a paid order, you have to decide what to do next: ask for another card, finish 3D Secure, or wait. The wrong choice charges the buyer twice or tells them a payment that went through has failed. Every pay call runs a payment attempt, and the attempt in the response tells you which case you're in: start a new payment, resume the same attempt, or wait for it to finish.
This guide assumes you already collect a card and pay an order as in Embedded payments.
Read the attempt, not the HTTP status#
A declined card is not an API error. Flint never returns 402: every route that starts, confirms, captures, or retries a payment returns its normal 2xx status with the resulting resource, and the outcome is in that resource's state. This sandbox request pays with a test token that declines for insufficient funds:
<!-- docs-test {"scenario":"decline","status":200,"fixtures":{"order":9900}} -->
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/pay \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: pay-ord_1kmn0aExample-1" \
-d '{
"action": "pay",
"payment_source": {
"credential_type": "stripe_payment_method",
"stripe": {
"payment_method": "pm_card_chargeDeclinedInsufficientFunds"
}
},
"expected_outstanding_money": {
"amount": 9900,
"currency": "USD"
}
}'
{
"data": {
"order": {
"order_id": "ord_1kmn0aExample",
"status": "open",
"payment_status": "unpaid",
"version": 4,
"settlement_amounts": {
"paid_money": {"amount": 0, "currency": "USD"},
"outstanding_money": {"amount": 9900, "currency": "USD"}
}
},
"order_payment_attempt": {
"order_payment_attempt_id": "opat_1kmn0aExample",
"status": "failed",
"is_resumable": false,
"mode": "payment",
"expected_outstanding_money": {"amount": 9900, "currency": "USD"},
"payment_intents": [{
"payment_intent_id": "pi_1kmn0aExample",
"status": "requires_payment_method",
"selected_payment_option": "card",
"amount_money": {"amount": 9900, "currency": "USD"},
"tip_money": {"amount": 0, "currency": "USD"},
"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."
}
}
}],
"pending_actions": [],
"gift_card_redemptions": [],
"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."
}
},
"started_at": "2026-10-28T18:04:11Z",
"completed_at": "2026-10-28T18:04:12Z"
}
},
"request_id": "req_01KWM6WAHG3N9Q8T2V5XRZ7C4D"
}
The call returned 200. The outcome is in data.order_payment_attempt:
statussays where the attempt is. The ten values are in Decide what to do next.is_resumablesays whetheraction: "resume"can move the attempt forward. It istrueonly when a resume can make progress.payment_intents[]holds the attempt's legs: the payment intents it is trying to settle. Most orders have one leg, and a split payment has several. Each leg has its ownstatus, and a leg that didn't settle carries its ownlast_payment_error.pending_actions[]is filled only while the status isrequires_action. It holds what the browser has to do before you resume.last_payment_erroris set on afailedattempt when a payment failed it: a decline, a block, or failed authentication. It repeats the failing leg's error. Apartially_succeededattempt doesn't set it, so in a split payment, read each leg's ownlast_payment_error.status_reasonsays why afailed,canceled, orexpiredattempt ended when no payment failure explains it, such asinventory_unavailable. See Why an attempt ended.expected_outstanding_moneyis the balance the attempt started against. It stays fixed for the life of the attempt.modeispaymentfor a charge,setupwhen a zero-balance subscription order saves a card, andsettlementwhen a zero-balance order completes without a charge.
The HTTP status still tells you something. Handle the three cases differently:
| Response | What it means | What to do |
|---|---|---|
200 with order_payment_attempt | Flint ran the attempt. A decline, a 3D Secure request, or a block by one of your risk rules all land here. | Branch on the attempt's status, as in Decide what to do next. |
4xx | Flint refused the request. For example, the order changed since you quoted it, or another attempt still holds the order. When Flint refuses the credential before sending it to the processor, such as a browser credential that was already used, the attempt that request started ends failed. | Fix what the error names. See Errors. |
A timeout, a dropped connection, or 503 with reason outcome_unknown | You don't know whether the buyer was charged. | Retry with the same key, as in Recover a lost response. Don't start a new payment. |
When attempts are limited#
A temporary attempt limit returns 429 RATE_LIMIT_EXCEEDED with Retry-After. Wait at least that many seconds before trying again. A refused attempt has no pending payment, so don't show a processing state or promise a receipt.
If a payment reaches the processor's confirmation limit, Flint immediately cancels that payment and returns 409 ACTION_NOT_ALLOWED with reason payment_attempts_exhausted and remediation.retry none. There is no Retry-After: waiting cannot make that payment reusable. Start a new payment or checkout session. For a payment link, open the link again to start a new checkout. For an order with one payment leg, the refused confirmation's attempt ends failed; no charge remains processing. If another leg of a split payment settled, read the returned attempt and collect only the remaining balance.
Read a payment intent's outcome#
The same rule holds for a payment intent you confirm or capture directly with /v1/payment-intents, and for each leg of an attempt. Read status and last_payment_error in the response body:
status | last_payment_error | Meaning |
|---|---|---|
requires_payment_method | null | Not attempted yet. |
requires_payment_method | Set, code not payment_blocked | Declined or failed. Collect another payment method and confirm again. |
requires_payment_method | code is payment_blocked | Blocked by Flint or the processor's risk controls. No money moved. Ask for another payment method. |
requires_confirmation | null | Payment details are attached, but confirmation was interrupted. Confirm the payment intent again without payment_source. For an order payment, you can also resume the attempt. |
requires_action | null | The buyer has to act, usually for 3D Secure. The confirm result's current_payment_action describes the step, and confirming again without payment_source retrieves it. An order payment's attempt also lists it in pending_actions. |
processing | null | Submitted, and Flint is waiting for or confirming the outcome. Wait for the next event or read the payment intent again. Don't start another payment. |
requires_capture, succeeded | null | Authorized, or paid. |
canceled with cancellation_reason payment_returned | The last failure, or null | Flint couldn't accept the payment, for example because it was completed with a payment method other than the one Flint approved. Money it collected is in captured_money, and Flint returns it through a refund it creates, or a released hold is in released_money. Ask for another payment method without saying why. |
canceled without cancellation_reason | code is payment_blocked | Flint couldn't accept the payment and knows of no money to return yet, for example while the charge is still processing. If money turns up, the payment intent moves to payment_returned. Ask for another payment method without saying why. |
canceled, expired | The last failure, or null | Final. The field keeps the last failure, if there was one. |
A payment intent always has last_payment_error, as null or an object with code, message, failed_at, and remediation. On an attempt leg, the field is left out instead of null. Flint follows these rules:
- Set when a confirmation concludes in failure: a decline, failed authentication, a definitive confirmation failure, a risk block, or an asynchronous failure such as an ACH return before the debit succeeded. The status is then
requires_payment_method, orcanceledwhen the processor has permanently canceled the payment. - Replaced by the next concluded failure.
- Cleared when a later confirmation concludes in
requires_action,processing,requires_capture, orsucceeded. Starting a confirmation doesn't clear it. - Kept when the payment intent is canceled or expires, so the last failure stays readable.
- Not written while the outcome is unknown. If the processor doesn't answer after Flint sends the confirmation, the payment intent is
processingwithlast_payment_errornull, and the request returns200. Flint resolves the outcome itself and records a failure only if the payment failed. - Never stale. A delayed failure report doesn't overwrite a payment intent that has already moved on.
The response, a GET, and the payment_intent.* webhooks carry the same last_payment_error for the same failure. current_payment_action is not part of that set: only a confirm result carries it, and reads, lists, and webhooks leave it out.
A declined confirmation is a recorded result. Replaying its Idempotency-Key returns the same declined response and doesn't charge again. To try again after a decline, send a new request with a new key.
remediation.retry is none for every payment failure, and remediation.next_steps depends on code: re-enter the card details for incorrect_cvc and payment_method_unavailable, try again later for processing_error, ask the buyer to update their card for card_details_outdated, and don't try the card again for lost_card, stolen_card, fraudulent, and card_declined_do_not_retry.
Decide what to do next#
An attempt starts in processing and ends in one of five final statuses. Between those, it can stop to wait for the buyer, for you, or for the processor.
- processing moves to requires_action on buyer step needed
- processing moves to requires_capture on authorized
- requires_action moves to processing on continue or timeout
- requires_capture moves to processing on capture, cancel, or expiry
- processing moves to succeeded
- processing moves to partially_succeeded
- processing moves to failed
- processing moves to canceled
- processing moves to expired
status on order payment attemptThe status tells you what to do. This function covers every status, including any added later:
type NextStep =
| "done"
| "authenticate" // run pending_actions, then continue each payment
| "wait" // read the attempt again, or wait for order.paid
| "capture" // capture or cancel the authorization
| "pay_remaining" // retry only the legs that failed
| "new_payment"; // collect a new credential and start again
function nextStep(attempt: {status: string}): NextStep {
switch (attempt.status) {
case "succeeded":
return "done";
case "partially_succeeded":
return "pay_remaining";
case "failed":
case "canceled":
case "expired":
return "new_payment";
case "requires_capture":
return "capture";
case "requires_action":
return "authenticate";
default:
// processing and any future status.
// An open attempt is never a reason to start another payment.
return "wait";
}
}
failed is a known outcome, so a new attempt is safe. processing means Flint is still resolving or applying the outcome. It concludes without a merchant resume request. Exceptional unresolved outcomes enter an internal manual_review queue owned by Flint operators. Operator reconciliation is not a caller action; the public status stays processing while it is unresolved. Examples include a processor operation still unresolved after 24 hours, payment creation that exhausted 12 recovery tries, quarantined replay, exhausted order completion or resource release, money that cannot be applied to the order, exhausted invoice updates, and tax or gift-card funding rejections that need correction. Repeated order-completion failures enter operator review after the 11th deferral.
Warning: Wait for a final outcome before starting over
A processing attempt may already have charged the buyer. Flint rejects a second payment with PAYMENT_ATTEMPT_ACTIVE. Start a new payment only from failed, canceled, or expired, and pay only the remainder after partially_succeeded.
Handle a decline#
A declined leg stays on the order at requires_payment_method with last_payment_error set, and the attempt ends failed. Nothing needs canceling. Tell the buyer, collect a new credential, and retry the same leg.
Decline codes#
A payment presented on a reader returns these codes too, including the PIN codes.
last_payment_error.code uses the values below. Flint maps every processor reason onto one of them, so you branch on code and never on processor-specific reasons. The list can grow, so treat a code you don't know like payment_failed.
code on payment error summaryThe bank_ codes appear only on ACH debit legs.
Show the buyer a message#
What the buyer sees depends on the credential that read the payment.
- Your API key or the CLI sees the real code, and
messageis written for you, not the buyer. Most messages end with an instruction such as "Ask the customer to use a different payment method." Write your own buyer copy fromcode. - A buyer credential, such as a checkout session credential or a customer session on
/v1/me, seeslost_card,stolen_card,fraudulent,do_not_honor, andcard_declined_do_not_retryascard_declined. Itsmessageis written for the buyer, and itsremediationhas nonext_actions. You can show thatmessageas is.
If you build buyer copy on your server, map the codes yourself. A few codes need specific wording, and a generic decline covers the rest, including lost_card, stolen_card, fraudulent, and card_declined_do_not_retry, whose reasons the buyer shouldn't see:
function buyerMessage(code: string): string {
switch (code) {
case "incorrect_cvc":
return "The security code doesn't match. Check it and try again.";
case "expired_card":
return "This card has expired. Check the date or use another card.";
case "card_details_outdated":
return "Your card's details have changed. Update them or use another card.";
case "payment_method_unavailable":
return "Check your card details, or use another card.";
case "processing_error":
case "payment_method_temporarily_unavailable":
return "Your payment couldn't be processed. Try again in a moment.";
case "authentication_required":
case "payment_not_completed":
case "payment_action_expired":
return "Your payment wasn't completed. Try again.";
default:
return "Your payment was declined. Try another card or payment method.";
}
}
Retry after a decline#
Collect a new credential in the browser, then send it again. Each try needs a new Idempotency-Key: the first request's key would replay the declined response. Flint reuses the declined leg, so retries don't pile up legs on the order.
Pay the order again. Send action: "pay" with the new payment_source. When the order's one open leg is requires_payment_method, has a last_payment_error, and covers the outstanding balance, Flint reuses it and starts a new attempt on it.
<!-- docs-test {"scenario":"decline","status":200,"expect":{"data.order.payment_status":"paid","data.order_payment_attempt.status":"succeeded"}} -->
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/pay \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: pay-ord_1kmn0aExample-2" \
-d '{
"action": "pay",
"payment_source": {
"credential_type": "stripe_payment_method",
"stripe": {
"payment_method": "pm_card_visa"
}
},
"expected_outstanding_money": {
"amount": 9900,
"currency": "USD"
}
}'
Or confirm the declined leg. With an API key that has payments.payment_intents.write, confirm the leg's payment intent with the new credential. The request and response are the same as for a standalone payment, and Flint applies the order's effects.
<!-- docs-test {"scenario":"confirm-retry","status":200,"fixtures":{"order":9900,"payment":{"order":true,"confirm":true,"card":"pm_card_chargeDeclinedInsufficientFunds"}},"expect":{"data.status":"succeeded","data.current_payment_action":null}} -->
curl -X POST https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample/confirm \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: confirm-pi_1kmn0aExample-2" \
-d '{
"payment_source": {
"credential_type": "stripe_payment_method",
"stripe": {
"payment_method": "pm_card_visa"
}
}
}'
Or select the leg explicitly. When several legs are open, or the declined leg no longer covers the balance, pay returns 400 INVALID_REQUEST with detail code REQUIRED and param payment_intents, and details[0].selectable_resources lists the legs. Select the one you want with action: "confirm_payment_intents", or cancel it with POST /v1/payment-intents/{payment_intent_id}/cancel first.
<!-- docs-test {"scenario":"staged-retry","status":200,"fixtures":{"order":9900,"payment":{"order":true,"confirm":true,"card":"pm_card_chargeDeclinedInsufficientFunds"}},"expect":{"data.order.payment_status":"paid","data.order_payment_attempt.status":"succeeded"}} -->
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/pay \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: pay-ord_1kmn0aExample-3" \
-d '{
"action": "confirm_payment_intents",
"payment_intents": [
{
"payment_intent_id": "pi_1kmn0aExample",
"payment_source": {
"credential_type": "stripe_payment_method",
"stripe": {
"payment_method": "pm_card_visa"
}
}
}
],
"expected_outstanding_money": {
"amount": 9900,
"currency": "USD"
}
}'
- The credential is new. Send the
stripe.payment_methodorstripe.confirmation_tokenthe browser just created, or a saved card'spayment_method_id, with the matchingcredential_type. Browser credentials are single-use. A used or expired confirmation token returnsACTION_NOT_ALLOWEDwith reasonconfirmation_token_unusable, and a usedstripe.payment_methodreturns reasonterminal_status. Stripe's fixed sandbox aliases, such aspm_card_chargeDeclined, are the exception: the same alias works on any number of payments. - The balance is checked. Send the order's
settlement_amounts.outstanding_moneyasexpected_outstanding_money. If the order changed since you quoted it, the call returnsVERSION_CONFLICTbefore charging: read the order again and show the buyer the new total. The field is required with a checkout session credential, and with an API key when the order has an open checkout session. Confirming the payment intent directly takes no order fence; Flint refuses withVERSION_CONFLICTif the leg no longer equals the balance. - The version is new.
expected_versionis optional. Onpay, it is the order'sversion, taken from the declined response or a fresh read, because starting the declined attempt advanced it. On a payment intent confirm, it is the payment intent's ownversion. - An invoice checkout retries the same way. Send
action: "pay"again with the session's checkout credential. Flint reuses the single unconfirmed payment intent when it covers the amount being collected. A processing or authorized payment can't be replaced.
Why an attempt ended#
When an attempt ends for a reason other than a payment failure, status_reason names it. These values aren't declines: no payment failed, and the order or the payment source usually needs attention rather than the card. Every failed attempt has exactly one of last_payment_error and status_reason. A canceled or expired attempt has status_reason only when it adds something to the status, such as payment_authorization_expired. New values can be added, and a reason Flint can't name is other, so treat a value you don't know like other.
status_reason on order payment attemptFinish 3D Secure#
3D Secure covers when banks ask for authentication, require_3ds rules, liability shift, and 3DS test cards.
Pay returns one Flint URL per pending payment or setup action by default. Send client_action_type: "stripe" explicitly for the Stripe.js handoff. Each action keeps its original type and expires when the attempt reaches its 30-minute cancel time. Open every pending URL, then read or resume the same order payment attempt. An explicit type change returns 409 ACTION_NOT_ALLOWED, reason field_locked; a step that cannot open as a URL returns reason provider_action_unsupported and permits continuing with stripe.
With payment_return_url, Flint adds only payment_intent_id for a payment or payment_method_id for setup. Without it, the completion page posts {"type": "flint.payment_action.completed", "payment_intent_id": "pi_..."} or {"type": "flint.payment_action.completed", "payment_method_id": "pm_..."}, with exactly one subject key. Check event.origin against the Flint action URL's origin, and read or resume the attempt to confirm the outcome. Flint's API doesn't return a Stripe client secret for URL actions; Stripe's authentication page can receive it to run the challenge. Flint returns any charge made with a payment method it didn't approve.
Pay replays retain the original domain result with no URL token or Stripe secret. Read the attempt to recover its current permitted action. A checkout credential still withholds actions it isn't authorized to complete.
When the issuer asks for authentication, the attempt returns requires_action with is_resumable: true and a pending action for each leg that needs it. Embedded payments walks through the browser code. The round trip looks like this:
- Your backend sends POST /v1/orders/{order_id}/pay to Flint
- Flint returns requires_action with pending_actions[] to Your backend
- Your backend sends the pending action's client_action to Browser
- Browser sends Open each Flint authentication URL to Browser
- Browser sends challenge finished to Your backend
- Your backend sends pay with action: "resume" to Flint
- Flint returns the attempt's next status to Your backend
The attempt in the pay response carries the action:
{
"order_payment_attempt": {
"order_payment_attempt_id": "opat_1kmn0aExample",
"status": "requires_action",
"is_resumable": true,
"pending_actions": [{
"pending_action_id": "pendact_1kmn0aExample",
"subject": {"payment_intent": {"payment_intent_id": "pi_1kmn0aExample"}},
"action_type": "payment_authentication",
"expires_at": "2026-11-11T12:30:00Z",
"client_action": {
"type": "url",
"url": "https://payment-returns.example/payment-returns/actions/pendact_1kmn0aExample/bearer-token"
}
}]
}
}
Open the returned client_action.url as a redirect, popup, or iframe. pending_action_id stays the same across reads of the attempt, so you can use it to avoid running one action twice.
If you explicitly send client_action_type: "stripe", the action carries client_action.stripe instead. Load Stripe.js with that action's publishable_key and pass account_id as stripeAccount only when set. For payments with splits, account_id is null; don't substitute on_behalf_of or the store's connected account. The client secret can also confirm the payment with another card, so use it only with handleNextAction:
import {loadStripe} from "@stripe/stripe-js";
const {publishable_key, account_id, payment_intent} =
paymentAttempt.pending_actions[0].client_action.stripe;
const stripe = await loadStripe(publishable_key, account_id ? {stripeAccount: account_id} : {});
const {error} = await stripe.handleNextAction({
clientSecret: payment_intent.client_secret,
});
// Resume whether or not the challenge succeeded. The resume reports the outcome.
const response = await fetch("/checkout/resume", {method: "POST"});
const attempt = await response.json(); // your backend relays data.order_payment_attempt
if (attempt.status === "requires_action" && error) {
// The challenge never ran, for example because Stripe.js failed to load.
showMessage(error.message);
}
Then resume from your backend:
<!-- 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/orders/ord_1kmn0aExample/pay \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: pay-ord_1kmn0aExample-resume-1" \
-d '{"action": "resume", "order_payment_attempt_id": "opat_1kmn0aExample"}'
A resume continues the attempt with the legs and credentials it started with. Flint reads the challenge result from Stripe, and the response carries the attempt's next status.
You can continue through the leg's payment intent instead. Confirm it without payment_source, as you would a standalone payment. Flint continues the attempt that holds the leg, reads the challenge result from Stripe, and returns the payment intent. It never starts another attempt. A checkout session credential can confirm its own session’s leg.
<!-- 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 "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: continue-pi_1kmn0aExample-pendact_1kmn0aExample" \
-d '{}'
- The body is small. Besides
order_payment_attempt_id, it acceptsexpected_outstanding_money,buyer_contact,client_action_type, andpayment_return_url, all optional. Omitpayment_return_urlwith a checkout credential. Any other field, such aspayment_source, returns400 INVALID_REQUESTwith detail codeUNKNOWN_FIELD. - The amount is the attempt's.
expected_outstanding_moneyon a resume is compared to the amount fixed on the attempt, not the live balance. A mismatch returnsVERSION_CONFLICT. - Each resume has its own key. The start request's
Idempotency-Keybelongs to the start request, and sending it with a resume body returnsIDEMPOTENCY_KEY_REUSED. - The action is short-lived. A pay response carries
pending_actionsonly while the attempt isrequires_actionand before its 30-minute cancel time. Replays omit action authority. Otherwise the array is empty. A list filtered byidempotency_keyleaves it out too, so read the attempt by ID for the current action.
When the challenge fails or is abandoned#
If the buyer fails the challenge or closes it, resume anyway: the resume returns the attempt as failed, with authentication_required on the leg. Collect another card and retry as after a decline. If you start the retry without resuming first, Flint refreshes the open attempt from Stripe before it judges the new payment, so the retry isn't blocked.
If the resume returns requires_action again, let the buyer reopen the returned URL. On the explicit Stripe.js path, show any error from handleNextAction and let them try again.
If the buyer leaves without finishing, the attempt stays at requires_action until 30 minutes after it started. Flint then cancels its legs, the attempt ends canceled, and everything it held on the order is released. Resuming that attempt returns 200 with status canceled. The next payment starts fresh with action: "pay". To release the order sooner, cancel the attempt.
Recover a lost response#
When a pay request times out or the connection drops, you don't know whether the buyer was charged. Never start a new payment. Once Flint has sent a payment to the processor, it answers with the payment as it stands, even if the processor never replied. That answer can be processing: Flint is finding out the outcome and resolves it without another request from you. Wait for the payment's events or read it again. Flint never turns an unknown outcome into a 5xx while it can still write the payment's state.
Send the same request again, with the same body and the same Idempotency-Key. Flint never runs a key twice:
| The first request | What the retry returns |
|---|---|
| Finished | Its stored response, with the Idempotency-Replayed: true header. |
| Is still running | 409 IDEMPOTENCY_KEY_IN_PROGRESS. Wait for Retry-After, then retry with the same key. |
| Stopped before it finished | The result of the same attempt. Flint continues it rather than starting another. |
A replayed response shows the payment as it was when the first request finished, and it keeps that state even after the payment concludes. If its status isn't final, such as an attempt that is processing, read the attempt or the payment intent before you act on it, or wait for its events.
Pay always needs an Idempotency-Key, so save the key with your order before the first call. A request without one returns 400 INVALID_REQUEST, and a retry with a new key is a new payment. With the SDKs, a lost response arrives as an SdkError with outcome: "unknown". Handle it the same way.
The same rules hold when you confirm a payment intent directly. The confirm request takes an optional key, so send one you can reproduce, such as confirm:{payment_intent_id}:{attempt}.
Two answers mean Flint couldn't settle the question for you:
503 SERVICE_UNAVAILABLEwith reasonoutcome_unknownmeans Flint couldn't record the uncertain outcome. Keep the key, don't send another payment, and read the order or the payment intent first.500 IDEMPOTENCY_RECOVERY_REQUIREDmeans Flint can't replay the original response. Find the attempt as below.
Find the attempt without retrying#
To check what happened without sending the payment again, list the order's attempts filtered by the original key. Use this read when the retry returns 500 IDEMPOTENCY_RECOVERY_REQUIRED or keeps returning IDEMPOTENCY_KEY_IN_PROGRESS:
<!-- docs-test {"scenario":"decline","status":200,"response":false,"list":true,"recovery":"order_payment_attempt.order_payment_attempt_id","expect":{"request_id":"req_..."}} -->
curl -G https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/payment-attempts \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "idempotency_key=pay-ord_1kmn0aExample-1"
{
"data": [{
"order_payment_attempt_id": "opat_1kmn0aExample",
"status": "processing",
"is_resumable": true,
"mode": "payment",
"expected_outstanding_money": {"amount": 9900, "currency": "USD"},
"payment_intents": [{
"payment_intent_id": "pi_1kmn0aExample",
"status": "requires_confirmation",
"amount_money": {"amount": 9900, "currency": "USD"},
"tip_money": {"amount": 0, "currency": "USD"}
}],
"pending_actions": [],
"gift_card_redemptions": [],
"started_at": "2026-10-28T18:04:11Z"
}],
"request_id": "req_01KWM608MR7CAZFETWS1RA3XPG"
}
Pass each attempt in the list to nextStep. The list shows each attempt as it is now, not the response Flint recorded. An empty list doesn't prove the request had no effect: a payment covered entirely by gift cards, or an order with nothing outstanding, can start no attempt. Read the order too.
If you no longer have the key, read the order. active_payment_attempt is the attempt that currently holds the order's payment:
<!-- docs-test {"scenario":"decline","status":200,"response":false,"expect":{"data.payment_status":"paid"}} -->
curl https://api.withflintpay.com/v1/orders/ord_1kmn0aExample \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": {
"order_id": "ord_1kmn0aExample",
"status": "open",
"payment_status": "unpaid",
"active_payment_attempt": {
"order_payment_attempt_id": "opat_1kmn0aExample",
"status": "processing",
"is_resumable": true
}
},
"request_id": "req_01KWM6CHDJB2VSB573FNFWX0PN"
}
When active_payment_attempt is absent, no attempt is open: the last one finished, or its 30 minutes ran out. Check payment_status, and list the attempts to see how the last one ended. A checkout session read with the session's own credential or a merchant API key also includes active_payment_attempt while one is open, so a headless checkout can recover the same way.
A new payment started while an attempt holds the order is rejected. The error names the open attempt, so even a blind retry leads you back to it:
{
"error": {
"type": "conflict_error",
"code": "PAYMENT_ATTEMPT_ACTIVE",
"error_source": "caller",
"message": "This order already has an active payment attempt. Read active_payment_attempt and resume or resolve it before starting another payment.",
"request_id": "req_01KWM6QY2WWAXEPRF8CQV3NVPN",
"doc_url": "https://developers.withflintpay.com/docs/errors#payment_attempt_active",
"remediation": {
"retry": "none",
"next_steps": "Resume, capture, or cancel the active attempt before starting another payment."
},
"details": [
{
"code": "PAYMENT_ATTEMPT_ACTIVE",
"message": "This order already has an active payment attempt.",
"resource_type": "order_payment_attempt",
"resource_id": "opat_1kmn0aExample",
"current_status": "processing",
"supported_actions": ["cancel"]
}
]
}
}
Wait while an attempt settles#
A processing attempt is waiting for the payment outcome or applying it to the order. A bank debit can take several business days. A card can stay here while Flint resolves a processor timeout or applies settled money and held inventory. Neither case needs a merchant resume request. Exceptional unresolved outcomes are reconciled by Flint operators.
While you wait:
- Don't start another payment. Money may already have moved. Flint rejects the start with
PAYMENT_ATTEMPT_ACTIVE, or withOPERATION_IN_PROGRESSonce the attempt is more than 30 minutes old. - Don't tell the buyer the payment failed. For a card, keep the spinner up. For a bank debit, tell the buyer the payment is processing.
- Read the attempt again, starting around 500 ms between reads and backing off to a few seconds. A read that fails or times out says nothing about the payment, so retry the read.
<!-- docs-test {"scenario":"decline","status":200,"response":false,"expect":{"data.status":"succeeded"}} -->
curl https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/payment-attempts/opat_1kmn0aExample \
-H "Authorization: Bearer YOUR_API_KEY"
Payment attempts have no webhook events of their own. To skip polling, fulfill from the order.paid webhook. It fires once the order is fully paid, however the payment got there. Check the order's dispute_status before you fulfill (access rules).
When only some legs settled#
An order paid with several legs, such as two cards, confirms them together in one attempt. If some legs settle and others don't, the attempt ends partially_succeeded. The attempt is final, and the order still has a balance:
{
"order": {
"order_id": "ord_1kmn0aExample",
"status": "open",
"payment_status": "partially_paid",
"pricing_amounts": {
"total_money": {"amount": 9900, "currency": "USD"}
},
"settlement_amounts": {
"paid_money": {"amount": 6000, "currency": "USD"},
"outstanding_money": {"amount": 3900, "currency": "USD"}
}
},
"order_payment_attempt": {
"order_payment_attempt_id": "opat_1kmn0aExample",
"status": "partially_succeeded",
"is_resumable": false,
"payment_intents": [
{
"payment_intent_id": "pi_1kmn0aCardA",
"status": "succeeded",
"amount_money": {"amount": 6000, "currency": "USD"},
"tip_money": {"amount": 0, "currency": "USD"}
},
{
"payment_intent_id": "pi_1kmn0aCardB",
"status": "requires_payment_method",
"amount_money": {"amount": 3900, "currency": "USD"},
"tip_money": {"amount": 0, "currency": "USD"},
"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."
}
}
}
]
}
}
The first card paid $60.00 of the $99.00 total, so settlement_amounts.outstanding_money is the $39.00 still owed.
Don't retry the original amount. That would charge the buyer again for the legs that settled. Instead:
order.partially_paid fires the first time the order becomes partly paid, and order.paid fires once the rest settles.
Look up past attempts#
Attempts stay readable after they finish. When a buyer says their payment failed, look here.
A decline followed by a successful retry shows two attempts. A finished attempt keeps its legs as they were when it ended, so the first attempt still shows the decline after the same leg succeeds in the second. A checkout session credential can read only the attempts its own session started.
Cancel an attempt#
Cancel an attempt to end it now instead of waiting out its 30 minutes. For example, the buyer walked away from 3D Secure and you want the inventory back on sale, or you want to back out of a zero-balance setup attempt.
/v1/orders/{order_id}/payment-attempts/{order_payment_attempt_id}/cancelRequired API key scope: commerce.orders.writeReference for POST /v1/orders/{order_id}/payment-attempts/{order_payment_attempt_id}/cancelEnds the attempt, cancels each of its legs, and releases what it held on the order. Returns the order and the canceled attempt.
cancellation_reasonis optional:requested_by_customer(the default),duplicate,fraudulent, orabandoned. A checkout session credential can send onlyrequested_by_customerorabandoned.- The legs are gone. Their payment intents are canceled and can't be reused, so the next payment starts with
action: "pay"and a new leg. - Holds are released. That covers held inventory, coupon and promotion redemptions, payment link capacity, and the delivery selection.
- Only an open attempt can be canceled. Canceling a finished attempt returns
ACTION_NOT_ALLOWEDwith reasonterminal_status, except that repeating a cancel returns the canceled attempt unchanged. If a leg already settled, the cancel returnsACTION_NOT_ALLOWEDwith reasonpayment_collected. Refund that money instead. - A processing bank debit can't be canceled. If a leg is an ACH debit in
processing, the cancel returns409 ACTION_NOT_ALLOWEDwith reasonin_progress.details[0]names the leg's payment intent inresource_typeandresource_id, withcurrent_statusprocessing. Wait for the debit to succeed or fail, and refund it if it succeeds.
To release one authorized leg and keep the rest, cancel that leg with POST /v1/payment-intents/{payment_intent_id}/cancel, as in Manual capture.
Webhooks#
The pay response already tells your backend the outcome. Webhooks carry the same facts to systems that weren't part of the request:
There is no order-level payment-failed event. Handle payment_intent.payment_failed for every payment, then route on the owner links in data.object, such as order_id. Choosing the right event names the one event to fulfill from. Webhooks covers signature checks and durable handling.
Errors#
These are the errors specific to retrying and recovering a payment. Error handling covers the envelope and the codes every route shares.
Test it#
In a sandbox, these test cards produce each outcome. Use any future expiry date and any CVC.
| Card | Attempt status | Leg last_payment_error.code |
|---|---|---|
4000 0000 0000 0002 | failed | card_declined |
4000 0000 0000 9995 | failed | insufficient_funds |
4000 0000 0000 0069 | failed | expired_card |
4000 0000 0000 0127 | failed | incorrect_cvc |
4000 0000 0000 0119 | failed | processing_error |
4000 0000 0000 9987 | failed | lost_card |
4000 0000 0000 9979 | failed | stolen_card |
4100 0000 0000 0019 | failed | payment_blocked |
and both return requires_action with a 3D Secure challenge. Complete the challenge and resume, and the attempt succeeds. Fail it and resume, and the attempt ends failed with authentication_required. Test both branches. To see what any other card number does, paste it into the test card lookup.
To pay from a terminal or test suite without a browser, use the test tokens in Testing. To rehearse a lost response, send a pay request twice with the same Idempotency-Key and body. The second response carries Idempotency-Replayed: true.
Related guides#
- Embedded payments with Stripe Elements: the collect-and-pay flow these steps recover.
- Build your own checkout: the same recovery with a checkout session credential.
- 3D Secure: when banks ask for authentication, on every surface.
- Manual capture: authorize now, capture or cancel later.
- Idempotency: replays, conflicts, in-progress keys, and recovery reads.
- Error handling: the error envelope and structured details.
- Testing: every test card and token.
A decline on a paid-order edit's balance#
A pending paid-order edit collects through its own payment intent's confirm route. A decline leaves the edit pending and the order unchanged. Confirm that intent again with a new credential. When the bank asks for authentication, complete current_payment_action and confirm again. To give up, cancel the edit; this releases its holds and cancels its payment intent. An unpaid edit expires 24 hours after creation. Processing payments and payment reviews defer expiry until they resolve.
Investigate repeated declines#
A burst of declines across cards can indicate card testing. Flint applies hourly failure budgets and returns 429 with Retry-After when one is exhausted. Pause an attacked payment link and use your block lists after checking the attempt details.
Merchant reads of a payment intent include failed_attempt_count and failed_attempts. The count includes recorded payment failures, including issuer declines and processor blocks, even after a successful retry. The array contains the newest 50 failures, newest first. Each entry identifies the attempt and its decline code, plus the card brand, last four digits, issuing country, buyer IP, email, and merchant-scoped card fingerprint when those values were recorded. A processor block has decline code payment_blocked. Older attempts may have less evidence.
Use GET /v1/payment-intents?has_failed_attempts=true&status=requires_payment_method to find payments that have failed and still need payment details. Add payment_link_id to find payments for one link, including hosted pay, headless pay, and orders your server paid. The decline_code, card_fingerprint, buyer_ip_address, card_last4, and card_brand filters can narrow the results; combined evidence filters must match the same failed attempt. has_failed_attempts=false finds payments without a recorded failure. List cursors remain bound to these filters.
The fingerprint in failed_attempts.card_fingerprint is the value accepted by risk card-fingerprint lists. Use it to block a confirmed attacker card; last four digits alone cannot identify a card. buyer_email is the email used for risk evaluation when that attempt began. buyer_ip_address is the canonical address supplied by a trusted API-key relay, or the request address for a checkout credential. These fields and filters require merchant credentials and are withheld from buyer credentials.
A payment link's sales_summary.attempted_payment_count counts all recorded card attempts, including retries and pending attempts. failed_payment_count counts failed card attempts. A successful retry preserves the earlier failures. Read these counts with GET /v1/payment-links/{payment_link_id}?expand=sales_summary, then use card-testing protection and block lists to respond to an attack.