Integrate Zetra into your payment flow.
Send Zetra an invoice or order from your backend. When a supported stablecoin reaches your configured wallet, Zetra matches it and sends your system a signed financial event.
Create payment requestPOST /v1/invoices
Customer payshosted NEAR page or manual transfer
Zetra monitors NEARfinalized transfer
Zetra matches paymentmatch-v1.1
payment.matchedsigned webhook
// 1. Send Zetra the order (safe to repeat: same ID, same result)
const res = await fetch("https://api.example.com/api/v1/orders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ZETRA_API_KEY}`,
"Idempotency-Key": `order-${order.id}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
external_id: order.id,
amount: "2000.00", // decimal strings, never floats
customer: { external_ref: order.customerId, email: order.email },
}),
});
const { invoice } = await res.json();
redirect(invoice.payment_url); // or let them pay your wallet directly
// 2. React when it's paid (verifyZetraWebhook: 10 lines, in the webhooks docs)
app.post("/webhooks/zetra", express.raw({ type: "application/json" }), (req, res) => {
if (!verifyZetraWebhook(process.env.ZETRA_WEBHOOK_SECRET, req.body.toString(),
req.get("x-zetra-timestamp"), req.get("x-zetra-signature")))
return res.sendStatus(400);
const event = JSON.parse(req.body);
if (event.type === "payment.matched") fulfil(event.data.invoice.external_id);
res.sendStatus(200);
});Versioned REST API
Cursor pagination, filtering, sorting, request IDs, consistent errors and OpenAPI 3.1.
Idempotency keys
Retry any create safely. Same key and body replays the original response; a different body is rejected.
Financial events
PAYMENT_OBSERVED, PAYMENT_MATCHED, PARTIALLY_PAID, OVERPAID, UNKNOWN_PAYMENT, PAYMENT_REVERSED, each with evidence and a rule version.
Signed webhooks
HMAC-SHA256 over timestamp and body, retries with backoff, every attempt stored, one-click replay, zero-downtime secret rotation.
NEAR transfer memos
Each hosted payment request provides a memo that safely identifies its invoice without deploying a payment contract.
Test mode
sk_test_ keys use enabled test networks. Simulations exercise matching, exceptions, events and webhooks without moving funds.
