<samp>
# [azampay](https://developerdocs.azampay.co.tz/redoc)
Python Wrapper to Azampay Payment Gateway
[![Downloads](https://pepy.tech/badge/azampay)](https://pepy.tech/project/azampay)
[![Downloads](https://pepy.tech/badge/azampay/month)](https://pepy.tech/project/azampay)
[![Downloads](https://pepy.tech/badge/azampay/week)](https://pepy.tech/project/azampay)
## Azampay API Flow
All Azampay APIs follow two step process:
Step 1: Get token against the application authentication credentials.
Step 2: Consume the actual api by providing x-api-key header and token acquired in step 1.
Following diagram shows the general flow on how to consume the Azampay api.
![Azam Pay](https://developerdocs.azampay.co.tz/flow-diagrams/checkout-flow.svg)
## Getting Started
To get started with Azampay, you need to install the azampay package. You can either do it manually or use pip to install it.
### Manual Installation
```bash
$ git clone https://github.com/Neurotech-HQ/azampay
$ cd azampay
$ sudo python setup.py install
```
### Using pip
```bash
$ pip install azampay
```
## Authentication
Azampay offers two forms of authentication:
### API Key
Bearer Auth - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.
API-Key is the key that is provided in the http request header. Key Name is X-API-KEY.
```Bearer Token``` is the JWT token that you get against your application Name, Client Id and Client Secret. For Sanbox Environment, You can get these application credentials from [Sandbox portal](https://developers.azampay.co.tz/). For production environment, you will be provided these keys after you submit your business KYC to Azampay from Sandbox portal.
**Azampay** Package handles the authentication for you. You just need to provide it with its credentials and it will do the rest. Here is the example of how to use it.
```python
>>> from azampay import Azampay
>>> azampay = Azampay(app_name='<app_name'>, client_id='<client_id>', client_secret='<client_secret>', x_api_key='<x_api_key>', sandbox=True)
```
**Note**: When you want to use the package in production environment, No need to specify the X-API-Key.
```python
>>> from azampay import Azampay
>>> azampay = Azampay(app_name='<app_name>', client_id='<client_id>', client_secret='<client_secret>', sandbox=False)
```
## Checkout
Azampay offers two types of checkout:
1. Mobile Checkout - for mobile checkout (Tigopesa, AirtelMoney, Mpesa)
2. Bank Checkout - for bank checkout (CRDB, NMB)
### Mobile Checkout
Here is the example of how to use the mobile checkout.
```python
>>> from azampay import Azampay
>>> azampay = Azampay(app_name='<app_name>', client_id='<client_id>', client_secret='<client_secret>', x_api_key='<x_api_key>', sandbox=True)
>>> checkout_response = azampay.mobile_checkout(amount=100, mobile='<mobile>', external_id='<external_id>', provider='<provider>')
```
### Bank Checkout
Here is the example of how to use the bank checkout.
```python
>>> from azampay import Azampay
>>> azampay = Azampay(app_name='<app_name>', client_id='<client_id>', client_secret='<client_secret>', x_api_key='<x_api_key>', sandbox=True)
>>> checkout_response = azampay.bank_checkout(amount=100, merchant_account_number='<merchant_account_number>', merchant_mobile_number='<merchant_mobile_number>', reference_id='<external_id>', provider='<provider>')
```
### Generate Payment Link
Here is the example of how to use the generate payment link.
```python
>>> from azampay import Azampay
>>> azampay = Azampay(
... app_name='<app_name>',
... client_id='<client_id>',
... client_secret='<client_secret>',
... x_api_key='<x_api_key>',
... sandbox=True
)
>>> payment_link = azampay.generate_payment_link(
amount='<amount>', external_id='<external_id>', provider='<provider>'
)
>>> payment_link = azampay.generate_payment_link(
amount='5000', external_id='12345343', provider='Airtel'
)['data']
```
### Callback
Now that you already know to initiate payments with Azampay package, Let's get started with the callback.
>_Note_: You will need to have a webhook endpoint set up on your application to receive the callback from Azampay.
I have added a starter [FastAPI webhook endpoint](https://github.com/Neurotech-HQ/azampay/blob/main/callback.py) to this repository. You can either use it or set up your own.
#### Webhook Data
Here an example of the webhook data that you will receive from Azampay.
```json
{
"msisdn": "0178823",
"amount": "2000",
"message": "any message",
"utilityref": "1292-123",
"operator": "Tigo",
"reference": "123-123",
"transactionstatus": "success",
"submerchantAcc": "01723113",
}
```
## Issues
If you will face any issue with the usage of this package please raise one so as we can quickly fix it as soon as possible;
## Contributing
This is an opensource project under ```MIT License``` so any one is welcome to contribute from typo, to source code to documentation, ```JUST FORK IT```.
## Related
1. [Python-DPO](https://github.com/Neurotech-HQ/python-dpo)
2. [Pypesa](https://github.com/Neurotech-HQ/pypesa)
3. [Tigopesa](https://github.com/Neurotech-HQ/tigopesa)
## All the credit
1. [kalebu](https://github.com/Kalebu)
2. All other contributors
</samp>
Raw data
{
"_id": null,
"home_page": "https://github.com/Neurotech-HQ/azampay",
"name": "azampay",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "azampay,azampay SDK,Azam pay SDK,Azampay Wrapper,Payment Gateway Tanzania,tigopesa,mpesa,airtel money,halopesa",
"author": "Jordan Kalebu",
"author_email": "isaackeinstein@gmail.com",
"download_url": "https://github.com/Neurotech-HQ/azampay/archive/refs/tags/v0.1.tar.gz",
"platform": null,
"description": "<samp>\n\n# [azampay](https://developerdocs.azampay.co.tz/redoc)\n\nPython Wrapper to Azampay Payment Gateway\n\n[![Downloads](https://pepy.tech/badge/azampay)](https://pepy.tech/project/azampay)\n[![Downloads](https://pepy.tech/badge/azampay/month)](https://pepy.tech/project/azampay)\n[![Downloads](https://pepy.tech/badge/azampay/week)](https://pepy.tech/project/azampay)\n\n## Azampay API Flow\n\nAll Azampay APIs follow two step process:\n\nStep 1: Get token against the application authentication credentials.\nStep 2: Consume the actual api by providing x-api-key header and token acquired in step 1.\nFollowing diagram shows the general flow on how to consume the Azampay api.\n\n![Azam Pay](https://developerdocs.azampay.co.tz/flow-diagrams/checkout-flow.svg)\n\n\n## Getting Started\n\nTo get started with Azampay, you need to install the azampay package. You can either do it manually or use pip to install it.\n\n### Manual Installation\n\n```bash\n$ git clone https://github.com/Neurotech-HQ/azampay\n$ cd azampay\n$ sudo python setup.py install\n```\n\n### Using pip\n\n```bash\n$ pip install azampay\n```\n\n## Authentication\n\nAzampay offers two forms of authentication:\n\n### API Key\n\nBearer Auth - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.\nAPI-Key is the key that is provided in the http request header. Key Name is X-API-KEY.\n\n```Bearer Token``` is the JWT token that you get against your application Name, Client Id and Client Secret. For Sanbox Environment, You can get these application credentials from [Sandbox portal](https://developers.azampay.co.tz/). For production environment, you will be provided these keys after you submit your business KYC to Azampay from Sandbox portal.\n\n**Azampay** Package handles the authentication for you. You just need to provide it with its credentials and it will do the rest. Here is the example of how to use it.\n\n```python\n>>> from azampay import Azampay\n>>> azampay = Azampay(app_name='<app_name'>, client_id='<client_id>', client_secret='<client_secret>', x_api_key='<x_api_key>', sandbox=True)\n```\n\n**Note**: When you want to use the package in production environment, No need to specify the X-API-Key. \n\n```python\n>>> from azampay import Azampay\n>>> azampay = Azampay(app_name='<app_name>', client_id='<client_id>', client_secret='<client_secret>', sandbox=False)\n```\n\n## Checkout\n\nAzampay offers two types of checkout:\n\n1. Mobile Checkout - for mobile checkout (Tigopesa, AirtelMoney, Mpesa)\n2. Bank Checkout - for bank checkout (CRDB, NMB)\n\n### Mobile Checkout\n\nHere is the example of how to use the mobile checkout.\n\n```python\n>>> from azampay import Azampay\n>>> azampay = Azampay(app_name='<app_name>', client_id='<client_id>', client_secret='<client_secret>', x_api_key='<x_api_key>', sandbox=True)\n>>> checkout_response = azampay.mobile_checkout(amount=100, mobile='<mobile>', external_id='<external_id>', provider='<provider>')\n```\n\n### Bank Checkout\n\nHere is the example of how to use the bank checkout.\n\n```python\n>>> from azampay import Azampay\n>>> azampay = Azampay(app_name='<app_name>', client_id='<client_id>', client_secret='<client_secret>', x_api_key='<x_api_key>', sandbox=True)\n>>> checkout_response = azampay.bank_checkout(amount=100, merchant_account_number='<merchant_account_number>', merchant_mobile_number='<merchant_mobile_number>', reference_id='<external_id>', provider='<provider>')\n```\n\n### Generate Payment Link\n\nHere is the example of how to use the generate payment link.\n\n```python\n>>> from azampay import Azampay\n>>> azampay = Azampay(\n... app_name='<app_name>',\n... client_id='<client_id>',\n... client_secret='<client_secret>',\n... x_api_key='<x_api_key>',\n... sandbox=True\n)\n>>> payment_link = azampay.generate_payment_link(\n amount='<amount>', external_id='<external_id>', provider='<provider>'\n)\n>>> payment_link = azampay.generate_payment_link(\n amount='5000', external_id='12345343', provider='Airtel'\n)['data']\n```\n\n### Callback\n\nNow that you already know to initiate payments with Azampay package, Let's get started with the callback.\n\n>_Note_: You will need to have a webhook endpoint set up on your application to receive the callback from Azampay.\n\nI have added a starter [FastAPI webhook endpoint](https://github.com/Neurotech-HQ/azampay/blob/main/callback.py) to this repository. You can either use it or set up your own.\n\n#### Webhook Data\n\nHere an example of the webhook data that you will receive from Azampay.\n\n```json\n{\n \"msisdn\": \"0178823\",\n \"amount\": \"2000\",\n \"message\": \"any message\",\n \"utilityref\": \"1292-123\",\n \"operator\": \"Tigo\",\n \"reference\": \"123-123\",\n \"transactionstatus\": \"success\",\n \"submerchantAcc\": \"01723113\",\n}\n```\n\n## Issues\n\nIf you will face any issue with the usage of this package please raise one so as we can quickly fix it as soon as possible;\n\n## Contributing\n\nThis is an opensource project under ```MIT License``` so any one is welcome to contribute from typo, to source code to documentation, ```JUST FORK IT```.\n\n## Related\n\n1. [Python-DPO](https://github.com/Neurotech-HQ/python-dpo)\n2. [Pypesa](https://github.com/Neurotech-HQ/pypesa)\n3. [Tigopesa](https://github.com/Neurotech-HQ/tigopesa)\n\n## All the credit\n\n1. [kalebu](https://github.com/Kalebu)\n2. All other contributors\n\n\n</samp>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Opensource python wrapper for Azampay API",
"version": "0.5",
"project_urls": {
"Download": "https://github.com/Neurotech-HQ/azampay/archive/refs/tags/v0.1.tar.gz",
"Homepage": "https://github.com/Neurotech-HQ/azampay"
},
"split_keywords": [
"azampay",
"azampay sdk",
"azam pay sdk",
"azampay wrapper",
"payment gateway tanzania",
"tigopesa",
"mpesa",
"airtel money",
"halopesa"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2e1908e8adc73142cf4bbdbeae620b458ba58a23295247578f6cf81db392159b",
"md5": "05913d47f08e014348b4551d0321b1e3",
"sha256": "49e639709032d8b615251d9d9397b3f2d31cfbb2bbf7848fdb965e0245589a77"
},
"downloads": -1,
"filename": "azampay-0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "05913d47f08e014348b4551d0321b1e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8938,
"upload_time": "2024-03-04T10:49:50",
"upload_time_iso_8601": "2024-03-04T10:49:50.307556Z",
"url": "https://files.pythonhosted.org/packages/2e/19/08e8adc73142cf4bbdbeae620b458ba58a23295247578f6cf81db392159b/azampay-0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-04 10:49:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Neurotech-HQ",
"github_project": "azampay",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "azampay"
}