Webhooks
Payezy POSTs a signed JSON event to your HTTPS endpoint when payments, withdrawals, verification or platform customers change.
Register an endpoint
POSTRegister a webhook endpoint with a public https:// URL and the events you want. The response carries the signing_secret once. Private, loopback and link-local addresses (including 169.254.169.254) are rejected; Payezy resolves the host before it connects.
Events are delivered to endpoints on the organization the event is about. A platform receives platform_customer.updated on its own endpoints; a customer's payment and verification events go to endpoints on the customer's organization. See reconcile across customers.
Events
payment.updated
A payment or deposit changed status. Every status transition of a payment to a recipient or an incoming deposit.
idstring | The payment id. Fetch it with getPayment for full details. |
statusstring | One of |
kindstring | One of |
purposestring | One of |
amountstring | Decimal string in the asset's units. |
{
"id": "7c1e9a52-4b0d-4f6e-9a31-2d5c8e7f0b14",
"status": "completed",
"kind": "fiat_payout",
"purpose": "payment",
"amount": "250.00"
}withdrawal.updated
A withdrawal to one of your own accounts changed status. Every status transition of a withdrawal.
idstring | |
statusstring | One of |
kindstring | One of |
purposestring | One of |
amountstring |
{
"id": "a4d2f7b9-1c3e-4a58-8f20-6b9e3d1c7a05",
"status": "processing",
"kind": "fiat_payout",
"purpose": "withdrawal",
"amount": "1200.00"
}onboarding.updated
The organization's verification changed. When verification is approved and the accounts are open.
statusstring | More statuses may be added; ignore ones you do not handle. One of |
{
"status": "approved"
}platform_customer.updated
A linked customer's status changed. Sent to the platform when a customer is created, activated, restricted or reinstated.
org_idstring | The customer organization. |
statusstring | One of |
{
"org_id": "5b8e2c41-9d7a-4f03-b6e1-0c2a9f4d8e37",
"status": "active"
}Verify every delivery
Each delivery has these headers:
| Header | Value |
|---|---|
Payezy-Event |
The event type |
Payezy-Signature |
t=<unix seconds>,v1=<hex HMAC-SHA256> |
Content-Type |
application/json |
The signed string is <t>.<raw body>. Compute the HMAC with your signing secret over the raw bytes, before any JSON parsing, and compare in constant time. Reject timestamps older than five minutes. During the 24 hours after you rotate the secret, the header has two v1 values; accept either.
import crypto from "node:crypto";
export function verify(rawBody, header, secret, toleranceSeconds = 300) {
const parts = header.split(",").map((p) => p.split("="));
const t = Number(parts.find(([k]) => k === "t")?.[1]);
const sigs = parts.filter(([k]) => k === "v1").map(([, v]) => v);
if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
return sigs.some((s) => s.length === expected.length && crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected)));
}import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
parts = [p.split("=", 1) for p in header.split(",")]
t = int(next((v for k, v in parts if k == "t"), "0"))
sigs = [v for k, v in parts if k == "v1"]
if not t or abs(time.time() - t) > tolerance:
return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return any(hmac.compare_digest(s, expected) for s in sigs)Retries and replay
Answer with any 2xx within a few seconds and do the work afterwards. Failed deliveries retry with backoff and the endpoint is marked failing after repeated errors. GETList deliveries shows attempts; POSTReplay a delivery queues one again.
Events can arrive more than once and out of order. Treat them as signals: use the id to fetch the current state when order matters.
Rotation
POSTRotate a signing secret mints a new secret. The previous one keeps verifying for 24 hours, so deploy the new secret within that window.