Быстрый старт
От тестового ключа до полученного события Webhooks — в порядке, который избавляет от переделок.
Ещё не запущено — домен api.baynoy.com не резолвится, поэтому примеры ниже сегодня не выполнятся. Они описывают контракт, к которому мы идём, и схемы на этой странице ещё могут измениться.
Take your first payment in four steps
Get a test key from the dashboard, create a payment link, pay it with a test card, and receive the webhook. Nothing about that flow changes when you move to live keys — only the key prefix does.
curl https://api.baynoy.com/v1/catalog/links \
-H "Authorization: Bearer bk_test_..." \
-H "Content-Type: application/json" \
-d '{"title": "Design retainer", "amountMinor": "4900", "assetKey": "fiat:EUR"}'
# -> {"id": "lnk_...", "slug": "k3x9q2"} — the page is https://baynoy.com/pay/k3x9q2The two rules that save you a rewrite
Amounts are integers in the currency's smallest unit, sent as strings, with an explicit asset key such as fiat:EUR — never floats. And you fulfil on the signed webhook, not on the browser redirect: the redirect tells the customer what happened, the webhook tells your system.
import { createHmac, timingSafeEqual } from "node:crypto";
// Fulfil on the webhook, never on the redirect.
// Header: Baynoy-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">
app.post("/hooks/baynoy", express.raw({ type: "application/json" }), (req, res) => {
const parts = Object.fromEntries(req.get("baynoy-signature").split(",").map((p) => p.split("=")));
const expected = createHmac("sha256", process.env.BAYNOY_WEBHOOK_SECRET)
.update(`${parts.t}.${req.body}`).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
if (!fresh || !timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ""))) return res.sendStatus(400);
const event = JSON.parse(req.body);
if (event.type === "payment.captured") fulfil(event.data);
res.sendStatus(200);
});Then what
The widget for an inline form, QR codes for a counter, invoices for B2B terms — each is the same payment underneath, on a different surface. Subscriptions are coming later; they are not in the API today.