# Autumn webhooks in production: duplicates, ordering, retries and timeouts

Agent skill: `npx skills add hookdeck/webhook-skills --skill autumn-webhooks` ([details](https://hookdeck.com/webhooks/autumn/skill))

This guide covers the problems Autumn webhooks cause in production and how to handle each one. What Autumn sends is on the [Autumn webhooks](/webhooks/autumn) overview, every event is on [Autumn webhook events](/webhooks/autumn/events), and signature verification code is on [Verify Autumn webhooks](/webhooks/autumn/verify).

## At a glance

| Problem | What to do | With Event Gateway |
| --- | --- | --- |
| [Timeouts](#timeouts) | Store the event, return a 2xx quickly and process in a background job | Accepts the delivery at once, then queues it for your service |
| [Duplicates](#duplicates) | Record each `svix-id`; use `invoice.stripe_id` for top-ups | Drops repeats before they reach your handler |
| [Ordering](#ordering) | Don't assume an order; fetch the customer when your data must match | Logs every event and attempt, so you can see arrival order when debugging |
| [Retries](#retries) | Check the dashboard after an outage and reconcile from the API | Accepts deliveries while your service is down and replays them |
| [Choosing events](#choosing-events) | Subscribe to what you handle; give `vercel.*` its own webhook | Filters and routes each event type from a single source |
| [Testing](#testing) | Use a sandbox webhook, an https URL and Send Test Event | Forwards to localhost and replays past events |
| [Other limits](#other-limits) | Loop over `plan_changes`, store the secret, and protect your endpoints from a sync | Keeps each payload so you can replay it against a changed handler |

## Autumn webhook timeouts and slow handlers {#timeouts}

Return a 2xx quickly and do the work in a background job. Autumn publishes no response timeout. Svix, which delivers its webhooks, documents 30 seconds to return a 2xx, and Autumn doesn't say whether it changes that.

**Why it happens:** Autumn's webhooks exist to trigger side effects such as activation emails, provisioning and CRM updates, and each of those calls another service. A handler that waits for them all can run past the limit, and Svix treats anything other than a 2xx, including a redirect, as a failed delivery.

**Fix it in your handler:**

1. Verify the signature, store the raw event and return 200.
2. Do the slow work in a worker. See [why to process webhooks asynchronously](/webhooks/guides/why-implement-asynchronous-processing-webhooks).
3. Point the endpoint at its final URL, because a redirect counts as a failure.

**With Event Gateway:** Hookdeck accepts each Autumn delivery immediately, then queues events and delivers them to your service at a rate it can handle, with its own retries. Your handler can take as long as it needs without failing an Autumn delivery.

## Duplicate Autumn webhooks {#duplicates}

A retried message keeps its `svix-id`, so record each id you process and skip repeats. Autumn's own pages don't discuss duplicates; the id's behaviour comes from Svix's documentation.

**Why it happens:** A delivery that times out or gets a non-2xx response is sent again, even if your handler had already done the work. Retrying a failed delivery from the Autumn dashboard has the same effect.

**Fix it in your handler:**

1. Track processed `svix-id` values, using a database table with a unique constraint. See our [guide to webhook idempotency](/webhooks/guides/implement-webhook-idempotency).
2. For `billing.auto_topup_succeeded`, use `invoice.stripe_id`, which Autumn suggests as a stable key. The top-level `id` identifies the event.
3. Make plan handlers safe to run twice. Storing a `subscription` snapshot is, while sending a welcome email isn't.

Autumn does suppress one kind of repeat itself. While the same purchase, attempt or failed-attempt limit is active, repeated auto top-up attempts don't send another `billing.auto_topup_failed`, so don't expect one per attempt.

**With Event Gateway:** Hookdeck [deduplicates](/docs/deduplication) events before they reach your endpoint, so repeats are filtered at the infrastructure level rather than in each handler.

## Out-of-order Autumn webhooks {#ordering}

Autumn doesn't document delivery order, so don't assume events arrive in the order things happened. When your database must match Autumn, fetch the customer from its API.

**Why it happens:** A delivery that fails and is retried can arrive after a newer one. `billing.updated` has no event timestamp to compare, because only the auto top-up events carry `occurred_at`. Autumn suggests storing each `subscription` snapshot, and a late event would overwrite a newer snapshot with an older one.

**Fix it in your handler:**

1. Treat each event as a snapshot of one moment, not a command to replay.
2. Before overwriting stored plan state, call [Get Customer](https://docs.useautumn.com/api-reference/customers/getCustomer) and store what it returns.
3. Don't rely on the order of entries inside `plan_changes`. Autumn doesn't state one, so read each entry's `action`.

**With Event Gateway:** Hookdeck logs every event and delivery attempt, so when state looks wrong you can see the order events actually arrived in and replay them.

## Autumn webhook retries {#retries}

Autumn retries with exponential backoff when your endpoint returns an error or is unavailable, and you can view attempts and retry failed deliveries from the dashboard. It doesn't publish how long it keeps trying or what happens afterwards.

**Why it happens:** Autumn leaves the schedule to Svix without restating it. Svix's documentation gives 8 attempts over about 27 hours, and disabling an endpoint after 5 days of failures, but Autumn doesn't say whether it keeps those settings.

**Fix it in your handler:**

1. After an outage, check the delivery attempts in the Autumn dashboard and retry what failed.
2. Reconcile plan state from [Get Customer](https://docs.useautumn.com/api-reference/customers/getCustomer) and invoices from `invoices.list`, in case a delivery ran out of attempts.
3. Check that the endpoint is still on. A webhook has a `disabled` field that stops all its events, and `webhooks.get` returns it.

**With Event Gateway:** Hookdeck accepts Autumn's deliveries while your services are down, so they succeed and nothing is left to retry on Autumn's side. Failed events can be [retried](/docs/retries) automatically, manually or in bulk once you recover.

## Choosing which Autumn events to receive {#choosing-events}

Subscribe each webhook to the events you handle, return a 2xx for any type you don't recognise, and give `vercel.*` events a webhook of their own.

**Why it happens:** Leaving out `events` sends every event, and a webhook can't mix `vercel.*` events with others. Autumn also lists `customer.products.updated` and `customer.threshold_reached` as subscribable without describing them on its current pages. Its older docs show their own shapes: `customer.products.updated` has `data.scenario`, `data.customer` and `data.updated_product`, with no `plan_changes`. Autumn's changelog shows it firing alongside `billing.updated` on trial expiry, so a webhook on every event can hear about one change twice.

**Fix it in your handler:**

1. Start with `billing.updated`, `balances.limit_reached`, `balances.usage_alert_triggered`, `billing.auto_topup_failed` and `invoice.finalized`.
2. Pick `billing.updated` or `customer.products.updated` for plan changes, not both, and don't reuse a `plan_changes` loop for the second one.
3. For Vercel Marketplace, create a separate endpoint under Developer > Vercel, as Autumn's setup guide describes.
4. Use the names in the [events list](/webhooks/autumn/events). Autumn's changelog spells two with an extra dot, `billing.auto_topup.failed` and `balances.usage_alert.triggered`, but its API and example bodies use underscores.

**With Event Gateway:** Hookdeck [filters](/docs/filters) on `type` can route each event type to its own destination from a single source.

## Testing Autumn webhooks {#testing}

Test against a sandbox webhook and use **Send Test Event** in the dashboard to confirm your endpoint receives deliveries.

**Why it's awkward:** The URL must be https, and Autumn rejects localhost and private-network addresses, so a handler on your machine needs a tunnel. Most events depend on a customer's billing activity, and Autumn doesn't document a way to trigger a specific type.

**What to do:**

1. Create a webhook with a sandbox key. It's separate from production and has its own secret.
2. Point it at a tunnel, as Autumn suggests, or at a temporary URL from [Hookdeck Inspect](https://inspect.hookdeck.com/webhooks/autumn), which has an Autumn page.
3. Attach, change and cancel a plan on a sandbox customer to produce `billing.updated`.
4. Keep fixtures of the examples on [Autumn webhook events](/webhooks/autumn/events), including an upgrade with two `plan_changes`.

**With Event Gateway:** The [Hookdeck CLI](/docs/cli) receives webhooks on your machine without a public server, and you can replay past events. A replayed message keeps its original `svix-timestamp`, so the Svix libraries reject it more than five minutes later; [Verify Autumn webhooks](/webhooks/autumn/verify) explains the options.

## Other Autumn webhook limits {#other-limits}

Plan for how Autumn shapes plan changes, how it returns secrets and how it manages endpoints as code before they reach production.

**Several plan changes in one event.** One `billing.updated` can carry several `plan_changes`. An upgrade from `free` to `pro` is an `activated` entry and an `expired` entry in the same event, and a single event can cover several entities, so read each entry's `entity_id`. Loop over every entry rather than reading the first.

**Detecting cancellations.** `previous_attributes.canceled_at` being `null` means a cancellation was just set, and a number means it was undone. `previous_attributes` is itself `null` on a new plan, and the field is missing when it didn't change, so check for a real `null`: a loose check reads a missing field as a cancellation.

**The secret comes back once.** The API returns a webhook's `whsec_` secret when it creates the webhook, and `webhooks.get` never returns it. Store it in a secrets manager straight away. If it's lost, create a new webhook, deploy its secret, then retire the old one. Autumn's docs don't say where the dashboard shows the secret for an endpoint added there.

**Syncs can delete endpoints.** `webhooks.sync` with `skip_deletions: false` deletes every webhook you didn't list, including ones made in the dashboard, and `atmn push` deletes endpoints removed from your config. `webhooks.preview_sync` shows what would change.

**A succeeded top-up may not be paid.** In `invoice_mode`, `billing.auto_topup_succeeded` fires once credits are granted and the invoice is finalized, and `invoice.status` is typically `open` until the customer pays. Check the status before you record revenue.

**One action can send several events.** Autumn's changelog says a transfer sends `billing.updated` for both the source and the destination, and license transitions send one for each seat entity.

**Vercel access tokens.** `vercel.resources.provisioned` carries an `access_token` that can patch a resource's secrets. Keep it out of your logs and treat stored copies of that body as secrets.

**With Event Gateway:** Hookdeck keeps each payload, so you can replay real `billing.updated` events against your handler when you change how it reads `plan_changes`. Only the Hookdeck source needs the Autumn secret, so replacing it is one change in one place.