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

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

This guide covers the problems Zuora webhooks, which Zuora calls callouts, can cause in production and how to handle each one. It's about callout notifications from Events and Notifications, not the callout tasks in Zuora Workflow. What Zuora sends is on the [Zuora webhooks](/webhooks/zuora) overview, and how to check the credentials is on [Verify Zuora webhooks](/webhooks/zuora/verify).

## At a glance

| Problem | What to do | With Event Gateway |
| --- | --- | --- |
| [Timeouts](#timeouts) | Return exactly `200` within 25 seconds; process in a background job | Accepts the callout at once, then queues it for your service |
| [Duplicates](#duplicates) | Deduplicate on `Zuora-Notification-Id` | Drops repeats based on that header |
| [Ordering](#ordering) | Fetch the object's current state from the API before acting | Limits the delivery rate to your service |
| [Retries](#retries) | Tick Retriable; return a `5xx` for temporary problems | Stores each callout and retries on your schedule |
| [Choosing events](#choosing-events) | Name the event with a URL path or `{{Event.Category}}` | Filters and routes on the path, a header or a body field |
| [Testing](#testing) | Preview the template, then trigger the event through an active notification | Forwards to localhost and replays past callouts |
| [Other limits](#other-limits) | Tick Enable Preemptive Authentication; keep bodies small | Checks the Basic credentials on each callout |

## Zuora callout timeouts and slow handlers {#timeouts}

Return `200` within 25 seconds, and do slow work after you've responded.

**Why it happens:** Every callout has 10 seconds to establish a connection and 15 seconds for data transfer, and the limit can't be changed. Zuora recommends background jobs that are independent of the callout, so your processes don't depend on how long it keeps a connection open.

**Fix it in your handler:**

1. Check the credentials, store the body and return `200`.
2. Call the Zuora API and downstream systems from a worker. See [why to process webhooks asynchronously](/webhooks/guides/why-implement-asynchronous-processing-webhooks).
3. Keep the body small so the transfer is quick.

**With Event Gateway:** Hookdeck answers Zuora as soon as a callout is stored, and uses its own [delivery timeout](/docs/destinations#set-a-delivery-timeout) towards your service, so slow processing doesn't count against Zuora's 25 seconds.

## Duplicate Zuora callouts {#duplicates}

Deduplicate on `Zuora-Notification-Id`. Zuora's docs use the same value on any retry of the same notification.

**Why it happens:** A retry is a new request for the same notification, so `Zuora-Request-Id` changes and `Zuora-Notification-Id` doesn't. A handler that finishes its work but misses the 25-second limit can see the callout again on a Retriable template. The docs don't say whether a manual Resend from Callout History keeps the same notification ID, so check one before you treat a resend as a repeat.

**Fix it in your handler:**

1. Record `Zuora-Notification-Id` when you accept a callout, and skip a value you've already handled.
2. Don't deduplicate on `Zuora-Request-Id`, which is different on every attempt.
3. Make writes safe to repeat as well. See our [guide to webhook idempotency](/webhooks/guides/implement-webhook-idempotency).

**With Event Gateway:** [Deduplication](/docs/deduplication) can drop repeats based on the `zuora-notification-id` header before they reach your service.

## Out-of-order Zuora callouts {#ordering}

Don't rely on arrival order. Fetch the object's current state from the Zuora API before you act on a callout.

**Why it happens:** Zuora processes events in the order they're triggered, but its docs say the timing and order of callouts depend on retries, concurrency and network latency. A retry 30 minutes later can arrive after newer callouts for the same object.

**Fix it in your handler:**

1. Put the object's ID in the body, and read the current object from the API in your worker.
2. If you need to compare callouts, add `{{Event.Timestamp}}` to the body. It's the time the event occurred, in your tenant's time zone.

**With Event Gateway:** A [max delivery rate](/docs/destinations#set-a-max-delivery-rate) on your destination keeps a burst from reaching your handler all at once, and every callout is stored, so you can inspect the sequence you received.

## Zuora callout retries and missed deliveries {#retries}

Tick **Retriable** on every template, return exactly `200` when you've accepted a callout, and return a `5xx` for a temporary problem.

**Why it happens:** Zuora counts only a `200` as success, but it retries only `1xx`, `403`, `408`, `429`, `5xx` and negative response codes. A `400`, `404` or `201` is a failure that isn't on that list. Retries also depend on Retriable, and the default is three attempts 30 minutes apart. `3xx` redirects aren't followed, so update the template's URL when your endpoint moves.

With **Confirm success by parsing response content** ticked, a `200` counts only if the `Content-Type` is `application/json` and the body has `success` set to `true`, and a `200` with `success` set to `false` is retried. Zuora's docs differ on authentication failures: the response code list leaves out `401`, while the callout template overview says a Retriable template retries when authentication fails. Don't depend on either.

**Fix it in your handler:**

1. Return `503` when a dependency is down, so Zuora tries again.
2. If three attempts isn't enough, raise the limits under **Callout Settings** on the Events & Notifications **Settings** tab, up to five attempts and an interval of 1,440 minutes.
3. After an outage, find failed deliveries on the **Callout History** tab and click **Resend**. That needs the Events & Notifications Resend Access permission.

**With Event Gateway:** Hookdeck stores each callout and delivers it with [automatic retries](/docs/retries) on a schedule you control. [Issues](/docs/issues) alert you when deliveries fail, and you can replay stored callouts after a fix. If you tick **Confirm success by parsing response content**, set a [custom response](/docs/sources#custom-responses) on the source that returns `{"success": true}` as JSON, because Hookdeck's default response doesn't include that field.

## Choosing Zuora events and templates {#choosing-events}

Decide how each delivery will name its event before you build templates, because nothing Zuora adds to the request does it for you.

**Why it happens:** The template author chooses the URL, headers and body, and Zuora adds only request and notification IDs. A template's Related Event can be one standard event, or a parent category such as `1100 - Invoice`, which lets one template serve Invoice Posted, Invoice Due and any custom events on that object. A notification can also select several templates, and Zuora sends to all of them.

**Fix it in your handler:**

1. Give each template its own URL path, or add a key to each body, as in the example below.
2. Route on that value, and keep your templates alongside the handler code so the two stay in step.
3. Check the Related Event you need is available. Credit and debit memo events need the Invoice Settlement feature, and Zuora Orders events are listed as Zuora custom events.

```json
{
  "event": "{{Event.Category}}",
  "accountId": "{{DataSource.Account.Id}}"
}

```

`{{Event.Category}}` is a system merge field whose value is a name such as `Invoice Posted`. It isn't something Zuora adds unless you put it there.

**With Event Gateway:** [Filters](/docs/filters) can route on the path, a header or a body field, so one source can feed different services per template, and [transformations](/docs/transformations) can normalise bodies into a common shape.

## Testing Zuora callouts {#testing}

Preview the template first, then trigger the real event through an active notification and read the result on the **Callout History** tab.

**Why it happens:** Saving a template doesn't send anything. A callout goes out only when an active notification definition selects an active template, and the notification has to be assigned to the communication profile of the customer account. Preview needs an object ID that matches the Related Event, and it doesn't render system merge fields, so `{{Event.Category}}` shows up only on a real delivery.

**Fix it in your handler:**

1. On the template's **Request Preview**, enter an **Object ID**, such as an account ID for Account Created, and click **Preview**.
2. If a callout doesn't arrive, check that the template and the notification are both active, that the template is under **Delivered By Callout**, and that the notification's filters and communication profiles include the account.
3. Watch for response code `-2000`: it means the custom request body is invalid, and Zuora neither sends nor retries that callout. The body must be a JSON object.

**With Event Gateway:** The [Hookdeck CLI](/docs/cli) gives you a public HTTPS URL with `hookdeck listen 3000 zuora --path /webhooks/zuora`, forwards callouts to localhost, and replays them without triggering the event again.

## Other Zuora callout limits {#other-limits}

Tick **Enable Preemptive Authentication** on every template that uses Username/Password, and keep callout bodies to what the receiver needs.

**Why it happens:** Zuora's Basic authentication follows a challenge by default: the first request has no `Authorization` header, the receiver answers `401` with `WWW-Authenticate`, and only then does Zuora resend with the credentials. Those credentials are base64, not encryption, so they rely on HTTPS, and they authenticate the sender without protecting the body or stopping a replay. Zuora's docs describe callout data as non-sensitive, typically an ID, but merge fields can include much more.

**Fix it in your handler:**

1. Tick **Enable Preemptive Authentication**. If you receive callouts directly and leave it off, send `WWW-Authenticate: Basic` with your `401`.
2. Put IDs in the body and fetch the rest through an authenticated API call.
3. If you need body integrity, add the template's HMAC with `{{Request.Body}}` in its **Data**. Zuora defines no scheme for it, so you choose the algorithm, format and header, and your code has to match them.
4. Use port 443 and a publicly trusted certificate. Another port needs a request to Zuora Global Support, and the template's **SSL Certificate** field can clear certificate errors (HTTP status `495`) for your receiver's domain.

**With Event Gateway:** Create a Zuora source, enter the template's **Username** and **Password**, and use the source URL as the **Request URL**. Hookdeck checks the credentials on each callout, and doesn't send a `401` challenge, so **Enable Preemptive Authentication** has to be ticked. Without it, each request is recorded as failed verification and creates no event, and every request stays listed with its headers and body, which makes a template with the setting unticked easy to find. The source pre-selects `POST`, so allow any other method your template uses. The Zuora source checks Basic credentials only. To verify the HMAC instead, use a generic Webhook source with HMAC verification, set **Data** to `{{Request.Body}}` alone and **Header Value** to `{{Request.HMAC.Signed}}` alone, and pick an algorithm and format that source offers, such as SHA-256 with BASE64.

## Conclusion

Zuora callouts are requests you design, so plan how each one names its event and remember that a template needs an active notification to send anything. Tick **Enable Preemptive Authentication** and **Retriable**, deduplicate on `Zuora-Notification-Id`, and return exactly `200` within 25 seconds.

[Hookdeck Event Gateway](/event-gateway) checks the credentials, stores every callout and retries delivery to your service, so a billing event isn't lost because of a slow or failing handler.

[Get started with Hookdeck](https://dashboard.hookdeck.com/signup) for free and handle Zuora webhooks reliably in minutes.