Getting started

Quickstart

Muamla lets you accept payments from every Mauritanian bank wallet — Bankily, Sedad, Masrivi, BimBank, Click and BCI Pay — through a single integration. This guide walks you through your first payment in five steps.

How a payment works

Muamla is invoice-based. You create an invoice, the customer pays it from their bank wallet using a payment reference, and Muamla verifies the transfer directly with the bank before marking it as paid.

  1. Your backend creates an invoice for an amount in MRU.
  2. The customer opens a hosted checkout page (or a payment link you share).
  3. The customer transfers the amount from their wallet and submits the receipt reference.
  4. Muamla verifies the transfer with the bank — the payment becomes verified.
  5. A signed webhook is delivered to your server.

1. Get your API keys

From your dashboard, copy your test keys. Every account has a publishable key (pk_test_…) for client-side use and a secret key (sk_test_…) for your backend.

2. Create an invoice

Call the API from your backend with your secret key. Amounts are in the smallest MRU unit.

bash
curl https://app.muamla.org/v1/invoices \
  -u sk_test_your_key: \
  -d "amount=500000" \
  -d "currency=MRU" \
  -d "description=Order #1024" \
  -d "callback_url=https://example.com/webhooks/muamla"

The response contains a hosted checkout url and the invoice id:

json
{
  "id": "inv_8x2K9aFqR3mB7nZ1",
  "status": "initiated",
  "amount": 500000,
  "currency": "MRU",
  "amount_format": "5,000 MRU",
  "url": "https://app.muamla.org/pay/inv_8x2K9aFqR3mB7nZ1",
  "created_at": "2026-06-29T19:00:00.000Z"
}

3. Send the customer to checkout

Redirect the customer to the invoice url, or share it as a payment link over WhatsApp. They pick their bank, transfer the amount, and submit the receipt reference.

4. Verify with the bank

Muamla verifies the transfer with the bank automatically. You never have to trust a self-reported payment — the status only becomes verified once the bank confirms it.

5. Handle the webhook

Muamla delivers a signed event to your callback_url when the invoice is verified. Verify the HMAC signature with your MUAMLA_WEBHOOK_SECRET (full details on the Webhooks page).

typescript
import crypto from "node:crypto";

export async function POST(req: Request) {
  const raw = await req.text();
  const expected = crypto
    .createHmac("sha256", process.env.MUAMLA_WEBHOOK_SECRET!)
    .update(raw)
    .digest("hex");
  if (req.headers.get("x-muamla-signature") !== expected) {
    return new Response("invalid signature", { status: 400 });
  }

  const event = JSON.parse(raw);
  if (event.type === "invoice.verified") {
    // fulfil the order for event.data.id
  }
  return new Response("ok");
}
Use test phone numbers in the sandbox to simulate successful and failed payments without moving real money.