Skip to content

Integrations

Official SDKs

Server SDKs for Node.js, Python and PHP: install, first call, downloads with SHA-256 checksums, and webhook verification.

What the SDKs do

The SDKs wrap the Moolre API for server code. They send credentials in headers only, use channel names, attach Idempotency-Key to retries, read meta.requestid and meta.notices, raise typed errors, walk cursors for you and verify webhook signatures. Keep API keys on your server: never ship them to a browser or mobile app.

Each SDK is a thin client over the same HTTP API documented here. Anything the SDK does you can do with plain HTTP.

Install

The Node.js SDK is on npm, the Python SDK is on PyPI and the PHP SDK is on Packagist: install them with your package manager. Each SDK is also published as a single file you can copy into your project.

For the browser checkout (not a server SDK), use the @moolre/moolrejs package from npm, described on the JavaScript Inline page.

# Node 18+, ESM and CommonJS, TypeScript types included, no runtime dependenciesnpm install @moolre/sdk​import { Moolre } from '@moolre/sdk';const moolre = new Moolre({  environment: 'sandbox',  user: process.env.MOOLRE_USER,  apiKey: process.env.MOOLRE_API_KEY,  pubKey: process.env.MOOLRE_PUBKEY,  accountNumber: '1000000000001',});

Step by step: your first SDK call

  1. Install the SDK: npm install @moolre/sdk (Node.js), pip install moolre (Python) or composer require moolre/moolre-php (PHP).
  2. Create the client with environment "sandbox", your username, the keys you have and a default account number. Keep every credential in environment variables.
  3. Make a collection to the test number 0240000111 with an idempotency key. The result object carries ok, code, message, data, requestId, notices and replayed (read from meta.requestid, meta.notices and meta.replayed).
  4. If result.otpRequired is true (code TP14), call verifyOtp with 123456 and call initiate once more when it reports TP17.
  5. Catch the typed error for status 0 (ApiError and its subclasses) and read code, apiMessage, fields and requestId.
  6. Set strictHttpStatus if you want real HTTP status codes, and keep maxRetries low: the SDK retries network errors and 5xx only for reads and for calls that carry an idempotency key.
  7. Switch environment to "live" and the credentials to live ones when you go live.

Versions and the API change of 25 November 2026

Bulk payout status and list now return hooks, page and pages, and webhooks have their own layout. Node.js 0.2.0, Python 0.2.0 and PHP 1.2.0 follow both. Update to them: in older versions iterateItems and iterateBatches find nothing, page cannot be sent, and event and eventId are empty for a webhook.

SDKPublishedBulk payoutsWebhooks
Node.js0.2.0 (npm)bulk.status and bulk.list take page; bulk.iterateHooks and bulk.iterateBatches read every pageevent.kind, event.page, event.pages, event.hooks and eventTransactions(event); accounts.updateWebhooks switches webhooks on
Python0.2.0 (PyPI)bulk.status and bulk.list take page; bulk.iterate_hooks and bulk.iterate_batches read every pageevent.kind, event.page, event.pages, event.hooks and event.transactions(); accounts.update_webhooks switches webhooks on
PHP1.2.0 (Packagist)bulk->status and bulk->list take page; bulk->iterateHooks and bulk->iterateBatches read every page$event->kind, $event->page, $event->pages, $event->hooks and $event->transactions(); accounts->updateWebhooks switches webhooks on

Downloads and checksums

Node.js (npm), Python (PyPI), PHP (Packagist) and the moolrejs browser checkout (npm) install from your package manager. Every SDK can also be downloaded from docs.moolre.com and checked against the published SHA-256 checksum. The same list is published as one file: SHA256SUMS.

Verify a download before you use it: on Linux or macOS run sha256sum -c SHA256SUMS in the folder that holds the files (shasum -a 256 on macOS), on Windows run Get-FileHash -Algorithm SHA256 <file>.

SDKVersionInstall commandDownloadSHA-256
Node.js package0.2.1npm install @moolre/sdk (npm), or npm install ./moolre-sdk-0.2.1.tgzmoolre-sdk-0.2.1.tgze73d0592a388394aa095e89cf994afc332b6ca8cbd67e6f7887a8e0edea38980
Node.js single file (ESM)0.2.1import from ./moolre.bundle.mjsmoolre.bundle.mjs02308d9360827afe6fe2a408b8cb75f044a3a59ff338adfa188770ee57557369
Python wheel0.2.1pip install moolre (PyPI), or pip install ./moolre-0.2.1-py3-none-any.whlmoolre-0.2.1-py3-none-any.whlc46d7a1a3f05d6b4cde99eed8d468a967d630ff061b01d94a21f368025e4ebfe
Python source0.2.1pip install ./moolre-0.2.1.tar.gzmoolre-0.2.1.tar.gz7f2127622daea0d099bd8653ac5bb9617347aeea57d99e6eb0ab7728e42abb0d
Python single file0.2.1copy moolre.py next to your codemoolre.py577b2e55982ed633590210880d484f350f78f5acb4088a2c08afb8cbebdddf38
PHP package1.2.1composer require moolre/moolre-php (Packagist), or unzipmoolre-php-1.2.1.zip7eaf29695a56a07762f5416dbb5dc95066cde2b62a29a2afc69323e5e2c482f7
PHP single file1.2.1require moolre-sdk.phpmoolre-sdk.php2005e730adfb2b1473a1eb4b3f624d1aa7638a81660e2883cc985d57a83bd26b
Browser checkout (moolrejs)1.1.1npm install @moolre/moolrejs (npm)moolre-moolrejs-1.1.1.tgz38017f1a640ddf4a38322b7bb57427d8d9f45a8258e3d09e98a51e2d82651872
Webhook test vectors2JSON test cases for your own verifierwebhook.json4affe004dc79a239aa0a3c90e495e6131dd75d120b64ae064e47bdec9281bf1e

Verify webhooks with an SDK

Every SDK has a constant-time verifier that checks the signature and the timestamp tolerance, and a helper that returns the parsed event. The same helper serves callbacks and webhooks. A callback has event and event_id at the top level and one transaction in data; a webhook has them inside data and lists its transactions in data.hooks. The SDKs read both for you: event.kind is callback or webhook, and one handler serves both.

import { constructEvent, eventTransactions, WebhookSignatureError } from '@moolre/sdk';​app.post('/moolre/webhook', express.raw({ type: '*/*' }), (req, res) => {  try {    const event = constructEvent(req.body, req.header('X-Moolre-Signature'), process.env.MOOLRE_WALLET_SECRET);    // dedupe on event.eventId, then act once per transaction (callbacks and webhooks)    for (const tx of eventTransactions(event)) queueWork(event.event, tx);   // your own queue    res.sendStatus(200);  } catch (e) {    if (e instanceof WebhookSignatureError) return res.sendStatus(400);    throw e;  }});

Hosted checkout PHP package

The moolre/moolre-php package also contains the hosted checkout client described on the PHP SDK page. It is unchanged.

What each SDK covers

AreaMethods
Collectionspayments.initiate, payments.verifyOtp
Payoutstransfers.validateName, transfers.create, transfers.status
Bulk payoutsbulk.create, bulk.status, bulk.list, bulk.iterateHooks, bulk.iterateBatches (Python: iterate_hooks, iterate_batches)
Invoicesinvoices.create, invoices.status, invoices.cancel, invoices.iterate
Accountsaccounts.iterateTransactions, accounts.updateWebhooks (Python: iterate_transactions, update_webhooks)
Salessales.airtime
Messagingsms.send, whatsapp.send, whatsapp.iterateTemplates
Webhooks and callbackswebhooks.test, webhooks.resend, webhooks.iterateDeliveries, constructEvent, verifyWebhook, eventTransactions (Python and PHP: event.transactions())
Payment linkspaymentLinks.create
  • Credentials come from environment variables and stay on the server.
  • Retries use an idempotency key.
  • You log requestId and notices.
  • Webhooks and callbacks are verified with constructEvent on the raw body.