{"id":42786726,"url":"https://github.com/matrixjnr/mpesa-node-api","last_synced_at":"2026-01-29T23:12:05.874Z","repository":{"id":52048817,"uuid":"162434416","full_name":"matrixjnr/mpesa-node-api","owner":"matrixjnr","description":"Mpesa API library implemented in Nodejs","archived":false,"fork":false,"pushed_at":"2025-09-13T15:39:43.000Z","size":427,"stargazers_count":7,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T02:51:35.353Z","etag":null,"topics":["daraja-api","mpesa","mpesa-api","mpesa-backend","mpesa-node","mpesa-sdk","safaricom"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matrixjnr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-12-19T12:29:07.000Z","updated_at":"2025-08-26T17:15:45.000Z","dependencies_parsed_at":"2025-07-15T03:19:23.806Z","dependency_job_id":"93e82581-e04b-4647-9db9-e93008cb823f","html_url":"https://github.com/matrixjnr/mpesa-node-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matrixjnr/mpesa-node-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrixjnr%2Fmpesa-node-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrixjnr%2Fmpesa-node-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrixjnr%2Fmpesa-node-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrixjnr%2Fmpesa-node-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matrixjnr","download_url":"https://codeload.github.com/matrixjnr/mpesa-node-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrixjnr%2Fmpesa-node-api/sbom","scorecard":{"id":625211,"data":{"date":"2025-08-11","repo":{"name":"github.com/matrixjnr/mpesa-node-api","commit":"b555e1444e1ceb60fa3dd5b5e91f8266e7597e9b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":6,"reason":"8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:93: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:106: update your workflow using https://app.stepsecurity.io/secureworkflow/matrixjnr/mpesa-node-api/ci.yml/master?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   3 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENCE:0","Info: FSF or OSI recognized license: MIT License: LICENCE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":10,"reason":"SAST tool detected","details":["Info: SAST configuration detected: Snyk","Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T06:12:02.081Z","repository_id":52048817,"created_at":"2025-08-21T06:12:02.081Z","updated_at":"2025-08-21T06:12:02.081Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28889865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T21:06:44.224Z","status":"ssl_error","status_checked_at":"2026-01-29T21:06:42.160Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["daraja-api","mpesa","mpesa-api","mpesa-backend","mpesa-node","mpesa-sdk","safaricom"],"created_at":"2026-01-29T23:12:05.240Z","updated_at":"2026-01-29T23:12:05.864Z","avatar_url":"https://github.com/matrixjnr.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# M-Pesa Daraja API - Node.js Library\n\n[![npm version](https://badge.fury.io/js/mpesalib.svg)](https://badge.fury.io/js/mpesalib)\n[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://github.com/matrixjnr/mpesa-node-api/workflows/CI/badge.svg)](https://github.com/matrixjnr/mpesa-node-api/actions)\n[![Known Vulnerabilities](https://snyk.io/test/github/matrixjnr/mpesa-node-api/badge.svg?targetFile=package.json)](https://snyk.io/test/github/matrixjnr/mpesa-node-api?targetFile=package.json)\n[![Coverage Status](https://coveralls.io/repos/github/matrixjnr/mpesa-node-api/badge.svg?branch=main)](https://coveralls.io/github/matrixjnr/mpesa-node-api?branch=main)\n\nA robust, modern Node.js library for integrating with Safaricom's M-Pesa Daraja API. Built with TypeScript, comprehensive error handling, and extensive testing.\n\n## Features\n\n- 🚀 **Modern TypeScript** - Full TypeScript support with comprehensive type definitions\n- 🔒 **Secure** - Built-in security credential generation and token management\n- 🛡️ **Error Handling** - Comprehensive error handling and validation\n- 📝 **Well Documented** - Extensive documentation and examples\n- 🧪 **Thoroughly Tested** - 95%+ test coverage\n- 🔄 **Retry Logic** - Built-in retry mechanism for network failures\n- 📱 **Phone Number Formatting** - Automatic phone number formatting and validation\n- 🌍 **Environment Support** - Support for both sandbox and production environments\n- 📊 **Callback Handling** - Built-in utilities for handling M-Pesa callbacks\n\n## Supported APIs\n\n- ✅ **STK Push** (Lipa Na M-Pesa Online)\n- ✅ **STK Push Query** (Check payment status)\n- ✅ **C2B Register URLs** (Customer to Business)\n- ✅ **C2B Simulate** (Test C2B payments)\n- ✅ **B2C Payment** (Business to Customer)\n- ✅ **B2B Payment** (Business to Business)\n- ✅ **Account Balance** (Check account balance)\n- ✅ **Transaction Status** (Query transaction status)\n- ✅ **Transaction Reversal** (Reverse transactions)\n\n## Installation\n\n```bash\nnpm install mpesalib\n```\n\n\u003e **⚠️ Upgrading from v1.x?** This is a complete rewrite with breaking changes. See the [Migration Guide](./MIGRATION.md) for detailed upgrade instructions.\n\n## Quick Start\n\n### 1. Configuration\n\nCreate a `.env` file based on `.env.example`:\n\n```env\nMPESA_CONSUMER_KEY=your_consumer_key\nMPESA_CONSUMER_SECRET=your_consumer_secret\nMPESA_ENVIRONMENT=sandbox\nMPESA_SHORT_CODE=174379\nMPESA_PASSKEY=your_passkey\n```\n\n### 2. Basic Usage\n\n```typescript\nimport { Mpesa } from 'mpesalib';\n\n// Initialize from environment variables\nconst mpesa = Mpesa.fromEnv();\n\n// Or initialize with config object\nconst mpesa = new Mpesa({\n  consumerKey: 'your_consumer_key',\n  consumerSecret: 'your_consumer_secret',\n  environment: 'sandbox',\n  shortCode: '174379',\n  passkey: 'your_passkey',\n});\n\n// STK Push (Customer Payment)\nconst response = await mpesa.paybillPayment(\n  1000,                           // Amount\n  '254712345678',                 // Phone number\n  'INV001',                       // Account reference\n  'Payment for services',         // Description\n  'https://yourdomain.com/callback' // Callback URL\n);\n\nconsole.log(response);\n```\n\n## API Reference\n\n### STK Push (Lipa Na M-Pesa Online)\n\nInitiate a payment request to customer's phone:\n\n```typescript\n// Paybill payment\nconst response = await mpesa.paybillPayment(\n  amount,\n  phoneNumber,\n  accountReference,\n  description,\n  callbackURL\n);\n\n// Buy goods payment\nconst response = await mpesa.buyGoodsPayment(\n  amount,\n  phoneNumber,\n  accountReference,\n  description,\n  callbackURL\n);\n\n// Custom STK Push\nconst response = await mpesa.stkPush({\n  BusinessShortCode: '174379',\n  TransactionType: 'CustomerPayBillOnline',\n  Amount: 1000,\n  PartyA: '254712345678',\n  PartyB: '174379',\n  PhoneNumber: '254712345678',\n  CallBackURL: 'https://yourdomain.com/callback',\n  AccountReference: 'TEST001',\n  TransactionDesc: 'Test payment',\n});\n```\n\n### STK Push Query\n\nCheck the status of an STK Push request:\n\n```typescript\nconst status = await mpesa.stkPushQuery('ws_CO_12345678');\n```\n\n### C2B (Customer to Business)\n\nRegister callback URLs and simulate C2B transactions:\n\n```typescript\n// Register URLs\nawait mpesa.registerC2BUrls({\n  ShortCode: '600000',\n  ResponseType: 'Completed',\n  ConfirmationURL: 'https://yourdomain.com/confirmation',\n  ValidationURL: 'https://yourdomain.com/validation',\n});\n\n// Simulate C2B payment\nawait mpesa.simulateC2B({\n  ShortCode: '600000',\n  CommandID: 'CustomerPayBillOnline',\n  Amount: 1000,\n  Msisdn: '254712345678',\n  BillRefNumber: 'INV001',\n});\n```\n\n### B2C (Business to Customer)\n\nSend money to customers:\n\n```typescript\n// Business payment\nawait mpesa.businessPayment(\n  5000,\n  '254712345678',\n  'Business payment',\n  'https://yourdomain.com/timeout',\n  'https://yourdomain.com/result'\n);\n\n// Salary payment\nawait mpesa.salaryPayment(\n  50000,\n  '254712345678',\n  'Monthly salary',\n  'https://yourdomain.com/timeout',\n  'https://yourdomain.com/result'\n);\n\n// Custom B2C\nawait mpesa.b2cPayment({\n  InitiatorName: 'testapi',\n  SecurityCredential: 'credential',\n  CommandID: 'BusinessPayment',\n  Amount: 1000,\n  PartyA: '600000',\n  PartyB: '254712345678',\n  Remarks: 'Payment',\n  QueueTimeOutURL: 'https://yourdomain.com/timeout',\n  ResultURL: 'https://yourdomain.com/result',\n});\n```\n\n### B2B (Business to Business)\n\nTransfer money between businesses:\n\n```typescript\nawait mpesa.b2bPayment({\n  InitiatorName: 'testapi',\n  SecurityCredential: 'credential',\n  CommandID: 'BusinessPayBill',\n  Amount: 1000,\n  PartyA: '600000',\n  PartyB: '600001',\n  RecieverIdentifierType: 4,\n  Remarks: 'B2B Payment',\n  QueueTimeOutURL: 'https://yourdomain.com/timeout',\n  ResultURL: 'https://yourdomain.com/result',\n  AccountReference: 'TEST001',\n});\n```\n\n### Account Balance\n\nCheck account balance:\n\n```typescript\nawait mpesa.getAccountBalance({\n  InitiatorName: 'testapi',\n  SecurityCredential: 'credential',\n  CommandID: 'AccountBalance',\n  PartyA: '600000',\n  IdentifierType: '4',\n  Remarks: 'Balance inquiry',\n  QueueTimeOutURL: 'https://yourdomain.com/timeout',\n  ResultURL: 'https://yourdomain.com/result',\n});\n```\n\n### Transaction Status\n\nQuery transaction status:\n\n```typescript\nawait mpesa.getTransactionStatus({\n  InitiatorName: 'testapi',\n  SecurityCredential: 'credential',\n  CommandID: 'TransactionStatusQuery',\n  TransactionID: 'OEI2AK4Q16',\n  PartyA: '600000',\n  IdentifierType: '4',\n  ResultURL: 'https://yourdomain.com/result',\n  QueueTimeOutURL: 'https://yourdomain.com/timeout',\n  Remarks: 'Status query',\n});\n```\n\n### Transaction Reversal\n\nReverse a transaction:\n\n```typescript\nawait mpesa.reverseTransaction({\n  InitiatorName: 'testapi',\n  SecurityCredential: 'credential',\n  CommandID: 'TransactionReversal',\n  TransactionID: 'OEI2AK4Q16',\n  Amount: 1000,\n  ReceiverParty: '600000',\n  RecieverIdentifierType: '4',\n  ResultURL: 'https://yourdomain.com/result',\n  QueueTimeOutURL: 'https://yourdomain.com/timeout',\n  Remarks: 'Reversal',\n});\n```\n\n## Callback Handling\n\nHandle M-Pesa callbacks in your Express.js application:\n\n```typescript\nimport express from 'express';\n\nconst app = express();\napp.use(express.json());\n\n// STK Push callback\napp.post('/mpesa/stkpush/callback', (req, res) =\u003e {\n  const callbackData = req.body;\n  \n  if (callbackData.Body?.stkCallback?.ResultCode === 0) {\n    console.log('Payment successful!');\n    // Update your database\n  } else {\n    console.log('Payment failed:', callbackData.Body.stkCallback.ResultDesc);\n  }\n  \n  res.status(200).json({ status: 'OK' });\n});\n\n// B2C result callback\napp.post('/mpesa/b2c/result', (req, res) =\u003e {\n  const result = req.body.Result;\n  \n  if (result.ResultCode === 0) {\n    console.log('B2C payment successful:', result.TransactionID);\n  } else {\n    console.log('B2C payment failed:', result.ResultDesc);\n  }\n  \n  res.status(200).json({ status: 'OK' });\n});\n```\n\n## Utilities\n\nThe library includes helpful utilities:\n\n```typescript\nimport { MpesaUtils } from 'mpesalib';\n\n// Format phone numbers\nconst formatted = MpesaUtils.formatPhoneNumber('0712345678');\n// Returns: '254712345678'\n\n// Generate timestamp\nconst timestamp = MpesaUtils.generateTimestamp();\n// Returns: '20231201120000'\n\n// Generate password for STK Push\nconst password = MpesaUtils.generatePassword(\n  shortCode,\n  passkey,\n  timestamp\n);\n\n// Generate security credential\nconst credential = MpesaUtils.generateSecurityCredential(\n  initiatorPassword,\n  certificatePath\n);\n\n// Retry failed operations\nconst result = await MpesaUtils.retry(\n  async () =\u003e mpesa.stkPush(request),\n  3, // max retries\n  1000 // delay in ms\n);\n```\n\n## Error Handling\n\nThe library provides comprehensive error handling:\n\n```typescript\ntry {\n  const response = await mpesa.stkPush(request);\n  console.log('Success:', response);\n} catch (error) {\n  if (error.status === 401) {\n    console.error('Authentication failed');\n  } else if (error.status === 400) {\n    console.error('Bad request:', error.data);\n  } else {\n    console.error('Network error:', error.message);\n  }\n}\n```\n\n## Environment Configuration\n\n### Required Environment Variables\n\n```env\nMPESA_CONSUMER_KEY=your_consumer_key\nMPESA_CONSUMER_SECRET=your_consumer_secret\nMPESA_ENVIRONMENT=sandbox|production\nMPESA_SHORT_CODE=your_shortcode\n```\n\n### Optional Environment Variables\n\n```env\nMPESA_INITIATOR_NAME=your_initiator_name\nMPESA_SECURITY_CREDENTIAL=your_security_credential\nMPESA_CERTIFICATE_PATH=./path/to/certificate.cer\nMPESA_PASSKEY=your_passkey\n```\n\n## Getting Started with Daraja API\n\n### 1. Create Daraja Account\n\n1. Visit [Daraja Portal](https://developer.safaricom.co.ke/)\n2. Create an account and verify your email\n3. Login to the portal\n\n### 2. Create an App\n\n1. Go to \"My Apps\" section\n2. Click \"Add a new app\"\n3. Fill in app details:\n   - **App Name**: Your application name\n   - **Description**: Brief description of your app\n   - **Select APIs**: Choose the APIs you need (STK Push, C2B, B2C, etc.)\n\n### 3. Get Credentials\n\nAfter creating the app, you'll get:\n- **Consumer Key**: Used for authentication\n- **Consumer Secret**: Used for authentication\n\n### 4. Test Credentials (Sandbox)\n\nFor sandbox testing, use these test credentials:\n- **Short Code**: 174379\n- **Test MSISDN**: 254708374149\n- **Passkey**: Get from Daraja portal\n\n### 5. Production Setup\n\nFor production:\n1. Request production access from Safaricom\n2. Get production credentials\n3. Update your configuration to use production environment\n\n## Testing\n\nRun the test suite:\n\n```bash\nnpm test\n```\n\nRun tests with coverage:\n\n```bash\nnpm run test:coverage\n```\n\nRun tests in watch mode:\n\n```bash\nnpm run test:watch\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch: `git checkout -b feature/amazing-feature`\n3. Make your changes and add tests\n4. Ensure tests pass: `npm test`\n5. Commit your changes: `git commit -m 'Add amazing feature'`\n6. Push to the branch: `git push origin feature/amazing-feature`\n7. Submit a pull request\n\n## Changelog\n\n### v3.0.0 (Latest)\n\n- ✨ Complete TypeScript rewrite\n- ✨ Modern async/await API\n- ✨ Comprehensive error handling\n- ✨ Built-in retry mechanism\n- ✨ Phone number formatting utilities\n- ✨ 95%+ test coverage\n- ✨ Updated Daraja API endpoints\n- ✨ Environment variable support\n- ✨ Callback handling utilities\n\n### v0.0.2 (Legacy)\n\n- Basic JavaScript implementation\n- Limited error handling\n- No TypeScript support\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- 📖 [Documentation](https://github.com/matrixjnr/mpesa-node-api/wiki)\n- 🐛 [Report Issues](https://github.com/matrixjnr/mpesa-node-api/issues)\n- 💬 [Discussions](https://github.com/matrixjnr/mpesa-node-api/discussions)\n- 📧 [Email Support](mailto:johnsimiyu4@gmail.com)\n\n## Acknowledgments\n\n- [Safaricom](https://www.safaricom.co.ke/) for providing the Daraja API\n- [M-Pesa](https://www.vodafone.com/what-we-do/services/m-pesa) for the mobile payment platform\n- All contributors who have helped improve this library\n\n## Related Projects\n\n- [M-Pesa Express](https://www.npmjs.com/package/mpesa-express) - Express.js middleware\n- [M-Pesa Laravel](https://github.com/SmoDav/mpesa) - Laravel package\n- [M-Pesa PHP](https://github.com/SmoDav/mpesa-php) - PHP SDK\n\n---\n\nMade with ❤️ by [John Simiyu](https://github.com/matrixjnr)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrixjnr%2Fmpesa-node-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatrixjnr%2Fmpesa-node-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrixjnr%2Fmpesa-node-api/lists"}