How to Update Customer Credit Card in Stripe
A card expires. A bank reissues a number after fraud. A payment fails and you need a fresh card on file. Whatever the trigger, you need to update the card without breaking the subscription.
This guide covers three ways to do it: the manual Dashboard flow, the API flow for developers, and the automated flow that handles updates at scale. Pick the one that fits your situation.
Can you update a customer's card directly in Stripe?
Yes. Stripe stores cards as PaymentMethod objects attached to a Customer. To "update" a card, you almost never edit the old one—you attach a new PaymentMethod and set it as the default. The old card stays on record until you detach it.
This matters for two reasons:
- You can keep a backup card on file.
- You avoid a gap where the customer has no valid payment source.
Two fields control which card gets charged:
invoice_settings.default_payment_methodon the Customer — used for subscriptions and invoices.default_source— the legacy field. Useinvoice_settings.default_payment_methodfor new integrations.
How to update a card manually in the Stripe Dashboard
Use this when you have a handful of customers or you're troubleshooting one account.
- Open the Stripe Dashboard and go to Customers.
- Search for the customer by email or name and open their profile.
- Scroll to Payment methods.
- Click Add payment method and enter the new card details.
- Click the ⋯ menu next to the new card and select Make default.
- Optional: remove the old card with Delete.
The next invoice or renewal charges the new default card automatically—you don't touch the subscription itself.
One caveat: manually typing card numbers puts you in a higher PCI compliance tier. For most businesses, it's better to let the customer enter their own card. That's where the API and hosted pages come in.
How to update a card with the Stripe API
You want a self-serve flow, not customers calling support. Here's the clean version using PaymentMethods.
Step 1: Collect the new card securely
Never send raw card numbers to your server. Use Stripe Elements or a Checkout/SetupIntent flow on the client to tokenize the card. A SetupIntent is the right tool when you're saving a card for future charges.
// Client side — confirm a SetupIntent with Stripe.js
const { setupIntent, error } = await stripe.confirmCardSetup(
clientSecret,
{
payment_method: {
card: cardElement,
billing_details: { name: "Jane Doe" },
},
}
);
// setupIntent.payment_method is the new PaymentMethod ID
Step 2: Attach the PaymentMethod and set it as default
On your server, attach the new PaymentMethod to the customer and update the default.
// Server side (Node)
await stripe.paymentMethods.attach(paymentMethodId, {
customer: customerId,
});
await stripe.customers.update(customerId, {
invoice_settings: {
default_payment_method: paymentMethodId,
},
});
Step 3: Detach the old card (optional)
await stripe.paymentMethods.detach(oldPaymentMethodId);
The subscription now charges the new card on the next cycle. If you have an open unpaid invoice, retry it right away:
await stripe.invoices.pay(invoiceId, {
payment_method: paymentMethodId,
});
What about the Stripe Customer Portal?
If you don't want to build a card-update UI yourself, use the Stripe Customer Portal—a hosted page where customers update payment methods, view invoices, and manage subscriptions.
const session = await stripe.billingPortal.sessions.create({
customer: customerId,
return_url: "https://yourapp.com/account",
});
// Redirect the customer to session.url
Enable "Payment methods" in your Portal settings, and customers can add and switch cards without you writing a single form. This is the fastest path for most SaaS teams.
How do you update cards automatically for failed payments?
Manual updates and self-serve portals both assume the customer shows up to fix the problem. Most don't. When a card fails silently, the customer forgets, the subscription cancels, and you lose revenue you never see.
Two features handle this without human effort:
- Card Account Updater: Stripe automatically refreshes expired or reissued card numbers with participating networks (Visa, Mastercard, and others). No customer action needed. It's on by default for many accounts—check your Dashboard settings.
- Automated dunning: when a charge fails, you retry on a smart schedule and email the customer a secure link to update their card. This recovers the failures the Account Updater can't fix.
Stripe's built-in Smart Retries help, but they're limited on timing and email design. We break down where they fall short in why Stripe Smart Retries aren't enough. For the full picture of what causes these failures, see our guide to Stripe failed payments.
The math is simple: involuntary churn from failed payments costs most SaaS companies around 9% of revenue. A good recovery flow turns most of those failures back into paying customers. See the involuntary churn benchmark for SaaS for the numbers.
Which method should you use?
| Situation | Best method | |---|---| | One-off fix or support request | Manual Dashboard | | Self-serve card change | Customer Portal | | Custom in-app flow | SetupIntent + API | | Expired/reissued cards | Card Account Updater | | Failed payments at scale | Automated dunning |
Most teams combine the Portal for self-serve, the Account Updater for silent refreshes, and dunning for recovery.
FAQ
Does updating a card cancel the subscription? No. Attaching a new PaymentMethod and setting it as default leaves the subscription untouched. The next invoice charges the new card.
Will the new card be charged for an existing unpaid invoice?
Not automatically until the next retry. To charge immediately, call invoices.pay with the new PaymentMethod, or trigger a retry through your dunning flow.
Do I need to delete the old card? No. Stripe keeps it on file as a backup unless you detach it. Detaching is optional and reversible only by re-adding the card.
Can I update multiple customers' cards at once? Not manually in a practical way. Use Card Account Updater for expired cards, and an automated dunning tool to prompt customers with failed payments to update themselves.
What's the difference between default_source and default_payment_method?
default_source is the legacy field tied to the older Sources API. invoice_settings.default_payment_method is the modern field for PaymentMethods. Use the latter.
Updating a card is easy. Getting customers to actually do it after a failed payment is the hard part. RecoverBill connects to Stripe in about two minutes, retries failed charges on a smart schedule, and emails customers a secure link to update their card—so you recover the ~9% of revenue you'd otherwise lose. If you're comparing options, our rundown of failed payment recovery software is a good place to start.