Ronda POSTs a signed JSON payload to your endpoint every time something happens. Deliveries are written to an outbox in the same database transaction as the change that caused them, so an event can never be lost because a request failed.
{
"id": "evt_9f3a2c…",
"object": "event",
"type": "payment.succeeded",
"mode": "live",
"created": 1786998900,
"data": {
"object": {
"id": "pay_a348cb…",
"object": "payment",
"amount": 12900,
"currency": "AMD",
"status": "succeeded",
"type": "subscription",
"description": "Pro — Monthly",
"customer": "cus_1b4c…",
"subscription": "sub_5c1e…",
"payment_method": "pm_77a2…",
"card": { "brand": "Visa", "last4": "4242", "exp_month": 12, "exp_year": 2030, "country": "AM" },
"amount_refunded": 0,
"approval_code": "482913",
"attempt": 1,
"is_recovery": false,
"failure_code": null,
"failure_message": null,
"metadata": {},
"created": 1786998890
}
}
}data.object is the object as the API returns it — the payment, subscription, invoice and so on — except where the catalogue below says an event carries only a few fields. Every amount comes with its currency. An endpoint receives the events of its own mode only, and only the types in its enabled_events (all of them by default).
| Header | Meaning |
|---|---|
ronda-signature | t=<unix>,v1=<hmac> — HMAC-SHA256 of `${t}.${body}` |
ronda-event-type | The event type, for routing without parsing |
ronda-delivery-id | The delivery (whd_…): one per event per endpoint, the same on every automatic retry. A replay from the dashboard is a new delivery with a new id. |
ronda-mode | test or live |
user-agent | Ronda-Webhooks/1.0 |
The timestamp is inside the signed material, which is what makes replay detection possible: a captured request cannot be re-sent later, because its t falls outside your tolerance and changing t invalidates the HMAC. Reject anything older than five minutes.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(",").map(kv => kv.split("=")));
const age = Math.abs(Math.floor(Date.now() / 1000) - Number(parts.t));
if (!Number.isFinite(Number(parts.t)) || age > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1 ?? "");
return a.length === b.length && timingSafeEqual(a, b);
}Verify against the raw request body. Parsing and re-serialising the JSON changes the bytes and the signature will not match.
The secret is the whole string you were given, whsec_ prefix included — do not strip or decode it. Every attempt is signed afresh with its own t, so a late retry still verifies. After roll_secret the old secret stops verifying at once. To debug a mismatch, send a test event (POST /v1/webhook_endpoints/:id/test): the delivery it returns carries request_body and signature, the exact bytes and header Ronda sent.
Any response outside 2xx is a failure. Ronda makes up to ten attempts in all over about three days — the first straight away, then retries after 10 seconds, 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours, 24 hours and 24 hours — then stops. An endpoint that has accepted nothing for three days, with at least twenty failed attempts in a row, is disabled and shown as such in the dashboard, where you can also inspect and replay any delivery. A shorter outage never disables it. Turn it back on in the dashboard or with POST /v1/webhook_endpoints/:id {"disabled": false}, which also resets its failure count. Deliveries that failed while it was off are not sent again by themselves: replay them, or read what you missed from GET /v1/events.
Reply quickly and do the work afterwards. If your handler takes longer than 8 seconds, Ronda treats the delivery as failed and will send it again.
A retry means your endpoint can see the same event twice. Deduplicate on the event id, which never changes — not on ronda-delivery-id, which stays the same across retries but is new when a delivery is replayed from the dashboard, and differs between two endpoints receiving the same event.
Events can arrive out of order, because a retry of an older one can land after a newer one. Do not work out state from the order they arrive in: on a subscription.* event, read the subscription's status from the event when it is there, or fetch it with GET /v1/subscriptions/:id — a few events carry only some fields (the catalogue says which), so a missing status means "fetch it", never "no access".
localhost on your machine; to receive test webhooks while developing, expose your local server through a tunnel (ngrok, Cloudflare Tunnel) and register its https URL. (A copy of Ronda running on your own machine does allow loopback, for its own test suite — ronda.sh never does.)A Page is a payment page at ronda.am/your-name that you make in the dashboard under Sell → Pages — for when you have no website. People pick an amount and pay once or every month. It is made in the dashboard, not through the API.
If all you need is to thank the payer or hand them a link or a login, you need no code: set Message after payment and After payment, send people to on the page. The message is shown right after paying and is included in the receipt email; nobody can read it before paying.
If your own system should react — open access, add someone to a list — a payment on a Page sends the same signed events as every other payment. What marks it is metadata.page, the page's id (page_…, in the address of that page in your dashboard).
| Event | What to do with it |
|---|---|
checkout.session.completed | Give access. It carries metadata.page, customer_email, customer, amount, currency, type (payment once, subscription monthly) and, for a monthly payment, subscription. |
payment.succeeded | The first payment carries metadata.page; a monthly renewal carries subscription — look up the subscription id you stored. |
subscription.canceled | Take access away. The subscription carries metadata.page too. Do not act on the first payment.failed: Ronda retries the card first. |
if (event.type === "checkout.session.completed" && event.data.object.metadata?.page === PAGE_ID) {
const o = event.data.object;
await grantAccess({ email: o.customer_email, customer: o.customer, subscription: o.subscription ?? null });
}
if (event.type === "subscription.canceled" && event.data.object.metadata?.page === PAGE_ID) {
await revokeAccess({ subscription: event.data.object.id });
}amount and currency from the event.metadata.page, appear in GET /v1/plans and GET /v1/products, and are hidden from the Products list in the dashboard. Do not archive or edit them.| Event | When it fires |
|---|---|
payment.created | A payment was recorded, before the bank was called. A checkout the customer abandons leaves it pending or canceled — never fulfil on this event. |
payment.succeeded | Money was taken. The one to act on for one-off payments. For a subscription started at checkout it fires before the subscription exists, so its subscription is null — act on subscription.activated or checkout.session.completed, which carry both. |
payment.failed | The bank declined. Check failure_code and failure_message. card says which card was refused and where it was issued (card.country). |
payment.requires_action | The card's bank forced 3-D Secure on a charge with no customer present — a renewal or POST /v1/payments (failure_code: authentication_required). A renewal then goes to past_due. |
payment.refunded | Fully refunded. Carries only id, amount_refunded, amount, currency and status. |
payment.partially_refunded | Partly refunded. The same five fields. |
payment.settled | The bank settled the funds to the merchant; carries only id, amount, currency and settled_at (an ISO date string) |
| Event | When it fires |
|---|---|
subscription.created | A subscription exists. Its status is trialing, active (started from a paid checkout) or incomplete (made through the API, first charge about to run). |
subscription.activated | First charge succeeded — through the API or at checkout. A trial never sends it: a trial starts with subscription.created (status trialing) and turns paid with subscription.updated. So grant access from the subscription's status on any subscription.* event, not from this event alone. |
subscription.trial_will_end | Seven days before a trial ends — only for a trial longer than seven days. Carries only id and trial_end (an ISO date string), not the subscription. |
subscription.updated | Quantity, period or cancellation flag changed — or the customer scheduled or withdrew a pause (pause.scheduled: true). After a failed payment recovers with more than one period missed, the business's "start fresh" choice (the default) restarts the period from the payment: this event then carries period_reanchored: true and the new current_period_start/end. Absent on every other update. |
subscription.plan_changed | Plan changed; carries previous_plan, previous_quantity, proration { charged, credited, currency, payment } — the same object as the change_plan response — and changed_by: "merchant" (dashboard or API) or "customer" (the portal). A change made with billing_cycle_anchor "now" carries billing_cycle_anchor: "now", proration: null and period_charge { payment, amount, subtotal, discount, credit_applied, currency, period_start, period_end, invoice }, and its current_period_start/end are the new period's. It is also how you learn that a change answered 409 charge_pending went through. |
subscription.plan_change_failed | A change_plan with billing_cycle_anchor "now" ended without the change — declined (reason: "declined"), never sent to the bank ("not_sent"), or the subscription changed while it was pending and the charge is refunded ("subscription_changed", refunded: true). Carries requested_plan, previous_plan, payment, amount, currency. |
subscription.past_due | A charge failed and dunning has started — a renewal, a trial ending with no card or a declined one, or the first charge of a subscription created through the API. failure_code is no_payment_method when there was no card. |
subscription.charge_failed | A dunning retry also failed |
subscription.recovered | Dunning worked — the subscription is active again; carries only id, recovered_amount, its currency and attempts — not the subscription, which arrives in the subscription.updated sent with it — and period_reanchored: true when the period restarted from the payment instead of every missed period being charged |
subscription.paused | Paused by the merchant; after the last retry failed, when the merchant chose pause (pause_reason: "payment_failed"); or by the customer from the portal, when their paid period ends (pause_reason: "customer_requested", and pause.resumes_at says when billing restarts) |
subscription.resumed | Resumed. One paused while owing money is past_due until the owed charge succeeds |
subscription.canceled | Canceled, by request or after the last retry failed (cancellation_details.canceled_by: "payment_failed") |
| Event | When it fires |
|---|---|
customer.created | A customer record was created |
customer.updated | Customer details changed |
customer.deleted | Personal data cleared, cards deactivated. Carries id and deleted: true. |
customer.credit_adjusted | You granted or took back account credit (POST /v1/customers/:id/credit_transactions); carries the transaction — amount (negative for a take-back), currency, balance_after, description, metadata — and the customer's credit_balances |
payment_method.attached | A card was saved (the token, never the number). Carries id, brand, last4 and customer. |
payment_method.detached | A card was removed and deactivated at the bank. Carries id and customer. |
checkout.session.completed | A checkout finished successfully. Carries id, type, status, amount, currency, customer, customer_email, plan, payment, payment_method, subscription, mode, your metadata and completed_at. It is sent after the payment and subscription events of the same checkout. From a payment link, metadata.payment_link names the link. |
checkout.session.expired | A checkout was abandoned and expired after 30 minutes. Carries only id, plus closed_reason: fallback when Ronda closed it early because the bank's page failed and sent the customer to your fallback_url. Any other checkout Ronda closes itself — replaced by a typed promotion code, or its account credit moved back to an older checkout the customer paid — sends no event and took no money |
| Event | When it fires |
|---|---|
refund.created | A refund was recorded |
refund.succeeded | The bank accepted the refund |
refund.failed | The bank rejected the refund. A refund the bank never answered stays pending, with no event, until Ronda has settled it with the bank. |
dispute.opened | A chargeback was raised |
dispute.closed | A chargeback was won or lost; carries status, amount and currency |
product.created | A product was created |
product.updated | A product changed |
product.archived | A product and its prices were archived |
plan.created | A price was created |
plan.updated | A price changed |
plan.archived | A price was archived |
coupon.created | A coupon was created |
coupon.archived | A coupon was archived |
discount.created | A coupon was applied to a subscription — by you, or by a checkout. Carries id, coupon, subscription and customer. |
discount.removed | A discount was removed. Carries id. |
payment_link.created | A payment link was created |
payment_link.updated | A payment link changed |
invoice.finalized | An invoice to your customer was issued — every billed subscription period writes one, and so does POST /v1/invoices. Invoice events carry the invoice without its lines. |
invoice.paid | An invoice to your customer was paid |
invoice.voided | An invoice was voided |
invoice.uncollectible | An invoice went unpaid past its grace period |
merchant.suspended | Live processing was suspended, for example for an unpaid Ronda invoice; renewals wait and are not lost. Carries id and reason. |
merchant.reinstated | Live processing was restored |
webhook.test | Only from POST /v1/webhook_endpoints/:id/test or the dashboard's Send test. Its id starts evt_test_, it is sent whatever enabled_events says, and it cannot be subscribed to. Verify it, answer 2xx and ignore it. |