Skip to main content
Webhooks let your application receive real-time HTTP notifications when events happen in Commet — like a subscription being activated, a payment failing, or an invoice being created.

How it works

  1. You register an endpoint URL in the Commet dashboard
  2. You select which events you want to receive
  3. When an event occurs, Commet sends a POST request to your URL with the event data

Local development

Use the Commet CLI to forward webhook events to your local server in real time — no tunneling tools needed:
The CLI connects to Commet’s event stream and replays every webhook directly to your local URL. You’ll see each event, its response status, and timing in the terminal:
You can point to any local URL — a custom hostname, a different port, or a specific path:
Filter to specific events with --events:
The signing secret is printed when the session starts. Set it as COMMET_WEBHOOK_SECRET in your .env to verify signatures locally with the same code you’ll use in production.

Payload structure

Every webhook delivers a JSON payload with this envelope:
The same event is retried with the same id when your endpoint doesn’t respond with a 2xx, so store processed ids and skip duplicates.

Handling webhooks

Receive events by exposing an HTTP endpoint. The Node.js SDK ships a dedicated Next.js handler that verifies signatures and routes events automatically; in other languages, verify the payload and dispatch on event.
app/api/webhooks/commet/route.ts

Verifying signatures manually

If you’re not using @commet/next, verify the HMAC-SHA256 signature yourself with the SDK:

Headers

Commet sends these headers with every webhook request:

Retry policy

If your endpoint returns a non-2xx status or times out (10 seconds), Commet retries with exponential backoff capped at 1 hour. The initial delivery counts as the first attempt, followed by up to 7 retries — 8 attempts in total over a window of roughly 4 hours: After 8 failed attempts (the initial delivery plus 7 retries), the delivery is marked as failed and we email your organization’s notification recipient with the endpoint URL, event type, and the last response we received (HTTP status or error code).

Auto-disable for broken endpoints

If three events in a row fail to deliver, Commet automatically disables the endpoint so it stops consuming retries. You’ll get a second email confirming the endpoint was turned off. Once you’ve fixed the issue on your receiver, re-enable the endpoint from the Commet dashboard under Settings → Webhooks → Endpoints. Events that arrived while the endpoint was disabled are not replayed automatically — contact support if you need to backfill any missed events. You can monitor delivery status, inspect payloads, and retry individual deliveries from the dashboard at any time.

Subscription status lifecycle

Every subscription.* webhook includes a status field. These are the valid values and which ones grant access to your product: Typical flow:
  • Without a trial, pending_payment goes straight to active when the first charge confirms; with one, it goes to trialing.
  • trialing → active happens when the trial converts — and also when it expires: trial expiry activates the subscription and regular billing begins.
  • active ⇄ past_due: a failed renewal starts dunning; a recovered payment returns the subscription to active.
  • canceled is terminal, reached when a scheduled cancellation executes at period end or when dunning exhausts its retries.
Rule of thumb: gate access on status === "active" || status === "trialing". Rely on subscription.activated to turn access on and subscription.canceled to turn it off.