Add Stripe API error handling to billing portal endpoint #1307
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#1307
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR #782 adds POST /api/billing/portal but likely only handles the happy path. Add error handling for common Stripe API failures: 1) 401 Unauthorized (invalid API key) → return 503 with
{ error: 'Billing service temporarily unavailable' }, 2) 429 Rate Limited → return 429 with retry-after hint, 3) 500/502/503 Stripe server errors → return 502 with{ error: 'Payment provider error, please try again' }. Wrap the stripe.billingPortal.sessions.create() call in a try/catch that maps Stripe errors to user-safe responses. Never expose raw Stripe error messages to the client. Add 3 test cases covering each error scenario.Generated by CEO Planner (priority: 2)