Troubleshooting8 min read
Stripe 500 Error But Payment Succeeded? How to Fix It Safely
A Stripe 500 error payment succeeded anyway? Learn why idempotent retries replay the error and the exact steps to reconcile it safely in 2026.
By Babul Jack
Troubleshooting8 min read
A Stripe 500 error payment succeeded anyway? Learn why idempotent retries replay the error and the exact steps to reconcile it safely in 2026.
By Babul Jack
When a Stripe API call returns a 500 error but the payment succeeded, the charge usually did go through — the response just never confirmed it. Stripe calls this an "indeterminate" outcome: the server error happened after Stripe started processing your request, so it cannot tell you whether the operation completed. You have to reconcile it yourself using the Dashboard, the object's current state and a verified webhook event, not by guessing or retrying blindly.
I've hit this exact failure mode in client fintech integrations more than once, usually during a Stripe incident window or a flaky network hop between our servers and Stripe's API. The support ticket always reads the same way: "customer says they were charged twice" or "customer says nothing happened, but we see a red error in our logs." Neither statement is reliable until you check the record Stripe actually kept.
Stripe's own error-handling guidance is blunt about this: a 500, 502, 503 or 504 response means something went wrong on Stripe's side, and you should "treat the result of the API call as indeterminate" rather than assuming success or failure (Stripe error handling docs). The request may have fully executed before the response failed to come back cleanly.
This is different from a card decline or an invalid-parameter error, both of which are definitive. A card_error or invalid_request_error tells you exactly what happened and what to fix. A 500 tells you nothing except "ask again, carefully."
This is the part most teams get wrong, and it's exactly what caused a round of support confusion during Stripe's November 2026 incident window. Stripe's advanced error-handling guide explains that for API v1, Stripe caches the status code and body of the first response after it starts executing an endpoint — including a 500 (Stripe advanced error handling). If your client retries the same request with the same Idempotency-Key, Stripe doesn't attempt the operation again. It just replays the cached response, with an Idempotent-Replayed: true header attached.
So your retry logic can report the same 500 ten times in a row, while the underlying charge or payment intent was created successfully on the very first attempt. A journalist covering this exact scenario summed it up well: "the cached 500 does not turn green when reconciliation advances" (btw.media incident analysis). Stripe may later reconcile the failed-looking operation and fire a webhook for the object your API call never confirmed — but the stored error response stays exactly as it was.
Stripe keeps idempotency keys for at least 24 hours before they can be pruned, and the comparison only applies when you reuse the same key with the same parameters (Stripe idempotent requests reference). Reuse the key with different parameters and you'll get a distinct idempotency_error instead — a separate failure mode worth distinguishing from the 500 case.
Don't fire a second payment attempt with a new idempotency key until you've closed this loop. Stripe is explicit that doing so "can start a separate operation" — meaning a genuine double charge.
Request-Id header. Log it before you do anything else; you'll need it if you escalate to Stripe support.PaymentIntent or Charge ID returned in a partial response, or one you generated client-side via metadata). A GET request is always safe to repeat.last_payment_error on the PaymentIntent. This field holds the error from the previous confirmation attempt — but remember Stripe clears it on the next update, so an empty value does not prove the payment never failed (error handling reference).payment_intent.succeeded, charge.succeeded, or the failure equivalents) before telling a customer or your finance system anything definitive.import stripe
stripe.api_key = "sk_live_..."
def reconcile_payment_intent(pi_id):
pi = stripe.PaymentIntent.retrieve(pi_id)
if pi.status == "succeeded":
return "paid", pi.id
if pi.last_payment_error:
return "failed", pi.last_payment_error.get("type")
return "pending", None
Stripe's retry contract depends on which API generation handled the request, so a single generic "retry the 500" playbook doesn't work across both.
| Behavior | API v1 | API v2 |
|---|---|---|
| What gets cached | Full response (status + body), including 500s | Not a flat cache — Stripe tracks operation state |
| Retry with same key | Returns the stored response unchanged | Attempts to complete unfinished work, returns an updated response |
| Can a retry "fix" a stale 500 | No — you must reconcile manually | Often yes — Stripe completes or reports the real outcome |
| Key retention | At least 24 hours, then prunable | Managed per API v2 idempotency semantics |
Source: Stripe idempotent requests and advanced error handling.
If your integration mixes v1 PaymentIntents with newer v2 endpoints, check which contract handled the failing call before you decide how to retry it.
Webhooks are the only channel guaranteed to reflect what actually happened on Stripe's side, independent of whatever your HTTP client received or timed out on. Stripe's guidance lists "monitor webhooks" as a first-class technique precisely because API responses can be lost, cached, or indeterminate while the underlying operation still completes (error handling guide).
In practice, that means your webhook handler — not your checkout request handler — should be the source of truth that marks an order as paid. I build this pattern into every Stripe integration I ship for clients: the synchronous API call only initiates or displays a loading state, and a verified webhook event is what flips the order to "paid" in the database. For the webhook signature-verification step itself, see our walkthrough on fixing Stripe webhook signature verification failures.
Only retry a POST with the same idempotency key and the same parameters, and only within the 24-hour window Stripe retains that key (idempotent requests reference). Generating a fresh key because the first attempt "looked like it failed" is the single most common cause of accidental duplicate charges I see in client codebases.
If the 24-hour window has passed and you still don't know the outcome, Stripe's own guidance is to stop retrying entirely and contact support with the request ID rather than guessing with a new key.
const { randomUUID } = require('crypto');
async function chargeOnce(stripe, params, idempotencyKey = randomUUID()) {
try {
return await stripe.paymentIntents.create(params, { idempotencyKey });
} catch (err) {
if (err.type === 'StripeAPIError') {
// Indeterminate: reconcile via retrieve + webhook, don't retry with a new key
throw new Error(`Indeterminate Stripe response, reconcile key ${idempotencyKey}`);
}
throw err;
}
}
Store idempotencyKey alongside the order record before the call, not after — that's what lets support and finance match a later webhook back to the original attempt.
Teams that only discover this behavior during an incident tend to bolt on reconciliation logic after the fact, which is messier than designing for it from day one. When we build or harden payment integrations through web app development engagements, idempotency keys, webhook-first order confirmation and a reconciliation job that sweeps "pending" PaymentIntents older than a few minutes are standard, not optional. The same pattern applies whether you're reconciling Stripe, a SEPA Direct Debit flow, or a migration like PayPal's Payments API v2 — any payment API that supports retries needs the same discipline around indeterminate responses.
A good reconciliation sweep is simple: query PaymentIntents in a requires_action or unknown state older than your timeout, retrieve each one, and resolve it against webhook history before alerting a human.
No. A 500 means the outcome is indeterminate, not that it succeeded. The underlying operation may have completed, partially completed, or genuinely failed — you have to check the object and webhook history to know which.
Because Stripe caches the first response for a given idempotency key on API v1, including error responses, and returns that cached copy on retry with an Idempotent-Replayed: true header instead of re-running the operation.
Only after you've confirmed the original request truly failed and produced no object. Generating a new key while the outcome is still unknown risks creating a second, duplicate charge.
At least 24 hours. After that, Stripe may prune the key, and reusing it starts a brand-new request instead of returning a cached result.
No, not in the same way. API v2 retries are designed to complete unfinished work and return an updated response rather than replaying a flat cached body, so the reconciliation steps differ between the two API generations.
Need a hand with this in your own product? See my web app development service.