Accept payments
Embedded checkout — shoppers never leave your site
Offer “Buy Now Pay Later with AltBank” on any website. The Bank-hosted checkout opens in a secure panel on your own payment page and closes back to it — no redirect.
How it works#
- 1Shopper picks Buy Now Pay Later with AltBank on Your website’s payment screen.
- 2Your website’s server creates a checkout session with its secret key.
- 3The Bank’s secure checkout opens in a panel on Your website’s page — no redirect.
- 4The shopper closes the panel and is still on Your website. Your website confirms the status server-side.
Add the button#
Load the SDK from the Bank’s checkout origin, create the session on your server, then open the panel with the returned checkout_url.
<!-- 1. On your payment page -->
<script src="https://checkout.pay.araf.ng/v1/araf.js"></script>
<div id="altbank-bnpl"></div>
<script>
ArafCheckout.button('#altbank-bnpl', {
// Label: "Buy Now Pay Later with AltBank"
onClick: async () => {
// 2. Your SERVER creates the session (never put your secret key in the browser)
const res = await fetch('/checkout/araf-session', { method: 'POST' });
const { checkout_url } = await res.json();
// 3. The Bank's checkout opens in a panel on THIS page — no redirect
ArafCheckout.open({
checkoutUrl: checkout_url,
onClose: () => location.reload(), // 4. then re-read the order status from your server
});
},
});
</script># Your server (secret key stays here)
curl -X POST https://pay-with-araf.onrender.com/api/v1/checkout/sessions \
-H "Authorization: Bearer $ARAF_SECRET_KEY" \
-H "Idempotency-Key: order-<your order ref>" \
-H "Content-Type: application/json" \
-d '{ "merchant_order_reference": "<your order ref>", "currency": "NGN", "amount": 64500000,
"items": [ ... ], "customer": { "email": "..." },
"return_url": "https://your-site/orders/<ref>", "cancel_url": "https://your-site/cart" }'
# → { "checkout_url": "…/c/cs_test_…" } pass checkout_url to ArafCheckout.open()checkoutUrlstringrequired- The checkout_url from POST /checkout/sessions. Must be on the SDK’s own origin.
onClose({ reason }) => voidoptional- Panel closed: customer, escape, return, cancel, equity (customer must pay equity to you) or complete.
onComplete({ outcome, application_reference }) => voidoptional- SUBMITTED, DECLINED, CANCELLED, EXPIRED or DELIVERED. A hint for your UI only.
onEvent(event) => voidoptional- Every event, including araf:status { stage, label }.
Events#
| Event | When |
|---|---|
| araf:ready | Checkout loaded inside your page |
| araf:status | Progress changed (stage and customer-facing label, no personal or credit data) |
| araf:complete | A terminal or milestone outcome was reached |
| araf:close | The checkout asked to return the shopper to your page (reason: return, cancel, equity) |
| araf:closed | The panel closed (sent by the SDK) |
Security#
Events are hints — never proof
GET /api/v1/orders/{ref} or signed webhooks, and release goods only after goods.release_authorized.The checkout can only be framed by websites the Bank approved for your account (Content-Security-Policy frame-ancestors); any other site sees a blank frame. The iframe is sandboxed so it can never navigate or script your page, messages are only accepted from the checkout origin, and in production the customer session cookie is SameSite=None; Secure; Partitioned so it works inside your page without third-party tracking. Steps that need a provider page (Remita mandate, Mono bank connection) stay inside the panel in the sandbox; production adapters that a provider will not allow inside a frame open in a pop-up and return to the panel.
Slow networks and refreshes#
| Situation | What happens |
|---|---|
| Shopper double-clicks or your page retries session creation | Use your order reference as the Idempotency-Key: the same session is returned, never a second application. |
| Connection drops while the customer submits a step | The checkout retries with the same idempotency key; if the first attempt succeeded the stored result is replayed, so nothing is applied twice. |
| Retries are exhausted | The checkout re-reads the authoritative state from the Bank and tells the customer whether the step went through. |
| Customer refreshes or closes the panel | Progress is saved server-side. Re-open the panel with the same checkout_url to continue; a new browser requires a one-time code. |
| Customer goes offline | An offline notice is shown; the checkout re-reads the state when the connection returns. |