SDKs
Official libraries that wrap the Muamla API so you can integrate in a few lines.
TypeScript / Node
bash
npm install @muamla/sdktypescript
import { Muamla } from "@muamla/sdk";
const muamla = new Muamla(process.env.MUAMLA_SECRET_KEY!); // sk_test_… / sk_live_…
// Create an invoice + hosted payment link
const invoice = await muamla.invoices.create({
amount: 500000, // 5,000 MRU (smallest unit)
description: "Order #1024",
callback_url: "https://example.com/webhooks/muamla",
});
console.log(invoice.url); // redirect the customer hereAvailable resources
muamla.invoices—create,retrieve,listmuamla.payments—retrievemuamla.products/muamla.prices/muamla.customers—create,listmuamla.subscriptions—create,retrieve,list,byExternalUser,cancelmuamla.webhooks.verify(rawBody, signature, secret)
Verifying webhooks
typescript
const event = muamla.webhooks.verify(rawBody, signature, process.env.MUAMLA_WEBHOOK_SECRET!);
if (event.type === "invoice.verified") {
// fulfil the order
}Errors
Failed requests throw MuamlaError with status, code and message.
React, React Native and Flutter SDKs (with a ready-made payment widget) are coming next.