Stripe PaymentIntents

A PaymentIntent has seven statuses and none of them is failed

Most payment bugs we've chased trace back to someone treating a payment as one API call that either works or doesn't. A PaymentIntent is a state machine, and the state you forgot to handle is the one your European customers end up in. Here's every status, the transitions between them, where Strong Customer Authentication fits, manual capture, and SetupIntents, with the saved-card patterns from chapter 9 and the pitfalls from chapter 5.

A PaymentIntent is Stripe's object for one attempt to collect one amount from a customer, from the moment you know the price to the moment the money is yours. You create it on the server, the client confirms it with the customer's payment details, and it moves through a fixed set of statuses. Retries, 3D Secure and delayed bank payments all happen inside that one object, which is why Stripe asks you to create it "as soon as you know the amount" so every attempt is recorded (Stripe).

A SetupIntent is the same machine without the money. It collects and authenticates a payment method for later and never charges it. More on that below.

One thing has changed since most tutorials were written: Stripe's lifecycle page now recommends the Checkout Sessions API with the Payment Element for most new integrations, because the raw PaymentIntents API "requires significantly more code" (Stripe). A Checkout Session in payment mode still creates a PaymentIntent underneath, so the statuses below apply either way.

The PaymentIntent statuses

From Stripe's lifecycle page, checked November 2026. The last column is ours.

StatusWhat it meansWhat your code does
requires_payment_methodCreated, no payment method yet. Also where it returns after a failed attemptShow the payment form. Reuse this intent for the retry
requires_confirmationHas a payment method, not yet confirmed. Most integrations skip itConfirm it
requires_actionThe customer has to do something: 3D Secure, a bank redirectLet Stripe.js run next_action. Don't fulfill
processingSubmitted; a delayed method like a bank debit can sit here for daysShow "pending" and wait for the webhook
requires_captureAuthorized and held, because you asked for manual captureCapture before the authorization expires, or cancel
succeededThe payment flow is completeFulfill, from the webhook
canceledCanceled by you, or an uncaptured authorization expired. TerminalRelease the order. A new attempt needs a new intent

There is no failed status. A declined card sends the intent back to requires_payment_method "so that the payment can be retried", with the reason in last_payment_error. A bank debit that fails after days in processing goes back there too. If your code checks status == "failed", it is waiting for a value Stripe never sends.

How a payment moves

  1. Create the intent on the server with the amount and currency. It starts at requires_payment_method, and its client_secret goes to the browser.
  2. Confirm on the client with stripe.confirmPayment(). Card payments usually jump straight to succeeded.
  3. Authenticate if the issuer asks. The intent sits in requires_action; Stripe.js shows the 3D Secure challenge and the promise only resolves once the customer finishes or it times out (Stripe).
  4. Wait if the method is asynchronous. ACH and SEPA debits sit in processing before landing on succeeded or falling back to requires_payment_method.
  5. Fulfill on payment_intent.succeeded, never on the browser's word.

You can cancel an intent any time before it reaches processing or succeeded, and for some bank debits (ACH, SEPA, Bacs and others) while it's still processing. Cancellation releases any held funds and can't be undone. Stripe may also cancel an intent on its own if it's confirmed too many times (Stripe).

Where SCA fits

Strong Customer Authentication isn't a separate flow; it's the requires_action status. When a European issuer wants 3D Secure, the intent stops there with a next_action, and the Payment Element handles it while the customer is on your page. The hard case is when the customer isn't there. For an off-session charge you set off_session=True, and Stripe requests an exemption using details from an earlier on-session payment. If the issuer refuses, the request fails with a 402, the intent goes to requires_payment_method, and the decline code is authentication_required. Your job is to bring the customer back and confirm the same intent on-session with its client secret (Stripe):

import stripe

try:
    stripe.PaymentIntent.create(
        amount=2000,
        currency="usd",
        customer=customer_id,
        payment_method=saved_payment_method_id,
        off_session=True,
        confirm=True,
    )
except stripe.CardError as e:
    intent = e.error.payment_intent  # now requires_payment_method
    if e.code == "authentication_required":
        email_customer_to_finish(intent.id)  # they confirm it with intent.client_secret
    else:
        email_customer_new_card(intent.id)

Which payments get exempted, and who decides, is in SCA exemptions and 3DS2.

Manual capture: authorize now, charge later

Set capture_method="manual" and a successful confirmation stops at requires_capture with the funds held, firing payment_intent.amount_capturable_updated. Capture the full amount, or less with amount_to_capture; a partial capture releases the rest, and most payments allow only one capture (Stripe).

intent = stripe.PaymentIntent.create(
    amount=4999,  # minor units: $49.99
    currency="usd",
    automatic_payment_methods={"enabled": True},
    capture_method="manual",
    idempotency_key=f"order-{order_id}-pi",
)
# ...the customer confirms in the browser; status becomes requires_capture
stripe.PaymentIntent.capture(intent.id, amount_to_capture=3999)  # ship part, charge part

The hold doesn't last. Stripe's authorization windows for online card payments, checked November 2026:

Card brandCustomer-initiatedMerchant-initiated
Visa7 days5 days (exactly 4 days 18 hours)
Mastercard7 days7 days
American Express7 days7 days
Discover7 days7 days

In-person Terminal payments get less: 5 days on Visa and 2 on the others. Miss the window and the funds are released and the intent becomes canceled, so schedule captures from the charge's payment_method_details.card.capture_before, not from a constant (Stripe). Stripe classifies a payment as customer- or merchant-initiated from what actually happened, not from your off_session flag, so a card with a CVC attached can land in the customer-initiated window.

SetupIntent vs PaymentIntent

Use a SetupIntent when you need the card now and the money later: a free trial, a usage bill at month end, a saved card for one-click checkout. It runs through the same statuses minus requires_capture, authenticates the card with 3D Secure up front where needed, and on success attaches the payment method to the customer. Its usage defaults to off_session; set on_session only if you'll always charge with the customer present (Stripe). Then charge it later with a PaymentIntent, as above.

If you're taking a payment now and saving the card, you don't need both. Pass setup_future_usage on the PaymentIntent instead. And whichever you use, saving a card for later needs the customer's consent in your terms, which Stripe puts on you (Stripe).

Chapter 9's minimal SetupIntent and the off-session charge that follows it.

Setup Intents (Saving Cards)

A Setup Intent saves a payment method for later without charging it now:

setup_intent = stripe.SetupIntent.create(
    customer=customer_id,
    payment_method_types=['card'],
    usage='off_session'  # For future off-session payments
)

Off-Session Payments

Charge a saved card without the customer present:

intent = stripe.PaymentIntent.create(
    amount=1000,
    currency='usd',
    customer=customer_id,
    payment_method=saved_payment_method_id,
    off_session=True,
    confirm=True
)

The four mistakes that turn this state machine into support tickets. From chapter 5, which is provider-neutral; on Stripe, the second one is the requires_action status.

1. Assuming Payments Are Instant

Mistake: Treating all payments as synchronous operations. Reality: Many payment methods take hours or days. Bank transfers regularly take 3-5 business days. Solution: Build async processing into your system from day one, before you have customers waiting on it.

2. Not Handling "Requires Action" State

Mistake: Only handling success and failure states. Reality: Many payments require additional customer action, especially in Europe under SCA. Solution: Always implement handling for customer action requirements, or lose European customers entirely.

3. Inconsistent State Between Systems

Mistake: Relying only on payment provider state without maintaining your own records. Reality: Networks fail, webhooks get lost, providers have outages. Your data will diverge from theirs. Solution: Maintain payment state in your own database and reconcile regularly. Trust but verify.

4. Poor Error Handling

Mistake: Generic error messages like "Something went wrong" that don't help customers resolve the issue. Reality: Different failure reasons require different customer actions. "Insufficient funds" needs a different response than "card expired." Solution: Provide specific, actionable error messages mapped to the underlying decline code.

There's one exception, and it runs the other way. Stripe's decline code reference says lost_card, stolen_card, fraudulent and merchant_blacklist must be shown to the customer exactly as a generic_decline would be. Telling a fraudster "this card has been reported stolen" just tells them to try the next one on the list. pickup_card and restricted_card aren't on Stripe's list, but they can also mean lost or stolen, so a plain "your card was declined, please contact your bank" is the safe message there too.

Questions

What is a PaymentIntent in Stripe?

A PaymentIntent is the Stripe object that tracks one attempt to collect one amount, from creation to completion. It moves through statuses such as requires_payment_method, requires_action, processing and succeeded, and it handles retries and 3D Secure inside the same object.

What are the PaymentIntent statuses?

requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, succeeded and canceled. There is no failed status: a failed attempt returns the intent to requires_payment_method so it can be retried.

What is the difference between a SetupIntent and a PaymentIntent?

A PaymentIntent charges the customer. A SetupIntent collects and authenticates a payment method for future use without charging it, then attaches it to the customer so you can charge it later with a PaymentIntent.

What does requires_action mean on a Stripe PaymentIntent?

The customer has to complete a step before the payment can continue, usually 3D Secure authentication or a bank redirect. Stripe.js handles it when the customer is on the page. Don't fulfill the order until the intent succeeds.

How long can I hold a payment before capturing it on Stripe?

For online card payments, usually 7 days. Merchant-initiated Visa payments get 5 days, and in-person payments get 2 days on most brands. If you don't capture in time, the funds are released and the PaymentIntent becomes canceled.

What the book adds

What chapters 9 and 5 add

  • The complete Stripe integration, Checkout to Connect
  • Error handling by Stripe error type
  • Authorization, capture and partial refunds as code
  • Recovery patterns: retries, circuit breakers, degradation
  • A production checklist for going live

30-day money-back · Instant PDF and EPUB

All 42 chapters