Biya MerchantDevelopers

Integration guide

Pay with BiyaBot

Put a Biya pay button on your website or app. Your customer approves the payment in their Biya chat, the money lands in your Biya Merchant wallet, and your server gets a signed webhook. This guide is for the developer who connects it.

Sign up as a merchant

3% per approved payment. No monthly fee to collect.

Checked against the live code on 26 November 2026.

On this page
  1. How it works, in one paragraph
  2. What you need before you start
  3. Base URL
  4. Authentication
  5. Create a payment request
  6. What the customer sees
  7. Payment status (public, optional)
  8. Webhooks
  9. Checklist

How it works, in one paragraph

Your server asks Biya to charge a customer by their Biya email or handle. Biya sends that customer an approval card inside their Biya chat (Telegram, Messenger, Slack or web chat). The customer taps Yes, and the money moves from their Biya wallet to your Biya Merchant wallet. Biya then POSTs a signed webhook to your server saying payment.success, payment.declined or payment.expired.

The signed webhook is the only proof of payment.

What you need before you start

  1. A Biya Merchant account that is approved (KYC passed) at https://merchant.biya.com.ng. An unapproved account is refused with HTTP 403.
  2. API keys, made by the account Owner or an Admin in Settings → API Integration. Three values, each shown once: Client ID (biya_live_...), Client Secret (sk_live_...), Webhook Secret (whsec_...). Store all three as server secrets. Generating keys again replaces all three.
  3. A Webhook URL: a public https:// endpoint on your server. Required: without it Biya refuses to create payment requests (HTTP 422 WEBHOOK_URL_REQUIRED), because the webhook is the only way you learn the outcome.
  4. The integration switched on (Enabled) in the same settings screen.
  5. Optional: an IP allowlist of your server addresses.

The customer must already be a Biya user with a Biya wallet. If they are not, the request is refused (see errors), so offer another payment method next to Pay with BiyaBot.

Base URL

https://merchant.biyabot.com.ng/api/v1

Authentication

Send both headers on every call, from your server only. Never put the Client Secret in a browser or app.

Header Value
x-client-id Client ID (biya_live_...)
x-client-secret Client Secret (sk_live_...)
HTTP Body Meaning
401 { "error": "Missing API credentials" } A header is missing
401 { "error": "Invalid API credentials" } Unknown Client ID or wrong secret (same answer for both)
401 { "error": "API integration is disabled" } Switch the integration on
403 { "error": "..." } Merchant account not approved, or your IP is not on a non-empty allowlist

IP allowlist: empty means any address is allowed. Once you add addresses, only exact matches are allowed, everything else gets 403.


Create a payment request

POST /gateway/payment-requests (JSON)

Body

Field Type Required Rules
amount number, or numeric string Yes Naira, greater than 0 (e.g. 5000 = ₦5,000). Rounded to the nearest kobo; must be at least ₦0.01.
customerEmail string Yes The customer's Biya email or Biya handle (3-15 letters, numbers or underscores; a leading @ is fine). Up to 254 characters.
customerName string No Up to 200 characters. Stored for support.
customerPhone string No Up to 32 characters. Stored for support.
redirectUrl string No Where Biya's payment page sends the customer back to. Any http(s) URL is accepted, but it is only used when it is https://, at most 2,048 characters, with no username, password, spaces or control characters. Otherwise it is ignored (the payment is still created).
description string No Up to 500 characters. Accepted and ignored.

Any other field is refused with HTTP 400. That includes merchantId: the payee is always the account that owns the API keys.

Example

curl -X POST https://merchant.biyabot.com.ng/api/v1/gateway/payment-requests \
  -H "Content-Type: application/json" \
  -H "x-client-id: $BIYA_CLIENT_ID" \
  -H "x-client-secret: $BIYA_CLIENT_SECRET" \
  -d '{
    "amount": 25000,
    "customerEmail": "@tolu",
    "customerName": "Tolu Ade",
    "redirectUrl": "https://shop.example.com/orders/ORD-1042"
  }'

Success (HTTP 201)

{
  "status": "success",
  "message": "Payment request created successfully",
  "data": {
    "reference": "aB3dE5gH7jK9mN1pQ3sT5",
    "paymentUrl": "https://merchant.biya.com.ng/pay/aB3dE5gH7jK9mN1pQ3sT5",
    "amount": 2500000,
    "currency": "NGN"
  }
}
  • reference is a 21-character code of letters and numbers. Save it on your order before showing the customer anything; every webhook carries it.
  • amount here and in every webhook is kobo (₦1 = 100 kobo). You send naira; Biya answers in kobo.
  • paymentUrl is Biya's hosted page. Optional to use. It tells the customer to approve in their Biya chat, shows the live status, and once the payment is final offers a "Back to" link to your stored redirectUrl. The customer arriving back on your site proves nothing. Only a verified payment.success webhook does.

Errors

Errors are { "error": "<message>" } unless shown otherwise.

HTTP Message or body Meaning What to do
400 Amount must be a number greater than 0, customerEmail must be a valid email address or Biya handle, or a field rule above Bad body, or a field that is not allowed Fix the request
400 contains Customer with Id: ... not found No Biya user has that email or handle Offer another payment method
400 contains Virtual account for user: ... not found The user has no Biya wallet yet They must finish Biya sign-up
400 contains unreachable on chat Their chat session is stale Ask them to open their Biya chat and send any message, then retry
422 { "status": "error", "code": "WEBHOOK_URL_REQUIRED", "message": "..." } No Webhook URL saved Set it in Settings → API Integration
429 { "status": "error", "code": "RATE_LIMITED", "message": "..." } plus Retry-After Over 120 requests a minute from one address Wait Retry-After seconds

On any 400 no card was sent and nothing is owed. Do not retry the same order blindly on a timeout: check for a webhook first, or create a fresh request and ignore the old reference.


What the customer sees

  1. An approval card in their Biya chat: your business name and the amount.
  2. They tap it and confirm the debit (Yes or Cancel).
  3. If their Biya wallet is short, BiyaBot tells them to top up. No webhook is sent at that moment; if no approval follows, the request expires and you get payment.expired.
  4. A request is approvable for about 10 minutes. A request nobody answers is closed about 11 minutes after creation and you get payment.expired.

Payment status (public, optional)

GET /public/payment-requests/{reference}/status (no headers, rate limited, never cached)

{
  "status": "success",
  "data": {
    "orderId": "aB3dE5gH7jK9mN1pQ3sT5",
    "merchantName": "Your Business",
    "amountKobo": 2500000,
    "currency": "NGN",
    "state": "pending",
    "createdAt": "2026-11-26T10:00:00.000Z",
    "expiresAt": null,
    "returnUrl": "https://shop.example.com/orders/ORD-1042"
  }
}

state is pending, paid, declined, expired or failed (failed means paid and then fully refunded). expiresAt is always null. Unknown reference: 404 { "status": "error", "message": "not_found" }. This exists for Biya's payment page and for a "still waiting" screen. Do not mark orders paid from it; use the webhook.


Webhooks

Biya POSTs to your Webhook URL when a request ends.

Headers

Header Value
Content-Type application/json
x-biya-signature HMAC-SHA512, hex, of the raw body bytes, keyed with your Webhook Secret (whsec_...). Not the Client Secret.
x-biya-event Same as event in the body
x-biya-delivery-id Stable id for this delivery; the same on every retry
x-biya-delivery-attempt 1 for the first attempt, then 2, 3...

Events

event data.status Meaning
payment.success APPROVED Customer approved; money is in your Biya Merchant wallet
payment.declined DECLINED Customer declined or cancelled in chat
payment.expired EXPIRED Not approved in time

Two things send no webhook: a refund, and a request you cancel yourself from the merchant dashboard (the status read then shows declined). Update your order yourself when you do either.

Body

{
  "event": "payment.success",
  "data": {
    "reference": "aB3dE5gH7jK9mN1pQ3sT5",
    "amount": 2500000,
    "currency": "NGN",
    "orderId": "aB3dE5gH7jK9mN1pQ3sT5",
    "customerId": "tolu",
    "status": "APPROVED",
    "transactionDate": "2026-11-26T10:03:12.000Z"
  },
  "timestamp": "2026-11-26T10:03:12.400Z"
}
  • amount is kobo. reference and orderId are the same value; match on reference.
  • customerId is the email or handle as Biya stored it (a handle is lowercased, @ removed).
  • payment.declined and payment.expired also carry reason (e.g. "User declined via chat", "User selected No/Cancel", "Transaction timeout").

Delivery and retries

  • Answer any 2xx within 10 seconds. Anything else, or a timeout, counts as failed.
  • Failed deliveries are retried up to 10 attempts in total, waiting about 1, 2, 4, 8, 16, 32 minutes and then hourly, so roughly 4 hours in all. The body bytes are identical on every attempt.
  • If you switch the integration off or remove the URL, pending retries stop.

Rules your receiver must follow

  1. Verify the signature on the raw bytes before parsing. Re-serialising parsed JSON can change the bytes and break the match. Use a constant-time compare. Reject a missing or wrong signature with 401.
  2. Check the amount. data.amount (kobo) must equal your order total × 100, and data.reference must be a reference you saved.
  3. Be idempotent. The same event can arrive more than once. Key on x-biya-delivery-id, or on reference + event.
  4. payment.success always wins. In a rare timing case you can get payment.expired and then payment.success for the same reference; the customer did pay. Mark the order paid, and never let a later declined or expired undo a success.
  5. Answer fast and do slow work (emails, stock) afterwards.
// Express: verify on the raw body
const crypto = require('crypto');
app.post('/webhooks/biya', express.raw({ type: 'application/json' }), (req, res) => {
  const got = String(req.headers['x-biya-signature'] || '');
  const want = crypto.createHmac('sha512', process.env.BIYA_WEBHOOK_SECRET)
    .update(req.body)            // the raw Buffer
    .digest('hex');
  const ok = got.length === want.length &&
    crypto.timingSafeEqual(Buffer.from(got), Buffer.from(want));
  if (!ok) return res.status(401).end();
  const payload = JSON.parse(req.body.toString('utf8'));
  // look up order by payload.data.reference, check amount, apply idempotently
  res.status(200).end();
});

For Next.js route handlers: read await request.text() once, verify that string, then JSON.parse it.


Checklist

  1. Approved Biya Merchant account.
  2. Keys generated; Client ID, Client Secret and Webhook Secret saved as server secrets.
  3. Webhook URL (https) saved and integration Enabled.
  4. Create requests from your server; save reference on the order.
  5. Webhook receiver verifies the signature on raw bytes, checks the amount, is idempotent, lets success win.
  6. A "waiting for approval" screen (poll the status read or your own order) with a ~11-minute backstop.
  7. Another payment method for customers who are not on Biya.
  8. Optional: IP allowlist.

Need help?

Questions about your integration or your merchant account? Email hello@biya.com.ng.