Docs → Direct integration

Direct integration

Embed payment UI in your own site or app instead of redirecting customers to the MerasPay hosted checkout. You collect customer info in your own UX, we tokenise and process using the Meras JS SDK + PaymentIntents API, built for Djibouti rails.

How it works

  1. Server — your backend calls POST /v1/payment_intents with the amount, currency, and provider. It receives a client_secret and passes only that to your browser/app.
  2. Browser — load https://js.merashub.com/v1/meras.js (or @meraspay/sdk-js from npm) and initialise with your publishable key.
  3. Collect — render an Element for the field you need (card, OTP, MSISDN). The iframe lives on js.merashub.com, so sensitive data never enters your origin.
  4. Confirm meras.confirmPayment(piId, { client_secret }) finalises the payment. The intent transitions to succeeded and a webhook fires.

Quick example

# 1) Server: create the PaymentIntent
curl -X POST https://api.merashub.com/v1/payment_intents \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50000,
    "currency": "DJF",
    "provider": "waafi",
    "customer_msisdn": "+25377xxxxxxx"
  }'
# → { "id": "pi_...", "client_secret": "pi_..._secret_...", "status": "requires_action", ... }

# 2) Browser: confirm with the client_secret
<script src="https://js.merashub.com/v1/meras.js"></script>
<script>
  const meras = MerasPay.default("pk_test_...");
  const intent = await meras.confirmPayment("pi_...", {
    client_secret: "pi_..._secret_...",
    otp: "123456",
  });
  if (intent.status === "succeeded") alert("paid");
</script>

Per-provider guides

Waafipay

Mobile money + Visa/Mastercard (cards via the hosted page). Djibouti.

CAC International Bank

Bank account / card — corporate + retail. Bank-side authentication redirect.

SabaPay

PayMe + Fund Transfer (Saba African Bank). USSD PIN push.

D-Money

Djibouti Telecom mobile money — RSA-PSS signed requests handled server-side.

East Africa Bank

Bank rail — account number debit + authentication redirect.

Card (Visa / Mastercard)

Visa/Mastercard via the Waafi hosted page (redirect). Cybersource CNP as the international alternate.

SantimPay

Ethiopia (ETB) — Telebirr, CBE & more via hosted redirect or direct charge. Also B2C payout.

Publishable vs secret keys

Server-side calls use sk_live_… or sk_test_… — these have full scope and must stay on your backend. Browser-side calls use pk_live_… / pk_test_…, which are safe to embed: they can only confirm a PaymentIntent the bearer also holds a matching client_secret for, and create PaymentMethods. They cannot read merchant data, refund, list, or initiate charges on their own.

Back to docs home