Documentation Index
Fetch the complete documentation index at: https://docs.mpesaflow.com/llms.txt
Use this file to discover all available pages before exploring further.
The @mpesaflow/sdk is a type-safe Typescript SDK that allows you to access the resources and methods of the MpesaFlow REST API.
Install
Get the MpesaFlow Typescript SDK.npm install @mpesaflow/sdk
Add Authentcation
Add your MpesaFlow API Key into the SDK. Your can get or create an API Key through the MpesaFlow Dashboard.import { MpesaFlow } from "@mpesaflow/sdk";
const mpesaFlow = new MpesaFlow({
token: "MPESAFLOW_API_KEY",
});
Send your first payment
Send your first payment with the MpesaFlow SDK.import { MpesaFlow } from "@mpesaflow/sdk";
const mpesaFlow = new MpesaFlow({
token: "MPESAFLOW_API_KEY",
});
async function run() {
const result = await mpesaFlow.express.pay({
phoneNumber: "254712345678",
amount: "100.00",
transactionDesc: "mpesaflow",
customerName: "John Doe",
accountReference: "mpesaflow",
});
console.log(result);
}
run();
Examples
Learn how to use MpesaFlow SDK through the following categories of examples: