Webhooks
Receive signed events for payments and disputes, verify the Arbiro-Signature header, handle retries and test locally with the CLI.
Arbiro sends an HTTPS POST to your endpoint every time a payment or a dispute changes. The body is an event; its data.object is the payment or the dispute after the change.
Create an endpoint
Create it in the dashboard under Developers, or with the API. The secret (whsec_...) is returned once: store it to verify signatures.
const endpoint = await arbiro.webhookEndpoints.create({
url: "https://shop.example/webhooks/arbiro",
events: ["payment.locked", "dispute.opened", "dispute.verdict_signed", "dispute.resolved"],
});
console.log(endpoint.secret); // whsec_..., shown once
curl https://arbiro.com/v1/webhook-endpoints \
-H "Authorization: Bearer $ARBIRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://shop.example/webhooks/arbiro","events":["payment.locked","dispute.opened"]}'
Endpoints must be public https URLs. Private, loopback and cloud metadata addresses are rejected, and redirects are not followed.
Verify the signature
Every request carries Arbiro-Signature: t=<unix seconds>,v1=<hex>, where v1 is the HMAC-SHA256 of "<t>.<raw body>" with your endpoint secret. Verify it against the raw body, before parsing JSON, and reject signatures older than 5 minutes.
import { constructEvent, WebhookSignatureError } from "@arbiro/sdk/webhooks";
export async function POST(request: Request) {
const body = await request.text(); // raw body, not request.json()
try {
const event = await constructEvent(body, request.headers.get("Arbiro-Signature"), process.env.ARBIRO_WEBHOOK_SECRET!);
switch (event.type) {
case "payment.locked":
await markPaid(event.data.object.merchant_reference, event.data.object.id);
break;
case "dispute.opened":
await notifySupport(event.data.object.payment_id);
break;
}
return new Response(null, { status: 200 });
} catch (error) {
if (error instanceof WebhookSignatureError) return new Response("invalid signature", { status: 400 });
throw error;
}
}
from arbiro import WebhookSignatureError, webhooks
# Flask
@app.post("/webhooks/arbiro")
def arbiro_webhook():
try:
event = webhooks.construct_event(SECRET, request.get_data(), request.headers.get("Arbiro-Signature"))
except WebhookSignatureError:
return "invalid signature", 400
if event["type"] == "payment.locked":
mark_paid(event["data"]["object"]["merchant_reference"])
return "", 200
The repository publishes shared test vectors in apis/webhooks/signature-vectors.json, which the backend and both SDKs check, so you can test your own implementation. In Python, pip install arbiro gives you webhooks.construct_event (Python SDK).
Events
| Type | When |
|---|---|
payment.locked |
The deposit is confirmed on chain. Deliver the order. |
payment.released |
The funds went to your payout wallet. |
payment.refunded |
The buyer was refunded, fully or partly (refunded_amount). |
payment.fallback_claimable |
A transfer could not be sent and waits in the contract for its beneficiary. |
delivery.uploaded |
Delivery evidence was attached to the payment. |
dispute.opened |
The buyer opened a dispute. Prepare your evidence. |
dispute.verdict_proposed |
Arbiro proposed a verdict; the appeal window starts. |
dispute.appealed |
A party appealed; a human reviewer takes the case. |
dispute.verdict_signed |
The verdict is signed (verdict); either party can execute it on chain. |
dispute.resolved |
The dispute is settled on chain (resolved_tx_hash). |
payout.swept |
A payout was swept to your wallet. |
The full schema is in apis/webhooks/events.schema.json. Amounts are strings of atomic units.
Retries and ordering
- Answer with any
2xxwithin 10 seconds. Anything else is retried with exponential backoff, up to 8 attempts. - Deliveries can arrive more than once and out of order. Use the event
idto deduplicate and the objectstatusas the source of truth. - Dashboard, Developers, Events shows every event with its JSON and every delivery attempt, with a Resend button. The same from the API:
GET /v1/events/{event_id}/deliveriesandPOST /v1/events/{event_id}/resend(at most one resend per event, endpoint and minute).
Test locally
The CLI follows your account's events and forwards them to localhost, signed with a session secret, without exposing a public URL:
npx @arbiro/cli listen --forward-to http://localhost:3000/webhooks/arbiro
# in another terminal
npx @arbiro/cli trigger dispute.opened
Updated