Developer documentationDocsGet API keys

Webhooks

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.

The payload

{
  "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).

Headers

HeaderMeaning
ronda-signaturet=<unix>,v1=<hmac> — HMAC-SHA256 of `${t}.${body}`
ronda-event-typeThe event type, for routing without parsing
ronda-delivery-idThe 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-modetest or live
user-agentRonda-Webhooks/1.0

Verifying a signature

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.

Retries

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.

Idempotency on your side

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".

Endpoint requirements

  • HTTPS, on a publicly resolvable address, port 80 or 443 — in test mode as in live. Ronda cannot reach 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.)
  • Private, loopback, link-local and cloud-metadata ranges are refused — both when you save the URL and again immediately before every delivery, so DNS cannot be re-pointed at an internal service afterwards.
  • Redirects are not followed.

Payments from a Page

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).

EventWhat to do with it
checkout.session.completedGive access. It carries metadata.page, customer_email, customer, amount, currency, type (payment once, subscription monthly) and, for a monthly payment, subscription.
payment.succeededThe first payment carries metadata.page; a monthly renewal carries subscription — look up the subscription id you stored.
subscription.canceledTake 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 });
}
  • A one-time payment has no end: nothing is sent later. If access should expire, set the date when you grant it.
  • The payer may have typed their own amount. Read amount and currency from the event.
  • Each amount people choose for a monthly payment becomes its own price, under one product per page. They carry 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 catalogue

Payments

EventWhen it fires
payment.createdA payment was recorded, before the bank was called. A checkout the customer abandons leaves it pending or canceled — never fulfil on this event.
payment.succeededMoney 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.failedThe bank declined. Check failure_code and failure_message. card says which card was refused and where it was issued (card.country).
payment.requires_actionThe 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.refundedFully refunded. Carries only id, amount_refunded, amount, currency and status.
payment.partially_refundedPartly refunded. The same five fields.
payment.settledThe bank settled the funds to the merchant; carries only id, amount, currency and settled_at (an ISO date string)

Subscriptions

EventWhen it fires
subscription.createdA subscription exists. Its status is trialing, active (started from a paid checkout) or incomplete (made through the API, first charge about to run).
subscription.activatedFirst 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_endSeven 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.updatedQuantity, 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_changedPlan 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_failedA 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_dueA 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_failedA dunning retry also failed
subscription.recoveredDunning 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.pausedPaused 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.resumedResumed. One paused while owing money is past_due until the owed charge succeeds
subscription.canceledCanceled, by request or after the last retry failed (cancellation_details.canceled_by: "payment_failed")

Customers, cards and checkout

EventWhen it fires
customer.createdA customer record was created
customer.updatedCustomer details changed
customer.deletedPersonal data cleared, cards deactivated. Carries id and deleted: true.
customer.credit_adjustedYou 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.attachedA card was saved (the token, never the number). Carries id, brand, last4 and customer.
payment_method.detachedA card was removed and deactivated at the bank. Carries id and customer.
checkout.session.completedA 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.expiredA 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

Money and account

EventWhen it fires
refund.createdA refund was recorded
refund.succeededThe bank accepted the refund
refund.failedThe bank rejected the refund. A refund the bank never answered stays pending, with no event, until Ronda has settled it with the bank.
dispute.openedA chargeback was raised
dispute.closedA chargeback was won or lost; carries status, amount and currency
product.createdA product was created
product.updatedA product changed
product.archivedA product and its prices were archived
plan.createdA price was created
plan.updatedA price changed
plan.archivedA price was archived
coupon.createdA coupon was created
coupon.archivedA coupon was archived
discount.createdA coupon was applied to a subscription — by you, or by a checkout. Carries id, coupon, subscription and customer.
discount.removedA discount was removed. Carries id.
payment_link.createdA payment link was created
payment_link.updatedA payment link changed
invoice.finalizedAn 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.paidAn invoice to your customer was paid
invoice.voidedAn invoice was voided
invoice.uncollectibleAn invoice went unpaid past its grace period
merchant.suspendedLive processing was suspended, for example for an unpaid Ronda invoice; renewals wait and are not lost. Carries id and reason.
merchant.reinstatedLive processing was restored
webhook.testOnly 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.