Two things can go wrong when billing notifications move over webhooks. One belongs to the sender: was the event written to the ledger before the webhook went out? The other belongs to the receiver: did the consumer process the event and acknowledge it, or did it fail without saying so? Most implementations get the sender side right and assume the receiver side. At low volume the assumption usually costs nothing. With high-volume agent billing, silent receiver failures accumulate into revenue that never gets recognized.

Delivery Fails More Than People Expect

HTTP delivery is unreliable by nature. The sender fires a POST and waits for a 200. If the endpoint is down, returns a 5xx, or times out, that delivery failed. What follows is entirely up to the retry logic. No retry means the event is gone. Retry without idempotency means the event may arrive several times as duplicates. The pattern that works is retry plus idempotency: the sender keeps retrying until a 200 comes back, and the receiver deduplicates on event ID.

Volume turns small failure rates into real gaps. An endpoint that errors 0.5 percent of the time under peak load but succeeds on the second try still produces accurate totals. An endpoint with a permanent 0.5 percent failure rate—deliveries that exhaust retries and never land—leaves a gap of that share across all events. At 2 million events a month, 10,000 events were never recorded.

A 200 Does Not Mean the Event Was Stored

A 200 from an endpoint confirms the HTTP exchange finished. It says nothing about whether the application handled the event. Return 200 before the database write, have the write fail afterward, and the sender marks delivery complete while the event exists nowhere. The ledger believes it was delivered. The application never processed it.

For billing-critical receivers the acknowledgement has to follow persistence: write to durable storage, confirm the write, then return 200. Persistence failures then trigger a sender retry instead of being mistaken for success. The cost is slightly more latency before the acknowledgment, which is a fair trade against silent data loss.

Keep the Event and the Notice Separate

The event that records usage in the ledger needs to be persisted independently of any webhook announcing it. If the architecture requires a successful webhook before usage reaches the ledger, billing integrity now depends on webhook reliability. Those are separate concerns and should stay that way.

Usage events are written on ingest, synchronously with the API call that submitted them. Notifications—invoice generated, threshold crossed, payment due—are asynchronous messages derived from ledger state. A notification that fails does not erase the invoice; the customer can be told again. A failed ledger write is an integrity problem with no tidy remedy.

What to Watch

Silent failures stay invisible unless something is watching. After retries run out, the sender marks the attempt failed, but that signal usually lands in an error log nobody reads as it happens. The ledger shows no obvious gap, because the missing events were never written. The discrepancy appears when a customer compares their own usage logs to the invoice and the numbers disagree.

Useful monitoring covers delivery attempt rate and success rate per endpoint, the retry-depth distribution (how many successful deliveries needed one retry, two, or more), and a daily reconciliation comparing events submitted to the ingest API against events in the ledger for the same period. A gap in that reconciliation is the early warning to investigate delivery failures before they turn into billing disputes.

Short posts on billing infrastructure

Webhook delivery, event integrity, and metering practice, covered in brief. About one email a month.