Skip to content

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.

The browser never confirms the PaymentIntent. The create response has no client secret, so the first confirmation always comes from your server, through your risk rules and Flint's idempotency. If the buyer has to act, the confirm response carries a Stripe client secret for that step. It can also confirm the payment, so pass it only to handleNextAction and take the outcome from your server. Cards, Apple Pay, Google Pay, ACH debit, and Affirm all use this flow.

If you're selling items, use an order instead. An order carries line items, tax, and totals, and you pay it through the order as Embedded payments describes. A checkout session gives you a Flint-hosted page. Orders first helps you choose.

How it works#

A server-confirmed paymentResponse
BrowserYour serverFlintStripePOST /v1/payment-intentspayment_collectionmount Elements, create a ConfirmationTokenthe token's ctoken_ IDPOST /confirm with the tokenstatus, and current_payment_action if the buyer must acthandleNextAction, for 3D SecurePOST /confirm with credential_type attachedthe outcome, also sent by webhook
  1. Your server sends POST /v1/payment-intents to Flint
  2. Flint returns payment_collection to Your server
  3. Browser sends mount Elements, create a ConfirmationToken to Stripe
  4. Browser sends the token's ctoken_ ID to Your server
  5. Your server sends POST /confirm with the token to Flint
  6. Flint returns status, and current_payment_action if the buyer must act to Your server
  7. Browser sends handleNextAction, for 3D Secure to Stripe
  8. Your server sends POST /confirm with credential_type attached to Flint
  9. 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#

  1. Create the PaymentIntent#

    Your server names the amount and the payment options the buyer may use. Idempotency-Key is required: reuse it when you retry the same create, so a timeout doesn't make a second PaymentIntent.

    cURL
    curl -X POST https://api.withflintpay.com/v1/payment-intents \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: topup-1001" \
      -d '{
        "amount_money": {"amount": 4200, "currency": "USD"},
        "payment_options": ["card", "apple_pay", "google_pay"],
        "external_reference_id": "topup_1001"
      }'
    
    Response
    {
      "data": {
        "payment_intent_id": "pi_1kmn0aExample",
        "status": "requires_payment_method",
        "supported_actions": ["confirm", "cancel"],
        "amount_money": {"amount": 4200, "currency": "USD"},
        "capture_method": "automatic",
        "payment_options": ["card", "apple_pay", "google_pay"],
        "payment_flow": "api",
        "external_reference_id": "topup_1001",
        "last_payment_error": null,
        "version": 1,
        "payment_collection": {
          "stripe": {
            "account_id": "acct_Example",
            "publishable_key": "pk_test_Example",
            "elements": {
              "next_step": "create_confirmation_token",
              "submit_to": "confirm_payment_intent",
              "mode": "payment",
              "amount_money": {"amount": 4200, "currency": "USD"},
              "payment_method_types": ["card"],
              "digital_wallets": ["apple_pay", "google_pay"],
              "payment_method_creation": "manual"
            }
          }
        }
      },
      "request_id": "req_01KWM6XKAEP3K57S07NV6W8BG3"
    }
    

    Store payment_intent_id with your own record, and pass payment_collection.stripe to the browser unchanged. Wallets are card payments, so payment_method_types lists card and digital_wallets lists the wallets to show.

    Other create options:

  2. Mount the Payment Element#

    Load Stripe.js for the connected account in payment_collection.stripe, and create deferred Elements from elements as returned. Pass payment_method_options through whole when it's present: for ACH debit, Stripe requires the options the browser collected with to match the ones Flint confirms with.

    HTML
    <script src="https://js.stripe.com/v3/"></script>
    
    <form id="payment-form">
      <div id="payment-element"></div>
      <button type="submit">Pay $42.00</button>
      <div id="payment-message" role="alert"></div>
    </form>
    
    JavaScript
    // Your server relays the create response's payment_collection.stripe.
    const collection = paymentCollection.stripe;
    const guidance = collection.elements;
    
    const stripe = Stripe(collection.publishable_key, {
      stripeAccount: collection.account_id,
    });
    
    const elements = stripe.elements({
      mode: guidance.mode,
      amount: guidance.amount_money.amount,
      currency: guidance.amount_money.currency.toLowerCase(),
      paymentMethodCreation: guidance.payment_method_creation,
      paymentMethodTypes: guidance.payment_method_types,
      ...(guidance.payment_method_options
        ? {paymentMethodOptions: guidance.payment_method_options}
        : {}),
    });
    
    const wallets = guidance.digital_wallets ?? [];
    elements
      .create("payment", {
        wallets: {
          applePay: wallets.includes("apple_pay") ? "auto" : "never",
          googlePay: wallets.includes("google_pay") ? "auto" : "never",
        },
      })
      .mount("#payment-element");
    

    The wallets option hides a wallet the PaymentIntent doesn't allow. Flint refuses a token for a payment option that isn't in payment_options.

    If the buyer reloads the page or comes back later, read the PaymentIntent with GET /v1/payment-intents/{payment_intent_id}. While its status is requires_payment_method or requires_confirmation, the read includes a current payment_collection.

  3. Create the ConfirmationToken#

    When the buyer submits, call elements.submit() to validate the form, then create the token and send its ID to your server.

    JavaScript
    document.querySelector("#payment-form").addEventListener("submit", async (event) => {
      event.preventDefault();
    
      const {error: submitError} = await elements.submit();
      if (submitError) return showMessage(submitError.message);
    
      const {error, confirmationToken} = await stripe.createConfirmationToken({
        elements,
        params: {
          payment_method_data: {
            billing_details: {name: buyer.name, email: buyer.email},
          },
        },
      });
      if (error) return showMessage(error.message);
    
      const response = await fetch("/api/topups/1001/confirm", {
        method: "POST",
        headers: {"Content-Type": "application/json"},
        body: JSON.stringify({confirmation_token: confirmationToken.id}),
      });
      await handleResult(await response.json());
    });
    

    Send accurate billing details. ACH debit requires both the name and the email. A Stripe.js error at this point means Stripe rejected the form, and nothing reached Flint.

    The token is a payment credential. Send it only to your server, over HTTPS, and keep it out of logs, analytics, and browser storage.

  4. Confirm from your server#

    Send the token with credential_type: "stripe_confirmation_token":

    cURL
    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 '{"credential_type": "stripe_confirmation_token", "stripe": {"confirmation_token": "ctoken_Example"}}'
    
    Response
    {
      "data": {
        "payment_intent_id": "pi_1kmn0aExample",
        "status": "succeeded",
        "supported_actions": [],
        "amount_money": {"amount": 4200, "currency": "USD"},
        "captured_money": {"amount": 4200, "currency": "USD"},
        "captured_at": "2026-10-28T18:04:12Z",
        "selected_payment_option": "card",
        "payment_source": {
          "type": "card",
          "card": {"brand": "visa", "last4": "4242"}
        },
        "last_payment_error": null,
        "current_payment_action": null,
        "version": 3
      },
      "request_id": "req_01KWM6WAHG3N9Q8T2V5XRZ7C4D"
    }
    

    An idempotency key built from the PaymentIntent and token IDs, as here, stays the same when you retry the same confirmation and changes when the buyer tries again with a new token. Idempotency-Key is optional on confirm, and a key replays its result for 24 hours.

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:

statusWhat happenedWhat to do
succeededThe payment was collected.Fulfill, or wait for payment_intent.succeeded if you fulfill from webhooks.
requires_captureA manual capture hold is in place.Capture or cancel it before authorization_expires_at.
processingAn ACH debit was submitted, and the bank hasn't answered.Wait for payment_intent.succeeded or payment_intent.payment_failed.
requires_actionThe buyer must act, usually for 3D Secure, or to approve an Affirm plan.Run the buyer action.
requires_payment_methodThe 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.

Choose a credential#

The first confirmation names exactly one credential in credential_type:

credential_typeFieldUse it for
stripe_confirmation_tokenstripe.confirmation_tokenA ConfirmationToken the browser created from payment_collection.stripe. This is the normal case.
tokenpayment_source_tokenA processor payment method ID, such as the pm_... that stripe.createPaymentMethod returns.
payment_methodpayment_method_idA saved payment method that belongs to the PaymentIntent's customer.
attachedNoneContinuing after a buyer action. See Continue with the attached credential.

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.

Handle 3D Secure and other buyer actions#

When the bank asks the buyer to authenticate, the confirm response has status: "requires_action" and a current_payment_action:

JSON
{
  "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",
      "client_action": {
        "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 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.

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:

JavaScript
// 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 action = result.current_payment_action.client_action.stripe;
  if (action.payment_intent?.stripe_js_call !== "handle_next_action") {
    throw new Error("Unsupported payment action");
  }

  const actionStripe = Stripe(action.publishable_key, {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 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 with credential_type: "attached". Don't send a new credential: the continuation uses the payment attempt, credential, and risk decision of the first confirmation.

cURL
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 '{"credential_type": "attached"}'

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, or processing.
  • The buyer hasn't finished: the result is still requires_action, with current_payment_action again. This is also how you get the action back after a lost response.
  • Authentication failed: the result is requires_payment_method with last_payment_error.code authentication_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 with credential_type: "attached", and contact support with the request_id if the action stays null.

Continuations are safe to repeat. Two continuations at once, even with different idempotency keys, lead to one confirmation at the processor.

attached works only for a PaymentIntent that a confirmation has already started:

  • On a PaymentIntent that was never confirmed, it returns 400 INVALID_REQUEST with detail code REQUIRED on stripe.confirmation_token. Send the buyer's credential instead.
  • Once status is succeeded, canceled, expired, processing, or requires_capture, supported_actions no longer lists confirm, and confirm returns 409 ACTION_NOT_ALLOWED with current_status. The exception is a confirmation Flint started and hasn't finished recording: attached finishes 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:

Response
{
  "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": "Try again with a different payment method."
      }
    },
    "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.

  1. Retry the lost request with the same Idempotency-Key and body. A request Flint finished replays its result with Idempotency-Replayed: true.
  2. If you no longer have the key, read the PaymentIntent with GET /v1/payment-intents/{payment_intent_id}. The read doesn't include current_payment_action.
  3. If status is requires_action, confirm with credential_type: "attached" to get the action. Run it in the browser if the buyer hasn't, then confirm with attached again to continue.
  4. If status is requires_confirmation, a confirmation was interrupted. Confirm with attached to finish it.
  5. Stop when status is succeeded, requires_capture, processing, canceled, or expired. At requires_payment_method, read last_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 5xx or a timeout means you don't know the outcome. Retry with the same key. Flint records the real outcome once the processor reports it, and never writes last_payment_error for an outcome it couldn't learn. 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 works for standalone PaymentIntents, the only ones /confirm accepts. 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 with PATCH /v1/payment-intents/{payment_intent_id} while the status is requires_payment_method.
  • Your credential can save cards. The API key or partner token needs payments.payment_methods.write as well as payments.payment_intents.write.
  • The credential is new. Send a card, Apple Pay, or Google Pay credential collected for this confirm: a stripe.confirmation_token created with setupFutureUsage: "off_session", or a payment_source_token. A saved payment_method_id is already kept, so it can't be sent with save_payment_method: true.
  • Card payments are enabled for the environment. Until they are, the save fails with 409 MERCHANT_NOT_READY, with reason capability_not_requested or onboarding_required.

Create the PaymentIntent with the customer:

cURL
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:

JavaScript
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: true with a token created without setupFutureUsage, or with "on_session", returns 400 INVALID_REQUEST with detail code NOT_ALLOWED on stripe.confirmation_token. Create a new token after elements.update finishes.
  • A token created with setupFutureUsage, sent without save_payment_method: true, returns the same error. Send the buyer's choice, or create the token without setupFutureUsage.
  • Only a card, Apple Pay, or Google Pay can be saved. A bank account or Affirm with save_payment_method: true returns 400 INVALID_REQUEST with detail code NOT_ALLOWED. When the PaymentIntent also offers ACH debit or Affirm, clear setupFutureUsage before creating a token for one, and leave save_payment_method out.

Confirm with save_payment_method#

cURL
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 '{
    "credential_type": "stripe_confirmation_token",
    "stripe": {"confirmation_token": "ctoken_Example"},
    "save_payment_method": true
  }'

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 {"credential_type": "attached"} 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.

  1. Handle the payment_method.activated webhook. Its object is the saved card, with its payment_method_id, customer_id, status: "active", and usage: "off_session". You can charge it from then on.
  2. To link the card to this payment, read the PaymentIntent. payment_source.card.payment_method_id names the saved card. Flint sets it after saving the card and sends payment_intent.updated when it does, so payment_method.activated can arrive first. If the field isn't there yet, wait for that payment_intent.updated.
cURL
curl https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "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's save_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.

  • HTTP 400
    param names the field to correct. stripe.confirmation_token with detail code REQUIRED: the first confirmation needs a credential. stripe.confirmation_token with INVALID_VALUE: the token was created for another environment or account, or an ACH debit token lacks the buyer's online mandate acceptance or a billing name and email; create a new token from the returned payment_collection. NOT_ALLOWED: the token's payment option isn't in the PaymentIntent's payment_options, more than one credential was sent, or the token's setupFutureUsage doesn't match save_payment_method. On save_payment_method with REQUIRED: it was sent with a saved payment_method_id, with no credential, or on a continuation.
  • HTTP 403
    The API key or partner token lacks payments.payment_methods.write, which save_payment_method: true needs. Nothing else happens. Add the scope, or confirm without save_payment_method.
  • HTTP 404
    The PaymentIntent doesn't exist in this environment, or, with save_payment_method, its customer doesn't exist or was deleted.
  • HTTP 409
    Reason terminal_status with param stripe.confirmation_token: the token expired or another PaymentIntent used it; create a new one. Reason order_owned: the PaymentIntent belongs to an order, so pay it through the order. Reason configuration_required with param save_payment_method: the PaymentIntent has no customer_id. Reason in_progress: another confirmation of this PaymentIntent is still running, so read the PaymentIntent and follow Recovery and idempotency; or, with save_payment_method, the customer is being deleted, so no card can be saved for them. With current_status and no param: the PaymentIntent's status no longer accepts confirm.
  • HTTP 409
    OPERATION_IN_PROGRESSRetry the same request
    Another confirmation of this PaymentIntent is still running. Wait for Retry-After when present, then resend the same request with the same Idempotency-Key.
  • HTTP 409
    VERSION_CONFLICTRefresh, then retry
    The PaymentIntent changed while Flint was confirming it, such as its amount, or expected_version is stale. Read it again and rebuild the request with a new key.
  • HTTP 409
    The account can't take this payment yet. details[0].reason names the readiness step to finish.
  • HTTP 409
    The payment option, or saving cards, isn't available for this merchant or amount. Offer another option, or confirm without save_payment_method.

Order-linked PaymentIntents#

/confirm is for standalone PaymentIntents only. A PaymentIntent created through an order never lists confirm in supported_actions, and /confirm refuses it with 409 ACTION_NOT_ALLOWED and reason order_owned. remediation.next_actions names the order's pay route. Pay it with POST /v1/orders/{order_id}/pay, and continue a buyer action there with action: "resume" and the order_payment_attempt_id, as Embedded payments describes.

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 token credential:

cURL
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 '{"credential_type": "token", "payment_source_token": "pm_card_visa"}'
AliasOutcome
pm_card_visaThe PaymentIntent is succeeded.
pm_card_chargeDeclinedThe PaymentIntent is back at requires_payment_method with last_payment_error.code of card_declined.
pm_card_chargeDeclinedInsufficientFundsThe same, with insufficient_funds.
pm_card_authenticationRequiredThe 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.

Declines and payment attemptsEvery decline code, buyer messages, and how last_payment_error changes.Manual capturePlace a hold at confirmation, then capture part or all of it.ACH debit paymentsBank debits on the same flow, with mandates and settlement.Save a card and charge it laterSave a card without a payment, and charge it off session.

Was this helpful?