Webhooks

Paylo notifies your server about every payment event with an HMAC-signed POST. Optional — you can poll instead — but the right tool for granting access server-side.

Setup#

Set your endpoint URL in Dashboard → Settings. The whsec_… signing secret is right below it (Reveal / Copy) — store it next to your secret key. One URL receives both environments: check the mode field and never grant real access for a test event.

Events#

FieldTypeDescription
payment.completedone-timeA payment session was paid
subscription.activatedsubscriptionFirst payment succeeded — grant access (also sent for one-time / lifetime plan purchases)
subscription.trial_startedsubscriptionCheckout completed with a free trial — grant access, no money yet
subscription.trial_endingsubscription3 days before the first charge — nudge your customer
subscription.renewedsubscriptionA subscription invoice was paid — each renewal and the first charge after a trial. Can also arrive for the very first payment, right after subscription.activated: treat it as "paid through current_period_end"
subscription.payment_failedsubscriptionRenewal failed — subscription is past_due, Stripe retries automatically
subscription.updatedsubscriptionAnything changed on Stripe's side — status (e.g. cancelling), plan switch, new period end
subscription.cancelledsubscriptionSubscription ended — revoke access
Payload
POST https://your-server.com/paylo-webhook
X-Paylo-Signature: sha256=…
X-Paylo-Timestamp: 1752312345

{
  "event": "subscription.activated",
  "mode": "live",
  "data": {
    "id": "8f3c2a1e-…",            // the Paylo subscription id
    "customer_id": "user_42",
    "customer_email": "jane@example.com",   // null if not collected
    "status": "active",
    "plan_name": "Pro Monthly",
    "plan_amount": 999,
    "plan_currency": "eur",
    "plan_interval": "monthly",
    "current_period_end": "2026-08-12T00:00:00.000Z"
  },
  "timestamp": 1752312345
}

Sale notifications (Slack / Discord)#

Separate from developer webhooks: paste a Slack or Discord webhook URL in Settings → Sale notifications and every collected payment pings your channel — 💰 €9.99 subscription payment: Pro Monthly — user_42. Test-mode sales are prefixed with [TEST], and a “Send test” button checks the wiring. No code, no signature — it's just dopamine.

Verifying signatures#

Compute HMAC-SHA256 of the raw body with your webhook secret and compare it to X-Paylo-Signature (minus the sha256= prefix):

Node.js
import crypto from "crypto";

function verify(rawBody, signatureHeader, secret) {
  const expected = crypto
    .createHmac("sha256", secret)
    .update(rawBody)
    .digest("hex");
  const received = signatureHeader.replace("sha256=", "");
  return crypto.timingSafeEqual(
    Buffer.from(expected), Buffer.from(received));
}
Always verify against the raw request body — parsing and re-serializing JSON changes the bytes and breaks the signature.

Delivery & retries#

Respond with a 2xx within 10 seconds. Failed deliveries are retried automatically with backoff — 1 min, 5 min, 30 min, 2 h (5 attempts total). Every attempt is visible in Dashboard → Webhooks with the response code and body, and failed deliveries have a Resend button.

Make your handler idempotent: the same event can arrive more than once (retries, manual resends). Payloads carry no event id — dedupe on event + data.id (+ data.current_period_endfor renewals), and prefer setting state (“user 42 is premium”) over incrementing it.