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

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

This guide covers the problems VGS webhooks can cause in production and how to handle each one. What VGS sends is on the [VGS webhooks](/webhooks/vgs) overview, the event list is on [VGS webhook events](/webhooks/vgs/events), and how to check the signature is on [verify VGS webhooks](/webhooks/vgs/verify).

VGS's docs give the retry schedule, the grouping rule and the signature. They give no timeout, ordering guarantee or example body for organisation events, so much of this guide is about a receiver that doesn't depend on them.

## At a glance

| Problem | What to do | With Event Gateway |
| --- | --- | --- |
| [Timeouts](#timeouts) | Return exactly `200` straight away; process in a background job | Accepts the notification at once, then queues it for your service |
| [Duplicates](#duplicates) | Deduplicate on `id`, after confirming a retry keeps it | Drops repeats based on the fields you choose |
| [Ordering](#ordering) | Compare `timestamp` before overwriting state; fetch the card after a card event | Limits the delivery rate to your service |
| [Retries](#retries) | Don't apply a 60-second check to retries; keep endpoints enabled | Accepts notifications while your service is down and retries to it |
| [Choosing events](#choosing-events) | Subscribe per event and source; route on `event` | Filters and routes on any field in the body |
| [Testing](#testing) | Capture real deliveries from a sandbox source before parsing | Stores each request and forwards to localhost |
| [Other limits](#other-limits) | Read `occurrence`; allowlist VGS's IPs as well as verifying | Verifies the signature on each request |

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

Return `200` as soon as you've verified and stored the notification, then do the work in a background job.

**Why it happens:** VGS doesn't state how long it waits for a response. It describes failed attempts as non-200 responses, so a slow handler or a `201` or `204` may count as a failure and come back later.

**Fix it in your handler:**

1. Verify the signature, store the raw body and return exactly `200`.
2. Do the work in a worker. See [why to process webhooks asynchronously](/webhooks/guides/why-implement-asynchronous-processing-webhooks).
3. Keep calls to other services out of the request path.

**With Event Gateway:** Hookdeck accepts each VGS notification as it arrives, then queues it and delivers it to your service with its own [retries](/docs/retries). Your handler can take as long as it needs.

## Duplicate VGS webhooks {#duplicates}

Treat every notification as one you may have seen before, and deduplicate on `id` once you've confirmed it behaves as you expect.

**Why it happens:** VGS retries after any non-200 response, so a handler that finished its work but failed to respond in time can see the same notification again. A manual replay can repeat notifications too. VGS's example bodies carry an `id`, but the docs don't say a retry keeps it.

**Fix it in your handler:**

1. Record `id` when you first process a notification, and skip any you've already recorded.
2. Check that a real retry keeps its `id` before you rely on this, for example by failing one delivery on purpose in sandbox.
3. Make the work itself safe to repeat. See our [guide to webhook idempotency](/webhooks/guides/implement-webhook-idempotency).

**With Event Gateway:** Hookdeck can [drop duplicates](/docs/deduplication) based on the fields you choose, before they reach your service.

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

Don't assume notifications arrive in the order things happened. VGS documents no ordering guarantee.

**Why it happens:** A failed attempt waits on the retry schedule while newer notifications go out, so an older event can arrive hours after a newer one.

**Fix it in your handler:**

1. Compare the body's `timestamp` with what you've stored before overwriting newer state. VGS's example bodies include it, so confirm it on organisation events you capture.
2. For Account Updater events, use the card ID in `details` to fetch the latest card data, as VGS suggests, rather than applying the notification's values.
3. Treat `route.updated` as a prompt to read the route's current state if your logic depends on it.

**With Event Gateway:** Hookdeck can [limit the delivery rate](/docs/destinations#set-a-max-delivery-rate) to your service, which keeps a backlog from arriving all at once after an outage. It doesn't reorder notifications.

## VGS webhook retries and missed events {#retries}

VGS makes 8 attempts: immediately, then 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours and 10 hours. After 8 non-200 responses the delivery is cancelled.

**Why it happens:** Two rules catch people out. Retries are sent with the original timestamp, and VGS's sample rejects anything more than 60 seconds away from the current time, so that check fails every retry after the first minute. VGS calls the 60 seconds "very strict" and says you can increase it. Separately, VGS doesn't retry notifications generated while an endpoint is disabled.

The schedule's last attempt comes roughly a day after the first. The docs don't say whether each interval runs from the first attempt or the previous one.

**Fix it in your handler:**

1. Remove the timestamp check, or widen it to cover the schedule, and rely on the signature and on deduplication instead.
2. Keep endpoints enabled during maintenance, and let your receiver hold events.
3. After an outage, ask VGS for a replay. It needs the start and end times, the event types (all of them by default), and whether to replay only failed deliveries or everything in the period. The docs don't say whether a replay covers notifications generated while an endpoint was disabled, so ask.

**With Event Gateway:** Hookdeck accepts notifications while your service is down and [retries](/docs/retries) to it on a schedule you set. You can [pause a connection](/docs/connections#pause-a-connection) during maintenance while VGS keeps delivering, then resume it and receive what arrived.

## Choosing which VGS events to handle {#choosing-events}

Subscribe each notification only to the events and sources you process, and route on the body's `event` field.

**Why it happens:** Every notification picks its events and sources: tenants, users or organisations, each marked Sandbox or Live. Mixing them sends sandbox activity to production handlers. The events also serve different readers, since a security team cares about `user.logged_in`, `user.mfa_deleted` and the permission events, while a platform team cares about `route.updated` and `proxy.upstream_error`. Watch the names too: route deletion is `route.delete`, not `route.deleted`, and `cmp_network_token.updated` covers every network token change.

**Fix it in your handler:**

1. Create separate notifications for sandbox and live sources, each with its own URL.
2. Route on `event`, and ignore names you don't recognise rather than failing, because a non-200 response triggers retries.
3. Send login and permission events to alerting as well as to a log.
4. Read `details.state` on `cmp_network_token.updated` to tell a suspension from a deletion.

**With Event Gateway:** Hookdeck [filters](/docs/filters) and routes on any field in the body, so grouped errors can go to alerting and audit events to a separate store.

## Testing VGS webhooks {#testing}

Capture real deliveries before you write a strict parser. VGS publishes example bodies for its CMP events, but none for organisation events such as `route.updated`.

**Why it matters:** For organisation events, VGS lists only the `details` field names, such as `route_id`, `route_name` and `environment`. The `event` field and the rest of the envelope come from its CMP examples, and the organisation events' shape may differ.

**How to test:**

1. Point a sandbox notification at a public HTTPS URL. The [Hookdeck CLI](/docs/cli) gives you one that forwards to localhost.
2. Change a route in a sandbox vault to fire `route.updated`, and store the headers and raw body.
3. For Account Updater, use VGS's [Mastercard mock numbers](https://docs.verygoodsecurity.com/cmp/developer-resources/guides/testing/account-updater-webhooks). VGS says Visa, Amex and Discover have no mock environment for these notifications.
4. Fail one delivery on purpose to see a retry, and check that its signature still verifies with your timestamp rule.

**With Event Gateway:** Hookdeck stores every notification with its headers and body, so you can inspect real payloads and replay them through your parser after you fix it.

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

Three other limits affect a VGS receiver.

**Grouped events undercount:** VGS groups frequent events to avoid flooding your endpoint. For `proxy.upstream_error` and `alias.reveal_failed`, only the 1st, 10th, 100th, 1000th and so on are sent in each 5-minute window, so read `occurrence` rather than counting deliveries, and treat these events as alerts that send you to VGS's logs. The grouping paragraph also names `record.reveal_failed`, which isn't in VGS's event table, and it's unclear whether that's an older name for `alias.reveal_failed`.

**Integration limit:** VGS supports 20 integrations per organisation by default. Ask VGS support to raise it.

**Source IPs:** VGS publishes the addresses notifications come from, including two IPv6 ranges: `44.228.126.217`, `50.112.21.217`, `52.24.126.164`, `54.148.139.208`, `54.164.207.221`, `54.90.7.123`, `2600:1f24:64:8000::/52` and `2600:1f28:37:4000::/52`. Allowlisting them adds a layer, but keep verifying the signature.

**With Event Gateway:** Hookdeck verifies the signature on each VGS notification before it reaches your service, and records every request so you can see what arrived.