استلام المدفوعات عبر الإنترنت

من أول دفعة تجريبية إلى عملية دفع فعلية بالبطاقة مع 3-D Secure الإلزامية.

غير متاح بعد — النطاق api.baynoy.com لا يُترجَم، لذا لن تعمل الأمثلة أدناه اليوم. إنها تصف العقد الذي نبنيه، وقد تتغيّر البنى المذكورة في هذه الصفحة.

1 — Create a link

Create a payment link with a title, an amount in minor units and an asset key. The response gives you the slug of a hosted payment page.

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}`);

2 — Let the customer pay

Card fields are hosted by the card processor; 3-D Secure runs on every card payment typed in by hand. Apple Pay and Google Pay appear on the hosted page where the device supports them: the wallet authenticates the payer instead of 3-D Secure, and the payment is a card payment in every other respect (same price, same webhooks). Subscription sign-up takes cards only.

3 — Trust the webhook, not the redirect

The redirect tells the customer what happened; the signed webhook tells your system. Fulfil on payment.captured only.