Start with the affected invoice
When a recurring payment fails, find the affected invoice and subscription before changing the customer's access. The invoice records a bill; a payment attempt records an effort to collect it; the subscription has its own lifecycle. Your app still needs a rule for what the customer can use while the problem is resolved.
This guide is for someone building or checking a subscription app, including an app generated with AI. It uses Stripe Billing as a documented example and an invented service policy. It does not assume that every failed payment should immediately lock a customer out.
For an initial one-time checkout and duplicate fulfillment, read the webhook lesson. Refunds and disputes have a separate guide. Here the question is what happens at the next billing period, including failed collection, a temporary grace period and later recovery.
Read the invoice and subscription together
For Stripe subscriptions that charge automatically, an initial payment needing completion can leave the subscription incomplete. A later renewal failure instead produces past_due. Do not apply a returning customer's grace rule to a first checkout that never established paid access.
After the retry process, the configured outcome can leave a subscription past_due or move it to unpaid or canceled. Those settings matter. Active is also not proof that every historical invoice was paid: Stripe supports status resolution based on the latest relevant invoice or all applicable outstanding invoices.
Record the collection method, invoice ID, subscription ID, billed period, amount and currency. Then read the current payment and subscription states. Keep your access labels, such as paid, grace and restricted, separate from provider statuses.
Our example covers one automatically charged monthly subscription with one outstanding renewal. Trials, manually sent invoices, delayed payment methods, mixed billing intervals and multiple subscriptions require their own cases. A single rule copied from this exercise would not cover them.
Check whether another charge can actually happen
A retry schedule is not a promise of a successful charge. Stripe documents cases where automatic retries do not execute, including no available payment method and certain hard declines. Check the failure reason and supported payment method instead of repeatedly asking the customer to wait.
A scheduled attempt count can increase even when a hard decline prevents a new charge. Inspect the actual payment evidence before telling a customer that money was taken several times.
The default payment method also has a priority order. If a subscription has its own default, changing only the customer's general default may leave the retry using the old method. Verify which setting controls the affected subscription.
Stripe exposes a next payment attempt time on the invoice. For integrations using Billing automations, its documentation directs readers to invoice.updated for that field rather than assuming it appears in invoice.payment_failed. Read the current object and configuration; do not hard-code a universal retry date.
A failure requiring customer authentication needs a customer action. An invoice.payment_failed event and an invoice.payment_action_required event are useful signals for different recovery paths.
Worked timeline: a 72-hour grace period
Imagine a fictional workspace costing $18 per month. Its last paid period runs from November 1, 2026 at 09:00 UTC up to December 1 at 09:00 UTC. The renewal invoice I-72 covers December 1 at 09:00 UTC up to January 1, 2027 at 09:00 UTC. There are no taxes, discounts, plan changes or other unpaid invoices in this exercise.
The invented policy allows existing customers 72 hours of grace after that renewal boundary. If the invoice remains unpaid, premium access becomes restricted at December 4 at 09:00 UTC. Account sign-in, billing help and the policy's permitted data-export route remain available. These are example terms, not Stripe defaults or a universal legal rule.
At December 1, 09:00 UTC, collection fails. Store the failure against I-72 and show grace access with the deadline. December 2 at 21:00 UTC is 36 hours after the boundary: 36 hours of grace remain. A retry notification does not restart this clock.
Suppose payment succeeds on December 3 at 09:00 UTC. That is 48 hours after the boundary and before the 72-hour deadline. After confirming the current invoice and subscription state, the example grants the already defined period through January 1 at 09:00 UTC. It does not add a fresh month from December 3 or extend the end to January 3.
In the alternative case, no payment succeeds by December 4 at 09:00 UTC. The app restricts premium access under this policy and explains the recovery route. The invoice may still be open and collection may still be eligible; restricting access is not a statement that the bill was canceled, refunded or paid.
Write down both clocks: the billing period and the access grace deadline. If your real terms promise a different service period after recovery, model that explicitly and test the provider configuration. Do not silently shift dates because a payment notification arrived late.
Recover access without trusting the last notification
Stripe's subscription webhook guidance describes provisioning after invoice.paid when the subscription is active. In an app, also match the customer, subscription, invoice and billed period to the entitlement being considered. A paid invoice for an older or unrelated subscription must not activate whichever plan happens to be on screen.
Use verified events to trigger reconciliation, not to overwrite the account with whichever status arrived last. Stripe documents duplicate delivery and no guaranteed event order. Retrieve the relevant current records, process conflicting changes consistently and keep an audit trail of the policy decision. The webhook lesson explains signature verification and durable processing.
In the exercise, replaying I-72's successful event should leave one $18 paid invoice and the same January 1 access boundary. If an older failure notification arrives afterward, it should not undo the confirmed recovery. If the current records cannot be retrieved, keep the case pending for reconciliation instead of inventing a paid result.
Give the customer a controlled billing route. Stripe's customer portal can let customers update payment methods and review or pay invoices, depending on its configuration. A return from that portal is not itself proof of payment; check the invoice again. Never ask customers to send complete card details in a support message.
Test the lifecycle before using live payments
Stripe documents sandboxes and test clocks for advancing simulated subscription time. Use fictional customers and provider test payment methods. Record the expected invoice, subscription and app-access state after each step, then compare those expectations with actual test records. This guide supplies a test plan; it does not claim a Stripe sandbox was run.
Test a first payment that fails, a paid subscription whose renewal fails, an authentication-required payment, recovery inside grace and expiry without recovery. Test a subscription-specific payment method override as well as an ordinary customer default.
Advance the provider's test clock and your app's test-time input consistently. A provider simulation does not automatically prove that your own scheduled access check ran. Test the exact boundary too: December 4 at 08:59 UTC remains inside this exercise's grace period; 09:00 UTC does not.
Repeat the success event, deliver the earlier failure afterward and restart the access worker before completion. The resulting period and amount must stay the same. Add an unrelated old invoice and confirm that paying it cannot grant this workspace period.
Check the customer-facing result as well as database rows: the displayed deadline, billing link and recovery message should agree with the stored decision. Keep unknown outcomes visible for support rather than letting them disappear into a generic payment-failed banner.
Practice prompt and answer checks
Prompt to adapt: Design an offline test matrix for a fictional $18 monthly workspace. Invoice I-72 covers December 1, 2026 at 09:00 UTC to January 1, 2027 at 09:00 UTC. Renewal fails at the start. Existing customers receive exactly 72 hours of grace; sign-in and billing help remain available afterward. Show the access state at December 2 at 21:00, recovery on December 3 at 09:00, and no recovery by December 4 at 09:00. Add duplicate success, delayed failure and unrelated-invoice cases. Separate provider facts from our policy. Do not execute payments or use live credentials.
Expected checks: 36 hours of grace remain at the first checkpoint; recovery occurs 48 hours after renewal; the deadline is 72 hours after renewal; the recovered period still ends January 1. Duplicate events do not make the $18 invoice become $36. A late failure event does not override verified current payment evidence.
Before launch, assign someone to investigate mismatched billing and access records. A correct example is a starting point; your actual product terms, payment methods and recovery configuration determine the complete test set.
- Each access decision names the customer, subscription, invoice and billed period.
- First-payment failures and renewal failures have separate cases.
- Retry eligibility and the effective payment method are checked.
- Grace expiry is explicit and does not restart on each event.
- Duplicate and delayed events converge on the verified current state.
- Sandbox observations and untested assumptions are recorded separately.
Sources & further reading
- Stripe: subscription lifecycle and status resolution
- Stripe: retry eligibility and payment-method priority
- Stripe: subscription events and payment failures
- Stripe: event delivery order and duplicate handling
- Stripe: customer portal capabilities
- Stripe: Billing sandboxes and test clocks
Educational content. Examples are illustrative. Protocols, products and rules can change; consult the linked documentation for current details.
