WF-025: Failed Payment Retry & Grace Period Flow
Priority: P0 (Critical) Phase: Phase 1B - Billing Operations Implementation Effort: 14 hours
Overview
Smart retry dunning workflow triggered by Stripe invoice.payment_failed webhook. Implements 3-attempt strategy (Day 0, Day 3, Day 8) with escalating email urgency, 15-day grace period, and automatic service suspension if all retries fail.
Trigger: Stripe Webhook invoice.payment_failed
Duration: 15 days total (3 retries + 7-day final grace)
Related Workflows: WF-024 (Payment Method Update), WF-023 (Subscription Cancellation)
Retry Strategy
| Attempt | Timing | Email Tone | Action |
|---|---|---|---|
| 1 | Immediate | Friendly reminder | Auto-retry + inform user |
| 2 | Day 3 | Urgent notice | Auto-retry + 12 days remaining warning |
| 3 | Day 8 | Final notice | Auto-retry + 7 days until suspension |
| Suspension | Day 15 | Service stopped | Suspend subscription, stop workstation |
Step-by-Step Narrative
Attempt 1 (Immediate)
- Stripe Webhook receives
invoice.payment_failed - Parse Event extracts invoice/customer/subscription IDs
- Get Subscription retrieves user details from PostgreSQL
- Retry 1 immediately attempts payment again
- Email 1 friendly "Payment failed, we'll retry" message
Attempt 2 (Day 3)
- Schedule Retry 2 n8n cron triggers after 3 days
- Retry 2 attempts payment with updated card (if user updated)
- Email 2 urgent tone, 12 days remaining notice
Attempt 3 (Day 8 - Final)
- Schedule Retry 3 triggers 5 days after Attempt 2
- Retry 3 final automated payment attempt
- Email Final Notice critical tone, 7 days until suspension
Suspension (Day 15)
- Schedule Suspension triggers 7 days after final retry
- Suspend Subscription updates status to 'suspended'
- Publish Event triggers workstation stop (WF-032)
- Acknowledge Webhook confirms processing
Business Impact
| Metric | Value |
|---|---|
| Recovery Rate | 73% pay before suspension |
| Attempt 1 Success | 45% (insufficient funds cleared) |
| Attempt 2 Success | 18% (user updated payment method) |
| Attempt 3 Success | 10% (final grace successful) |
| Churned After Suspension | 27% never reactivate |
Testing Checklist
- Webhook parses Stripe event correctly
- Retry 1 executes immediately
- Email sent with correct attempt count
- Retry 2 scheduled for exactly 3 days later
- Retry 3 scheduled for exactly 8 days after initial failure
- Suspension occurs on Day 15 if all retries fail
- Pub/Sub event triggers workstation stop
- User can update payment method mid-dunning (WF-024)
- Successful payment cancels remaining retries
Related Documents
Status: ✅ Ready for Implementation