Skip to main content
The @Moflay/sdk is a type-safe Typescript SDK that allows you to access the resources and methods of the Moflay REST API.
1

Install

Get the Moflay Typescript SDK.
npm install @Moflay/sdk
2

Add Authentcation

Add your Moflay API Key into the SDK. Your can get or create an API Key through the Moflay Dashboard.
server.ts
import { Moflay } from "@Moflay/sdk";

const Moflay = new Moflay({
  token: "Moflay_API_KEY",
});
3

Send your first payment

Send your first payment with the Moflay SDK.
server.ts
import { Moflay } from "@Moflay/sdk";

const Moflay = new Moflay({
  token: "Moflay_API_KEY",
});

async function run() {
  const result = await Moflay.express.pay({
    phoneNumber: "254712345678",
    amount: "100.00",
    transactionDesc: "Moflay",
    customerName: "John Doe",
    accountReference: "Moflay",
  });

  console.log(result);
}

run();

Examples

Learn how to use Moflay SDK through the following categories of examples:
I