# M-Pesa SDK for JavaScript
M-Pesa SDK for JavaScript is an unofficial library aiming to help businesses integrating every M-Pesa operations to their JavaScript applications.
## Contents
- Features
- Usage
- Quickstart
- Receive Money from a Mobile Account
- Send Money to a Mobile Account
- Send Money to a Business Account
- Revert a Transaction
- Query the Status of a Transaction
- Examples
- Prerequisites
- Installation
- Using NPM
- Using Yarn
- Manual Installation
- Configuration
- Related Projects
- Dependencies
- Friends
- Contributing
- Changelog
- Authors
- Credits
- License
## Features
- Receive money from a mobile account to a business account
- Send money from a business account to a mobile account
- Send money from a business account to a another business account
- Revert a transaction
- Query the status of a transaction
## Usage
### Quickstart
### Receive Money from a Mobile Account
#### ES6 Modules
```javascript
import { Client } from '@paymentsds/mpesa'
const client = new Client({
apiKey: ' ', // API Key
publicKey: ' ', // Public Key
serviceProviderCode: ' ' // input_ServiceProviderCode
});
const paymentData = {
from: '841234567', // input_CustomerMSISDN
reference: '11114', // input_ThirdPartyReference
transation: 'T12344CC', // input_TransactionReference
amount: '10' // input_Amount
};
client.receive(paymentData).then(r => {
// Handle success scenario
}).catch(e =>{
// Handle success scenario
});
```
#### CommonJS
```javascript
var Client = require("@paymentsds/mpesa").Client;
var client = new Client({
apiKey: ' ', // API Key
publicKey: ' ', // Public Key
serviceProviderCode: ' ' // input_ServiceProviderCode
});
var paymentData = {
from: '841234567', // input_CustomerMSISDN
reference: '11114', // input_ThirdPartyReference
transation: 'T12344CC', // input_TransactionReference
amount: '10' …