Subscription webhooks (API version 1.0)
The endpoint and delivery console UI is not available yet. Setup currently requires an administrator using the authenticated console API; browser-only self-service setup remains pending.
Create an endpoint through the authenticated console API at POST /console/projects/{project_id}/outbound/endpoints. An admin or owner supplies url, optional non-empty event_types (default all), send_sandbox (default false), and enabled (default true). The URL must use HTTPS on port 443 without credentials or fragments. Delivery resolves the destination on every attempt, rejects private and reserved addresses, pins the verified public address for the connection, verifies TLS for the original host, and does not follow redirects.
The creation response contains a whsec_… secret once. Store it in your backend's secret manager. Later reads omit it. The service stores signing secrets encrypted with its server encryption key. POST /console/projects/{project_id}/outbound/endpoints/{id}/rotate-secret returns a replacement secret once and invalidates the old signing secret immediately. Coordinate the receiver update before rotation. Skeleton endpoints created before this feature are disabled by the migration and require rotate-secret before re-enabling. Invalid or absent encrypted secrets cannot be enabled.
GET lists endpoints, PUT /endpoints/{id} replaces configuration without changing the secret, and DELETE /endpoints/{id} removes an endpoint and its delivery records. Endpoint configuration, delivery logs, and replay require an admin or owner of that project. Identifiers from another project return 404.
Payload
{
"api_version": "1.0",
"event_id": "00000000-0000-4000-8000-000000000001",
"type": "RENEWAL",
"created_at": "2026-10-30T12:00:00.000Z",
"project_id": "1",
"environment": "production",
"user_id": "your-app-user-id",
"subscriber_id": "2",
"data": {
"product_id": "com.example.premium.monthly",
"store": "app_store",
"state": "active",
"expires_at": "2026-11-30T12:00:00.000Z",
"will_renew": true,
"is_family_shared": false,
"country": "DEU",
"price": { "amount": "9.990000", "currency": "USD" },
"proceeds_estimate": null,
"period_type": "regular",
"original_transaction_id": "SYNTHETIC-original",
"transaction_id": "SYNTHETIC-renewal",
"grace_period_expires_at": null,
"observed_only": false
}
}
Project/subscriber IDs are decimal database ID strings (no prj_/sub_ prefix). Amounts are exact decimal strings with six fractional digits; refunds carry negative amounts. Shared access has no revenue (price: null). Unbound chains have null user_id and subscriber_id. An unknown historical Google product or pricing phase remains null, rather than borrowing today's product or phase. transaction_id identifies the individual charge; a refund points to its original charge. original_transaction_id identifies the store chain.
Charge/refund event times come from verified store records. An expiry from an Apple historical transaction remains its own expiry. Historical Google expiry remains null when its original service end is unavailable. Lifecycle transitions whose store resource provides only the current state carry observed_only: true and their observation time; do not treat that observation as an exact historical cancellation or pause time. Grace deadlines are separate from the paid-period expiry in grace_period_expires_at. Financial events capture the persisted proceeds estimate as an exact decimal amount and currency. Unsupported fee terms or unavailable original receipts leave it null. Family access, internal state, and lifecycle-only events carry no proceeds. The immutable event retains its captured estimate; a later explicit accounting reprice does not rewrite past deliveries.
On the first observation of a previously unknown chain, all newly verified historical charges and refunds are journaled and delivered to endpoints enabled at that time. This includes store-history imports and migration backfills; created_at remains the original store time and observed_only stays false for those financial events. Receivers must distinguish historical accounting from granting new access and use verified current entitlements for access decisions. Configuring a new endpoint does not replay already journaled history; replay is explicit.
Events
Supported types are INITIAL_PURCHASE, TRIAL_STARTED, TRIAL_CONVERTED, RENEWAL, PRODUCT_CHANGE, CANCELLATION, UNCANCELLATION, BILLING_ISSUE, EXPIRATION, REFUND, FAMILY_ACCESS_GRANTED, FAMILY_ACCESS_REVOKED, ONE_TIME_PURCHASE, PAUSED, and RESUMED. Trial conversion is determined from the preceding billed phase. Verified restoration from a paused, held, billing-retry, refunded, or revoked state produces RESUMED when access returns without a new charge. A recovery with a new charge sends that charge event without RESUMED; leaving grace alone does not imply access was lost. A product switch with a new charge produces one priced PRODUCT_CHANGE; a same-charge deferred switch produces one observation-only, price-null event. Unmapped internal events produce no outgoing event.
Sandbox events are delivered only to endpoints whose send_sandbox setting is true. Each endpoint can select event types independently.
Verify the signature
The header is X-Signature: t=<unix_seconds>,v1=<hex_digest>, where the digest is HMAC-SHA256 over the timestamp, a dot, and the exact request bytes, using your endpoint secret. Reject requests whose timestamp differs from your clock by more than five minutes. Compare digests in constant time before parsing or acting on the JSON. The verification helper below uses Node crypto and must receive the original request bytes, before JSON parsing.
Return a 2xx response promptly after durably accepting an event. Deduplicate on event_id, which is stable across retries, endpoint copies, and manual replays. Signatures receive a fresh timestamp on every attempt. A timeout may happen after your backend committed the event, so duplicate delivery is expected.
Retries, logs, and replay
Delivery has a ten-second timeout. Any non-2xx response or network/TLS/DNS failure schedules retries after 1 minute, 5 minutes, 30 minutes, 2 hours, 12 hours, and 24 hours three times. After the ninth failed attempt the delivery becomes dead and raises an outbound_delivery_dead alert. The dispatcher intentionally uses a minute sweep, so a newly committed event or replay may wait up to a minute before its first attempt, plus queue backlog. The sweep pages through all due deliveries, deduplicates queued jobs, and sends batches of up to ten concurrent requests. Each destination event proceeds independently. Attempts are consumed when claimed, even if a worker crashes before saving a result; an expired ninth lease becomes dead without another POST. Lost attempts can have no response log. The normal retry delays apply to recorded failures, while abandoned leases become eligible for recovery after one minute.
GET /console/projects/{project_id}/outbound/deliveries lists recent delivery summaries; optional endpoint_id and limit (1–100) filter the list. GET /deliveries/{id} returns the payload and attempts, including response status and the first 1 KB of the response. Signing secrets are redacted from response logs, NUL bytes are replaced, and logs contain at most 1 KB of valid UTF-8. Network failures use allowlisted reasons such as enotfound, cert_has_expired, econnrefused or destination_not_public; arbitrary error messages, headers and URLs are not stored.
POST /console/projects/{project_id}/outbound/deliveries/{id}/replay creates a new delivery with the same event and event ID, zero attempts, and a fresh signature on dispatch. Its endpoint must still exist and be enabled. Replaying does not rerun store processing or change money and entitlement state.
Deliveries are independent and may arrive out of order. Use created_at, the store state, and observed_only to interpret updates; do not use arrival order as a subscription state machine.
Node verification helper
// Node ESM receiver helper. Pass the raw request bytes before JSON parsing.
import {Buffer} from 'node:buffer';
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verifyWebhook(rawBody, signature, secret, now = Math.floor(Date.now() / 1000)) {
const match = /^t=(\d+),v1=([a-f0-9]{64})$/.exec(signature ?? '');
if (!match || !Number.isFinite(now) || !Number.isSafeInteger(Number(match[1])) || Math.abs(now - Number(match[1])) > 300) return false;
const expected = createHmac('sha256', secret).update(match[1] + '.').update(rawBody).digest();
return timingSafeEqual(expected, Buffer.from(match[2], 'hex'));
}