isDefiniteStripeFailure (teams/trial-reservation-classification.ts)

cloudflare-workers-nextjs-saas-template · src/lib/teams/trial-reservation-classification.ts · typescript · MIT
payments

Classifies Stripe errors to determine safe retry logic for subscriptions.

// Source: https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template | License: MIT | Copyright 2025 Lubomir Georgiev (Любомир Георгиев)
// Provided via justclaw.it.com; keep this notice with the code.
import Stripe from "stripe";

// Error classes that PROVE Stripe rejected the request outright — no subscription was
// created — so the reservation is safe to release for a retry. Everything NOT listed here
// is ambiguous (Stripe may have created the subscription) and MUST retain the reservation:
//   - StripeConnectionError / StripeAPIError: the request may or may not have landed.
//   - StripeRateLimitError: Stripe can accept and process a call before throttling the
//     connection, so a rate-limited attempt may still have created the subscription.
//   - StripeIdempot

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key