Logo Lanfrica

madegwa-kidii/paysuitjs

Domaine:

socioeconomic

Type de record:

software
Créateur:
mad
Hôte:
This is the mpesa malipo library for javascript and typscript and supports all js frameworks # malipojsts-mpesa A modern TypeScript/JavaScript library for M-Pesa payment integrations with real-time payment updates via WebSocket. ## Features ✨ **Modern & Type-Safe** - Built with TypeScript, fully typed 🚀 **Easy to Use** - Simple, intuitive API 🔄 **Real-time Updates** - WebSocket support for instant payment confirmations 📱 **Phone Validation** - Automatic phone number normalization and validation ⚡ **Framework Agnostic** - Works with React, Vue, Node.js, and more 🌐 **Universal** - Works in both browser and Node.js environments 🛡️ **Error Handling** - Comprehensive error handling and timeout support 🔌 **Auto-reconnect** - Automatic WebSocket reconnection ## Installation ```bash npm install malipojsts-mpesa ``` or ```bash yarn add malipojsts-mpesa ``` or ```bash pnpm add malipojsts-mpesa ``` ## Quick Start ```typescript import { createMpesaClient } from 'malipojsts-mpesa'; // Initialize the client const mpesa = createMpesaClient({ baseUrl: '127.0.0.1', apiKey: 'your-api-key', timeout: 30000 // optional }); // Initiate an STK Push payment const response = await mpesa.stkPush({ senderPhoneNumber: '0712345678', amount: '100', transactionDescription: 'Payment for goods' }); console.log('Payment initiated:', response.CheckoutRequestID); ``` ## API Reference ### Client Initialization #### `createMpesaClient(config: MpesaClientConfig): MpesaClient` Creates a new M-Pesa client instance. **Parameters:** - `baseUrl` (string, required): Your FastAPI backend URL - `apiKey` (string, required): Your API authentication key - `timeout` (number, optional): Request timeout in milliseconds (default: 30000) ```typescript const mpesa = createMpesaClient({ baseUrl: '127.0.0.1', apiKey: 'merchant_123', timeout: 30000 }); ``` ### STK Push Payment #### `stkPush(request: StkPushRequest): Promise ` Initiates an STK Push payment request. **Parameters:** …

Languages