코드 샘플

가장 흔한 흐름을 위한 복사-붙여넣기 예제 — cURL, Node, Python으로 제공.

아직 사용할 수 없습니다 — api.baynoy.com 도메인이 조회되지 않으므로 아래 예제는 지금 실행되지 않습니다. 저희가 만들어 가는 계약을 설명한 것이며, 이 페이지의 형식은 아직 바뀔 수 있습니다.

Create a payment link

The same call in three shapes — plain HTTPS, no library.

cURL
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/k3x9q2
Node
// Node 18+, no package needed
const res = await fetch("https://api.baynoy.com/v1/catalog/links", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.BAYNOY_SECRET_KEY}`,
    "content-type": "application/json",
  },
  // amounts are strings of integer minor units — never floats
  body: JSON.stringify({ title: "Design retainer", amountMinor: "4900", assetKey: "fiat:EUR" }),
});
const { slug } = await res.json();
console.log(`https://baynoy.com/pay/${slug}`);
Python
import os, requests

r = requests.post(
    "https://api.baynoy.com/v1/catalog/links",
    headers={"Authorization": f"Bearer {os.environ['BAYNOY_SECRET_KEY']}"},
    json={"title": "Design retainer", "amountMinor": "4900", "assetKey": "fiat:EUR"},
)
print("https://baynoy.com/pay/" + r.json()["slug"])