Goal
Make job starts safe for retries, webhooks, signups, and payments.Prerequisites
- A stable identifier for the logical work, such as a user ID, order ID, payment ID, or webhook event ID
Workflow
The problem
APIs retry. Browsers double-submit. Payment providers resend webhooks. Workers restart after partial progress. Without idempotency, those duplicates can send two emails, charge twice, provision twice, or process the same webhook more than once.The solution
An idempotency key tells StackShift that repeated starts represent the same logical job.Behavior
- Same key and same payload: StackShift reuses the existing run.
- Same key and different payload: StackShift returns an error because the caller is trying to reuse a key for different work.
- Retries are safe because the same logical operation maps to the same run.
- Webhooks are safe because repeated delivery can reuse the provider event ID as the key.
Real use cases
- Payments: use the payment intent, transaction, or provider event ID.
- Webhooks: use the webhook event ID.
- User signup: use the user ID or email-verification token ID.
Expected result
Duplicate requests reuse the same run instead of doing the same side effect twice.
Related guides
Event Waiting + Correlation
Pause a workflow until the right external event arrives, then resume the correct run.
Retries & Failure Handling
Durable Jobs retries transient failures, preserves completed steps, and gives failed work a clear recovery path.