Webhooks
Tenth sends a webhook to your server for every change to your customers: a subscription starting or renewing, a refund, credits being spent, and so on. Each delivery carries the customer's full state, so you can update your records from the webhook alone.
Set up an endpoint
- In the dashboard, open Webhooks and add an endpoint. Its URL must be
httpsand reachable from the public internet. - Choose the event types it receives, or leave the list empty to receive everything.
- Copy the signing secret (
tenth_whsec_...). It's shown only when you create or rotate it. - Use Send test event to check your handler. Test deliveries have type
test.
Then verify each delivery with verifyWebhook from @tenthbilling/node, which has Express and Fastify examples.
The request
Tenth sends a POST with a JSON body and these headers:
| Header | Value |
|---|---|
Tenth-Signature | t=<unix timestamp>,v1=<signature>. The signature is HMAC-SHA256, in hex, over <timestamp>.<raw body> with the endpoint's secret. |
Tenth-Event-Id | The event's ID. The same on every retry of the event. |
Tenth-Event-Type | The event type, such as subscription.renewed. |
Tenth-Delivery-Id | This delivery's ID. |
Always check the signature over the raw body before you act on the event. verifyWebhook does that, and rejects timestamps more than 5 minutes off.
The payload
A complete subscription.renewed delivery:
{
"id": "0193a6f2-6c1e-7b3a-9d41-2f0c8e5b7a10",
"type": "subscription.renewed",
"version": "2026-10-25",
"created_at": "2026-11-10T14:03:12.000Z",
"occurred_at": "2026-11-10T14:03:09.000Z",
"app_id": "0192a1b0-3d5e-7f21-8c44-6a9b0d1e2f33",
"environment": "live",
"data": {
"subject": { "type": "subscription", "id": "0193a6f2-5a07-7c11-b2e3-4d5f6a7b8c90" },
"before": {
"status": "active",
"product_id": "0192a1b4-9e8f-7a6b-8c5d-4e3f2a1b0c9d",
"current_period_start": "2026-10-10T14:03:09.000Z",
"current_period_end": "2026-11-10T14:03:09.000Z",
"auto_renew": true,
"quantity": 1
},
"after": {
"status": "active",
"product_id": "0192a1b4-9e8f-7a6b-8c5d-4e3f2a1b0c9d",
"current_period_start": "2026-11-10T14:03:09.000Z",
"current_period_end": "2026-12-10T14:03:09.000Z",
"auto_renew": true,
"quantity": 1
},
"product": "pro_monthly",
"store": "apple"
},
"customer": {
"customer": {
"id": "0192c3d4-1a2b-7c3d-9e4f-5a6b7c8d9e0f",
"app_user_id": "user_2abc123",
"app_account_token": "6f1c2d3e-4b5a-4c6d-8e7f-9a0b1c2d3e4f",
"obfuscated_account_id": "a1b2c3d4e5f6",
"created_at": "2026-09-01T08:00:00.000Z"
},
"entitlements": {
"pro": {
"active": true,
"source": "subscription",
"store": "apple",
"expires_at": "2026-12-10T14:03:09.000Z",
"will_renew": true,
"in_grace": false,
"billing_issue": false,
"quantity": null
}
},
"credits": { "ai_credits": { "balance": 120, "available": 100 } },
"subscriptions": [
{
"id": "0193a6f2-5a07-7c11-b2e3-4d5f6a7b8c90",
"product": "pro_monthly",
"store": "apple",
"status": "active",
"current_period_start": "2026-11-10T14:03:09.000Z",
"current_period_end": "2026-12-10T14:03:09.000Z",
"trial_end": null,
"grace_period_end": null,
"cancel_at": null,
"will_renew": true,
"provisional": false
}
]
}
}
customer is nested. The top-level customer is the whole CustomerState, and the customer record is inside it, so the app user ID is at customer.customer.app_user_id. customer.customer.id is Tenth's own ID for the customer.
| Field | Description |
|---|---|
id | The event's ID. Use it to dedupe. |
type | The event type (see below). |
version | The payload version, currently 2026-10-25. |
created_at | When Tenth recorded the event. |
occurred_at | When it happened. |
app_id | The app it belongs to. |
environment | test or live. |
data | Details of the event. Its fields depend on the type; see Event data. |
customer | The customer's full state right after the change: entitlements, credits and subscriptions, as GET /v1/customers/{id} returns it. null for test events. |
In TypeScript, verifyWebhook returns this as a WebhookEvent. The same body is in the payload field of each entry in the event feed (tenth.events.list).
Check environment against the key your server uses, so a misconfigured test endpoint can't change live records (see Check the environment).
Event data
Every event's data (except test) has the same frame, plus fields for its type:
| Field | Description |
|---|---|
subject | { type, id }: what changed. type is subscription, purchase, entitlement, grant, credit_lot, credit_type, revenue_transaction or customer, and id is Tenth's ID for it. |
before | The subject's relevant fields before the change, or null when it's new. Only on some types. |
after | The same fields after the change. Only on some types. |
Amounts and quantities are numbers, and times are ISO 8601 strings. Tenth may add fields to data, so ignore fields you don't know.
| Types | subject.type | before and after | Other fields |
|---|---|---|---|
subscription.* (except anchor_changed) and trial.* | subscription | { status, product_id, current_period_start, current_period_end, auto_renew, quantity }; before is null for a new subscription | product (the catalog key, or null if the store product isn't in the catalog), store |
subscription.anchor_changed | subscription | after only: { day, month, timezone, first_period, next_billing_at } | none |
purchase.completed | purchase | after only: { status, type } | product, store |
purchase.transferred | subscription or purchase | none | direction (out on the old owner's event, in on the new owner's), and to_customer_id or from_customer_id |
purchase.shared | subscription or purchase | none | direction, and with_customer_id (owner's event) or owner_customer_id (the other customer's) |
refund.issued | revenue_transaction | none | amount (minor units, negative), currency, refunded_transaction_id |
dispute.opened | subscription or purchase | { dispute }: null, open, won or lost | none |
dispute.closed | subscription or purchase | { dispute } | outcome: won or lost |
entitlement.granted, entitlement.revoked | entitlement | { active, source, store, expires_at, quantity } | entitlement (the key) |
grant.created, grant.revoked | grant | The grant: { id, entitlement, credit_type, amount, starts_at, expires_at, reason, created_by, revoked_at, created_at }; grant.created has after only | none |
credits.granted | credit_lot | none | credit_type, amount, source, expires_at, and debt_repaid when part of it paid off a negative balance |
credits.debited | credit_type | none | credit_type, amount, metadata (what the debit was sent with) |
credits.expired | credit_lot | none | credit_type, amount, reason |
credits.clawed_back | credit_lot | none | credit_type, amount, owed (what's still owed after the clawback) |
customer.aliased | customer | none | alias (the app user ID that now resolves to this customer) |
customer.merged | customer | none | alias, and merged_into (on the customer that was merged away) or merged_from (on the one that remains) |
customer.deleted | customer | none | none |
test | none (no subject) | none | message |
IDs such as product_id and merged_into are Tenth's IDs. Catalog keys, such as product and entitlement, are the keys you set in the dashboard.
Event types
New event types can be added without a new payload version, so ignore types you don't know.
Subscriptions
| Type | Meaning |
|---|---|
subscription.started | A paid subscription started. |
subscription.renewed | A subscription renewed for a new period. |
subscription.plan_changed | The subscription's quantity changed. |
subscription.product_changed | The subscription moved to a different product. |
subscription.cancel_scheduled | The subscription is set to end at the end of the period. |
subscription.uncanceled | A scheduled cancellation was withdrawn. |
subscription.billing_issue | A payment failed. |
subscription.recovered | A failed payment went through. |
subscription.paused | The subscription was paused. |
subscription.resumed | A paused subscription resumed. |
subscription.price_increase | The provider reported a price increase for the subscription. |
subscription.extended | The current period was extended without a renewal. |
subscription.anchor_changed | The subscription's billing day changed. |
subscription.revoked | The subscription ended early, such as after a refund. |
subscription.expired | The subscription ended. |
Free trials
| Type | Meaning |
|---|---|
trial.started | A free trial started. |
trial.converted | A free trial converted to a paid subscription. |
trial.canceled | The customer turned off renewal during a free trial. |
Purchases, refunds and disputes
| Type | Meaning |
|---|---|
purchase.completed | A one-time purchase completed. |
purchase.transferred | A purchase moved from one customer to another. |
purchase.shared | A purchase was shared with another customer. |
refund.issued | A refund was issued. |
dispute.opened | A chargeback was opened. |
dispute.closed | A chargeback was closed. |
Access and grants
| Type | Meaning |
|---|---|
entitlement.granted | The customer gained an entitlement. |
entitlement.revoked | The customer lost an entitlement. |
grant.created | A grant was given. |
grant.revoked | A grant was revoked. |
Credits
| Type | Meaning |
|---|---|
credits.granted | Credits were added. |
credits.debited | Credits were spent. |
credits.expired | Credits expired. |
credits.clawed_back | Credits were taken back, such as after a refund. |
Customers
| Type | Meaning |
|---|---|
customer.aliased | Another app user ID was linked to the customer. |
customer.merged | The customer was merged with another customer. |
customer.deleted | The customer's personal data was deleted. |
Other
| Type | Meaning |
|---|---|
test | Sent from the dashboard's Send test event. customer is null. |
The full list is exported from @tenthbilling/node as WEBHOOK_EVENT_TYPES.
Delivery and retries
- Deliveries are at least once, so the same event can arrive more than once. Dedupe on
id(or theTenth-Event-Idheader). - Delivery is attempted for 72 hours. An event that still hasn't been acknowledged by then isn't sent again unless you replay it from the endpoint's deliveries in the dashboard, so treat the event feed below as the record and webhooks as the fast path.
- Respond with any 2xx status to acknowledge. Anything else, a timeout (10 seconds) or a redirect counts as a failure. Redirects aren't followed.
- A failed delivery is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours and 10 hours, then every 12 hours, until 72 hours after the event.
- An endpoint that has failed continuously for 72 hours is turned off, and the workspace's owners and admins get an email. Its pending deliveries are dropped. Turning it back on in the dashboard resumes deliveries for new events.
- Events are never lost when deliveries fail: they stay in the event feed. Read from where you left off with
tenth.events.listAll({ after: lastProcessedId }).
Respond quickly and do slow work afterwards, for example by queueing the event, so deliveries don't time out.