This page configures merchant notifications from Longplay to your backend. Payment webhooks from Stripe to Longplay use a separate endpoint and signing secret; configure them with the Stripe integration guide.
A Customer's subscription or billing state changed, for example activation after payment, a plan change, renewal, or a seat or credit adjustment.
billing.conflict
A payment was received, but the purchase conflicts with the Customer's existing subscription and no access was granted. Handle it, for example with a refund.
usage.consume
Usage is recorded.
usage.confirm
A reservation is confirmed.
usage.refund
Usage is refunded.
usage.limit
Usage reaches a set share of its limit (thresholds in manageBillingLimits).
usage.allowance
Usage reaches a set share of the included allowance (includedThresholds).
usage.alert
Usage reaches a set quantity (absoluteThresholds).
Notification types
billing.purchase
Sent when
A purchase is paid and verified.
billing.updated
Sent when
A Customer's subscription or billing state changed, for example activation after payment, a plan change, renewal, or a seat or credit adjustment.
billing.conflict
Sent when
A payment was received, but the purchase conflicts with the Customer's existing subscription and no access was granted. Handle it, for example with a refund.
usage.consume
Sent when
Usage is recorded.
usage.confirm
Sent when
A reservation is confirmed.
usage.refund
Sent when
Usage is refunded.
usage.limit
Sent when
Usage reaches a set share of its limit (thresholds in manageBillingLimits).
usage.allowance
Sent when
Usage reaches a set share of the included allowance (includedThresholds).
usage.alert
Sent when
Usage reaches a set quantity (absoluteThresholds).
billing.* events are sent only when Billing events is on.
After billing.updated or billing.conflict, read the Customer's current state with readHoldings instead of inferring it from the notification.
New types may be added: return 2xx for types you don't handle and ignore them.
The event ID, equal to the body id and unchanged on retries.
X-Indiana-Signature
t=<Unix seconds>,v1=<HMAC-SHA256 hex>
X-Indiana-Key-Id
The signing key ID, used during key rotation.
Headers
X-Indiana-Event-Id
Content
The event ID, equal to the body id and unchanged on retries.
X-Indiana-Signature
Content
t=<Unix seconds>,v1=<HMAC-SHA256 hex>
X-Indiana-Key-Id
Content
The signing key ID, used during key rotation.
Return 2xx within 8 seconds; store the event first and process it asynchronously.
The same event can arrive more than once; deduplicate by event ID. Non-2xx responses and timeouts are redelivered, up to 10 attempts including the first.
Bodies are at most 64 KiB; amounts and quantities are decimal strings.
Compute HMAC-SHA256 over <timestamp>.<raw body> with the Base64URL-decoded key, compare it with v1, and reject timestamps older than five minutes. Use the raw request bytes.
app/api/indiana/route.tsTypeScript
1import { createHmac, timingSafeEqual } from"node:crypto";23const key = Buffer.from(process.env.LONGPLAY_NOTIFICATION_KEY!, "base64url");4const toleranceSeconds = 300;56/** rawBody must be the exact request bytes, read before any JSON parsing. */7exportfunctionverifyLongplaySignature(rawBody: Buffer, header: string | null) {8const parts = Object.fromEntries(9 (header ?? "").split(",").map((part) => part.split("=", 2)),10 );11const timestamp = Number(parts.t);12if (!Number.isSafeInteger(timestamp) || !parts.v1) returnfalse;13if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) returnfalse;14const expected = createHmac("sha256", key)15 .update(`${timestamp}.`)16 .update(rawBody)17 .digest();18const received = Buffer.from(parts.v1, "hex");19return received.length === expected.length && timingSafeEqual(received, expected);20}2122// Your own storage: returns false when this event ID was already recorded.23declare functionrecordOnce(eventId: string, event: unknown): Promise<boolean>;2425exportasyncfunctionPOST(request: Request) {26const rawBody = Buffer.from(await request.arrayBuffer());27if (!verifyLongplaySignature(rawBody, request.headers.get("X-Indiana-Signature")))28returnnewResponse("invalid signature", { status: 401 });29const event = JSON.parse(rawBody.toString("utf8")) as { id: string; type: string };30awaitrecordOnce(event.id, event); // persist first, process asynchronously31returnnewResponse(null, { status: 200 });32}
A Funnel external task node sends a funnel.task request to the same receiver with the same signature. Return outcome and data in a 2xx response; data must match the node's declared outputs and stay within 8 KiB.