SDKs

Official libraries that wrap the Muamla API so you can integrate in a few lines.

TypeScript / Node

bash
npm install @muamla/sdk
typescript
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 here

Available resources

  • muamla.invoicescreate, retrieve, list
  • muamla.paymentsretrieve
  • muamla.products / muamla.prices / muamla.customerscreate, list
  • muamla.subscriptionscreate, retrieve, list, byExternalUser, cancel
  • muamla.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.