Webhooks
Every event Payrudder sends, the payload envelope, how to verify a signature, and how retries and ordering work.
Webhooks tell your systems what happened in Payrudder without polling: an invoice was paid, a subscription changed, a customer was blocked. Register an endpoint, pick the events you want, verify each delivery, and answer 2xx.
Register an endpoint
Create the endpoint
POST /v1/webhook-endpoints, or the console's Webhooks tab. Each endpoint has a URL, an optional description and the event types it wants (none ticked: every type). A tenant can register up to 20 endpoints.
Store the signing secret
The create response carries the signing secret (whsec_...) once. It is stored sealed and cannot be read back, only rotated.
Send a test event
POST /v1/webhook-endpoints/{id}/test sends a ping event. Its data is {"message": "This is a test event from Payrudder."} and it cannot be subscribed to.
The URL must be https://, must not carry credentials and must resolve to a public address. The check is made when the connection is opened, after DNS, so a name that points inward (or changes its answer) is refused. Redirects are not followed and no proxy is used.
To receive events on your own machine during development, see Local webhooks.
Rotate the secret
POST /v1/webhook-endpoints/{id}/rotate-secret returns the new secret once. The old one keeps signing for 24 hours, so a receiver can switch without losing a delivery.
The payload
A delivery is a JSON POST:
{
"id": "0192...",
"type": "invoice.paid",
"created": "2026-10-20T10:00:00Z",
"tenant_id": "0192...",
"data": {
"invoice_id": "...",
"number": "INV-2026-000007",
"total_minor": "1116",
"tax_minor": "186",
"net_minor": "930",
"environment": "live",
"status": "paid"
}
}idstringThe event id. Use it to ignore a repeat.
typestringThe event type, from the catalogue below.
createdstringWhen the event happened, second precision, UTC.
tenant_idstringYour tenant.
dataobjectThe event's own fields. The machine-readable shape of every data is in the API reference (WebhookEvent, one schema per type).
The body is exactly these five fields; there is no API version field. Money is a string of minor units, as in the REST API. The credit counts of credits.* events (credits, bonus_credits, balance, threshold, and credits of payment_link.created) are JSON numbers.
Events are delivered at least once and not in order. Use id to ignore a repeat, and fetch the object from the API when you need its present state.
Verify a delivery
Every delivery carries these headers:
Payrudder-Signature: t=1700000000,v1=<hex>[,v1=<hex>]
Payrudder-Event-Id: <id>
Payrudder-Event-Type: <type>
Payrudder-Delivery-Attempt: <n>Each v1 is HMAC-SHA256(secret, "<t>.<raw body>") in hex. There are two while a rotated secret is still accepted.
- Compute it over the raw bytes, before you parse the JSON.
- Compare in constant time.
- Reject a
tmore than five minutes from your clock.
# A delivery carries Payrudder-Signature: t=<unix time>,v1=<hex>. The hex is HMAC-SHA256 of "<t>.<raw body>" under your endpoint's secret.
# Check it on the raw body before parsing; the SDKs do it for you (see the other tabs).Delivery and retries
Answer 2xx within 10 seconds. Anything else (a status, a timeout, a refused connection) is retried after:
| Attempt | Delay after the previous one |
|---|---|
| 2 | 1 minute |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
| 6 | 6 hours |
| 7 | 24 hours |
After the seventh attempt the delivery is failed.
GET /v1/webhook-deliveries(filter withendpoint_id) shows each delivery with its attempts and the last answer.POST /v1/webhook-deliveries/{id}/redeliversends one again from the start.- A paused endpoint (
active: false) receives nothing new. - Deliveries and events are kept for 30 days.
A tenant the operator has suspended, frozen or banned sends no webhooks. Its deliveries wait (without using up an attempt, for up to the 30 days events are kept) and go out when the tenant is reinstated.
Subscription events are written in the same transaction as the change, so an event exists exactly when the change does. Invoice and credit note events are recorded in the transaction that changes the invoice and handed on until they are recorded for delivery. The event id is derived from the occurrence, so a repeat is harmless. If no endpoint wants a type, nothing is stored.
Event catalogue
Invoices and credit notes
| Type | When | data |
|---|---|---|
invoice.finalized | an invoice gets its number | invoice_id, number, customer_id, customer_external_id, period_id, currency, total_minor, status |
invoice.paid, invoice.voided, invoice.uncollectible | the invoice reaches that state | the same, plus environment (sandbox or live; invoice.finalized does not carry it). invoice.paid also has tax_minor and net_minor (the total less its TAX lines: what a partner commission is a share of), and, when the invoice came from a link that has an order_ref, order_ref and link_id (to match your order). status is paid, void (not voided) or uncollectible |
credit_note.created | a credit note is issued | credit_note_id, number, invoice_id, invoice_number, customer_id, customer_external_id, currency, total_minor, tax_minor (the part of total_minor that is the invoice's tax given back; 0 when none), reason, disposition (credit/refund), and for a refund refund_state |
credit_note.refunded, credit_note.refund_failed | the provider settled (or refused) a refund to the card, or an operator confirmed after checking at the provider that a refund of unknown outcome was made | the same, with the outcome (refund_error on failure) |
Subscriptions
subscription is the subscription as the API returns it, but without the fields at their zero value (an empty string, 0, false and an unset time are left out). scheduled_change and coupon_code are only on subscription.created, subscription.changed and subscription.change_scheduled.
| Type | When | data |
|---|---|---|
subscription.created | a subscription is created | subscription |
subscription.changed | a plan or interval change took effect (now, or at the end of the period) | subscription (the new one), previous_subscription_id, quote; a change that was scheduled and applied at the end of the period has scheduled: true and no quote |
subscription.change_scheduled | a change was set for the end of the period | subscription, quote |
subscription.cancelled | it ended now (credited_minor, a string, when the unused fee was credited). A cancellation with a future end_time is subscription.cancellation_scheduled; nothing is sent when that day arrives | subscription |
subscription.cancellation_scheduled, subscription.cancellation_withdrawn | cancel at period end was set / taken back | subscription |
subscription.paused, subscription.resumed | the subscription was paused / resumed | subscription |
subscription.moved_to_provider | a provider migration took over | subscription, previous_subscription_id, to_provider |
subscription.trial_will_end | a trial ends in 3 days or fewer; once per trial end: an extended or restarted trial is announced again, a plan change that keeps the trial end is not. Not sent for a subscription a provider runs, or one that is paused or set to cancel | subscription (its trial_end_time says when) |
subscription.updated | the seller ended a running trial early (POST /v1/subscriptions/{id}/end-trial): the subscription is active and its first fee is due now. A trial that runs to its end sends nothing | subscription |
Payment links and disputes
| Type | When | data |
|---|---|---|
payment_link.created | a payment link was made (not the invoice links an ad-hoc link hands out) | link_id, kind (invoice, adhoc or credit_pack), single_use, expires_at; when set: invoice_id, amount_minor, currency, description, customer_external_id, and for a credit pack pack_id, quantity, credits |
payment_link.paid | an invoice was paid through the link (once per link and invoice) | link_id, kind, invoice_id, invoice_number, customer_external_id, currency, total_minor, paid_count; when the link has an order_ref: order_ref |
payment_link.expired | the link expired unpaid (a single-use link that was paid is used, not expired) | link_id, kind, expires_at; when set: invoice_id, amount_minor, currency, customer_external_id |
payment.disputed | a customer questioned a payment with their bank, or the case moved on or ended (see below) | invoice_id, invoice_number, customer_external_id, provider, dispute_id (the provider's reference of the case, the same in every event about it), payment_ref, amount_minor (a string), currency, outcome (open, won or lost), formal (true for a chargeback, which takes the money back; false for an inquiry or a warning), reason (the cardholder's, in the provider's words; may be empty), provider_status; when the provider gives a date: evidence_due_time |
payment.disputed is sent once per step: a case that opens, and later is won or lost, is two or three events, each once however many notifications the provider sends for it.
- Stripe:
charge.dispute.created,charge.dispute.updated,charge.dispute.closed,charge.dispute.funds_withdrawnandcharge.dispute.funds_reinstated. The endpoint the registration helper makes is enabled for them; an endpoint made earlier needs them added at Stripe. - Paddle: the
chargebackandchargeback_warningadjustments and their reversals.
A dispute of a payment Payrudder did not make sends nothing.
Credits
| Type | When | data |
|---|---|---|
credits.purchased | a credit pack was paid and its credits granted (once per paid invoice) | customer_id, customer_external_id, credits (the pack's and the bonus of a coupon, in one lot), bonus_credits (the part a coupon added, 0 without one), quantity, balance (spendable after the grant), pack_id, pack_name, link_id, invoice_id, invoice_number, currency, amount_minor, expires_at (absent when they never expire) |
credits.low | a consume took a customer's balance from at least the tenant's threshold (PUT /v1/credits/settings, default off) to below it; once per crossing | customer_id, customer_external_id, balance, threshold |
Contracts
| Type | When | data |
|---|---|---|
contract.accepted | a customer accepted one or more agreements together (a hosted payment page, or your server through POST /v1/customers/{external_id}/contract-acceptances): one event for the group, not for each version | group_id, source (hosted, api), accepted_at, snapshot_sha256, items (acceptance_id, kind, audience, version_id, version, sha256, locale), immediate_start_consent, withdrawal_waiver_acknowledged, context (kind, ref); customer_id and customer_external_id unless it was a guest payment |
contract.version_published | a new version of an agreement was published (POST /v1/contracts/versions) | version_id, kind, audience, number, material, sha256, locales, published_at |
contract.withdrawal_requested | a customer's withdrawal statement was recorded (POST /v1/customers/{external_id}/contract-withdrawals) | withdrawal_id, customer_id, customer_external_id, subscription_id, invoice_id (the last two may be empty), source, received_at |
contract.withdrawal_decided | the seller accepted or rejected a withdrawal, or marked an accepted one refunded (PUT /v1/contract-withdrawals/{id}/status). The refund a decision to accept asks of billing is announced by credit_note.created | withdrawal_id, customer_id, customer_external_id, subscription_id, invoice_id (the last two may be empty), status, decided_by, decided_at, note |
Plans, customers and entitlements
| Type | When | data |
|---|---|---|
plan.created | a plan was created (POST /v1/plans) | plan, exactly as the API returns it (every field present, latest_version 0) |
plan.version_published | a version of a plan was published (POST /v1/plans/{code}/versions) | plan_version, exactly as the API returns it (every field present) |
customer.blocked | a customer was blocked (POST /v1/customers/{external_id}/block); blocking one who is blocked already sends nothing | customer_id, customer_external_id, category (fraud, chargeback, abuse, request, other or empty), reason (the seller's own note), blocked_until (RFC 3339) when the block ends by itself, and suspend_service (true when the block also suspended the customer's service; absent on an event queued before the field existed) |
customer.unblocked | a block was lifted (POST /v1/customers/{external_id}/unblock), or ran out by itself (blocked_until passed): a sweep that runs every few minutes clears it and sends the event, so it can come minutes after the end | customer_id, customer_external_id |
entitlement.updated | what a customer may use of a meter changed: a subscription was created, changed, cancelled, paused or resumed, its trial was ended early, an entitlement override was set or deleted, a block that suspends the service started or was lifted, or the customer reached a limit (a threshold of 100% or more crossed). Use it to drop a cached entitlement; one event per customer and meter in a transaction | customer_external_id, meter_code (empty: every meter of the customer) |
Price changes and campaigns
| Type | When | data |
|---|---|---|
price_change.scheduled | a run of a price change (POST /v1/plans/{code}/price-changes, or POST /v1/price-changes/{id}/retry) scheduled at least one subscription; once per run, not for a dry run. Each subscription also sends subscription.change_scheduled | price_change (as GET /v1/price-changes/{id} returns it, without the fields at their zero value: id, plan_code, from_version, to_version, notice_days, effective_time, state, created_by, create_time and the counts scheduled, applied, withdrawn, skipped), scheduled and skipped (what that run did) |
campaign.started | a campaign's window opened (start_time passed; POST /v1/campaigns). A sweep that runs every minute sends it, so it can come up to a minute late, and once per campaign | promotion_code (the campaign's code, as GET /v1/promotion-codes returns one, with automatic and start_time) and coupon (as GET /v1/coupons returns one) |
campaign.ended | a campaign's window closed (expire_time passed) or it was ended early (DELETE /v1/campaigns/{code}); sent by the same sweep, once per campaign | promotion_code and coupon, as for campaign.started |
Hosted invoice page and payment links
Two kinds of page you can hand to a customer without building one. The full flow is in Accept payments.
POST /v1/invoices/{id}/links ({"expires_in_days": 90}, 1 to 365) returns token, url and expires_at for a finalized invoice. Send the url to your customer: the page shows the invoice (lines, service periods, subtotal, total, status) and a PDF download link (valid five minutes) once the PDF is rendered.
- No sign-in: the token is 256 random bits and only its SHA-256 is stored.
DELETE /v1/invoices/{id}/linksrevokes every link of the invoice.- An unknown, expired or revoked token answers the same 404 page.
- The page is in English, Turkish, German, French, Spanish or Arabic (
?lang=or the browser's language). It sendsCache-Control: no-store,X-Robots-Tag: noindex,Referrer-Policy: no-referrerand a CSP that allows nothing to load from elsewhere. - It is limited to 60 requests a minute per address.
POST /v1/payment-links with kind: invoice (invoice_id, an unpaid finalized invoice) or kind: adhoc (amount_minor, optional currency, description, customer_external_id). The token is returned once (token, url).
Idempotency-Key(oridempotency_key) makes a retry return the first link without its token (replayed: true); the same key with other parameters isbilling.payment_link.idempotency_conflict.single_usedefaults to true for ad hoc, false for an invoice link. Links last 30 days (ad hoc) or 90 days, at most 365.- An ad-hoc link is a factory: its page shows the request and a Continue button. Continue (not the page view) makes the invoice (kind
LINK, gap-free number; no tax is added) and hands the payer an invoice link. A single-use link is consumed by its first paid invoice; a reusable one makes an invoice per use. Revoking it (DELETE /v1/payment-links/{id}) or its expiry voids the invoices nobody paid. - The page shows the amount, lines, seller (name, logo, address) and the payment methods the invoice has:
mockfor sandbox tenants; for live tenants a hosted checkout of the routed provider, or payment instructions of a manual provider such as a bank transfer. - The state shown is
open,processing,failed,paidorvoid. Whileprocessing, the page shows a "Check again" link.
POST /v1/customers/{external_id}/portal-links makes the customer's page (/c/{token}, 30 days by default): their invoices, payments (charge or refund, status, date, amount, provider), PDFs, printable receipts and a pay button on open invoices. It is read-only and scoped to that customer. DELETE /v1/customers/{external_id}/portal-links revokes. GET /v1/customers/{external_id}/payments lists the same rows for you.
Only the provider's confirmed notification marks an invoice paid. The browser's return from a checkout shows the state and settles nothing. Wait for invoice.paid before you fulfil an order.
- A link-collected invoice waits for the customer: no stored method is charged, a decline is the customer's to retry, and there is no dunning.
- An invoice in dunning can be paid through its link too; invoices the dunning gave up on cannot.
- The public pages (
/i/{token},/c/{token}) have the same headers and 60 requests a minute as the invoice page, 10 a minute for the requests that start a payment.