# M-PESA API Package
This is a PHP package for the Safaricom's M-Pesa REST API dubbed DARAJA API.
If you are looking for a laravel implementation do check the following repo Laravel Implementation
## Installation
This project supports both composer dependency management tool and can also be used without composer
### Using Composer
1. Run the following command
```
composer require kabangi/mpesa
```
### Without composer
1. Download the source code as zipped
2. Follow the following directions
```
STKPush([
'amount' => 10,
'transactionDesc' => '',
'phoneNumber' => '',
]);
$response = $mpesa->B2C([
'amount' => 10,
'accountReference' => '12',
'callBackURL' => '
example.com',
'queueTimeOutURL' => '
example.com',
'resultURL' => '
example.com',
'Remarks' => 'Test'
]);
// $mpesa->STKStatus([]);
// $mpesa->C2BRegister([]);
// $mpesa->STKPush([]);
// $mpesa->C2BSimulate([]);
// $mpesa->B2C([])
// $mpesa->B2B([]);
// $mpesa->accountBalance([])
// $mpesa->reversal([]);
// $mpesa->transactionStatus([]);
// $mpesa->reversal([]);
}catch(\Exception $e){
$response = json_decode($e->getMessage());
}
header('Content-Type: application/json');
echo json_encode($response);
```
## Support
Need support using this package:-
Send a quick message here
t.me
## API's Supported
The library implements all the exposed endpoints by Safaricom as listed below:-
### 1. Lipa na M-Pesa Online Payment
#### What it is?
The Lipa na M-Pesa Online Payment endpoint(STK push) allows you to request payment from your users/clients. With this endpoint all the user is required to do is input their M-PESA pin to a prompt to send a payment to you.
#### How to implement it?
Read docs here.
### 2. Lipa na M-Pesa Online Query Request
#### What it is?
When you request payment from your users/clients via Lipa na M-Pesa Online endpoi …