Pure utility functions generating deterministic Stripe idempotency keys for orders, subscriptions, and renewals.
// Source: https://github.com/PansaLegrand/sushi-saas-template | License: MIT | Copyright 2025 Pan Wenzhu // Provided via justclaw.it.com; keep this notice with the code. /** * The deterministic ids that make Stripe fulfillment safe to replay. * * Stripe delivers a webhook at least once, not exactly once. It retries for * days, it can deliver the same event to two instances at the same time, and * two *different* events can describe the same money — a * `checkout.session.completed` and the `invoice.payment_succeeded` for the same * first period, for instance. * * So every write on a Stripe path derives its primary key from the Stripe * object it is recording, never from a fresh id. A replay then collides with * the row it would have duplicated, and the database refuses it. That ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key