# mpesa-client
M-Pesa API client for Daraja
This Python package is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen
## Requirements.
Python 2.7 and 3.4+
## Installation & Usage
### pip install
If the python package is hosted on Github, you can install directly from Github
```sh
pip install git+
github.com
```
(you may need to run `pip` with root permission: `sudo pip install git+
github.com`)
Then import the package:
```python
import mpesa_client
```
### Setuptools
Install via Setuptools.
```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)
Then import the package:
```python
import mpesa_client
```
## Getting Started
Please follow the installation procedure and then run the following:
```python
from __future__ import print_function
import time
import mpesa_client
from mpesa_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: bearerAuth
configuration = mpesa_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = mpesa_client.DisbursementApi(mpesa_client.ApiClient(configuration))
body = mpesa_client.B2CPaymentRequest() # B2CPaymentRequest |
try:
# Make a B2C Payment Request
api_response = api_instance.mpesa_b2c_v3_paymentrequest_post(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling DisbursementApi->mpesa_b2c_v3_paymentrequest_post: %s\n" % e)
```
## Documentation for API Endpoints
All URIs are relative to *
sandbox.safaricom.co.ke*
Class | Method | HTTP request | Description
------------ | ------------- | -- …