Швидкий старт

Від тестового ключа до отриманої події 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
# 1. create a payment link
curl https://api.baynoy.com/v1/payment_links \\
  -H "Authorization: Bearer bk_test_..." \\
  -H "Idempotency-Key: $(uuidgen)" \\
  -d amount=4900 -d currency=EUR -d title="First sale"

The two rules that save you a rewrite

Amounts are integers in the currency's smallest unit with an explicit currency — 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.

Node
import Baynoy from "@baynoy/sdk";
const baynoy = new Baynoy(process.env.BAYNOY_SECRET_KEY);

// 1. create a link and share the URL
const link = await baynoy.paymentLinks.create({
  amount: 4900,          // integer minor units
  currency: "EUR",
  title: "First sale",
});
console.log(link.url);

// 2. fulfil on the webhook, never on the redirect
app.post("/hooks/baynoy", async (req, res) => {
  const event = baynoy.webhooks.construct(req.rawBody, req.headers["baynoy-signature"]);
  if (event.type === "payment.succeeded") await fulfil(event.data.reference);
  res.sendStatus(200);
});

Then what

Hosted checkout for a full cart, the widget for an inline form, invoices for B2B terms, subscriptions for recurring — each is the same object model with a different surface. Start where your customers already are.