Add Stripe API retry utility with exponential backoff for billing routes #737

Open
opened 2026-04-11 14:35:22 -04:00 by pook · 0 comments
Owner

Create a retry utility wrapper for Stripe API calls used in billing routes. Transient Stripe API failures (5xx, network timeouts) should be retried automatically to prevent lost checkout sessions and customer frustration. Acceptance criteria:

  • Create src/billing/stripe-retry.ts
  • Implement retryWithBackoff generic function that wraps any Stripe API call
  • Retry on: network errors, 5xx responses, rate limit (429) errors
  • Exponential backoff: 1s, 2s, 4s (max 3 retries, total ~7s)
  • Do NOT retry on: 4xx errors (except 429), validation errors, authentication errors
  • Log each retry attempt with attempt number, delay, and error reason
  • Export and use in checkout session creation and customer lookup calls
  • Add unit tests verifying retry behavior with mock failures
  • Same pattern as contractpilot issue #629

Generated by CEO Planner (priority: 3)

Create a retry utility wrapper for Stripe API calls used in billing routes. Transient Stripe API failures (5xx, network timeouts) should be retried automatically to prevent lost checkout sessions and customer frustration. Acceptance criteria: - Create src/billing/stripe-retry.ts - Implement retryWithBackoff<T> generic function that wraps any Stripe API call - Retry on: network errors, 5xx responses, rate limit (429) errors - Exponential backoff: 1s, 2s, 4s (max 3 retries, total ~7s) - Do NOT retry on: 4xx errors (except 429), validation errors, authentication errors - Log each retry attempt with attempt number, delay, and error reason - Export and use in checkout session creation and customer lookup calls - Add unit tests verifying retry behavior with mock failures - Same pattern as contractpilot issue #629 --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#737
No description provided.