Python sample code of how to integrate with Yo! Payments Gateway
# Yo! Payments API Python Module
Yo! Payments is a revolutionary mobile payments gateway service. Yo! Payments enables businesses to receive payments from their customers via mobile money, as well as make mobile money payments to any mobile money account holder. Yo! Payments also has the capability to send mobile calling credit ("airtime") directly to users.
Yo! Payments Python Module is a Python module that can be included in your Python project to enable seamless integration with your Python application.
## Getting Started
### Prerequisites
To use the API, you must, first of all, have a Yo! Payments Business Account. The API is not available for Personal Accounts
* Yo! Payments api_username
* Yo! Payments api_password
Import the module
```
import yopayments
```
Use the module as shown below
# To test the deposit of funds API
```
YoPay = yopayments.YoPay("yo_api_username", "yo_api_password")
response = YoPay.ac_deposit_funds("256712345678", 500, "reason for payment")
if response.get("TransactionStatus") == "SUCCEEDED":
# Payment was successful
else:
# Payment failed
```
# To test withdraw funds API without public Key configured
```
YoPay = yopayments.YoPay("yo_api_username", "yo_api_password")
YoPay.set_external_reference("TestWithPython"+YoPay.generate_random())
response = YoPay.ac_withdraw_funds("256712345678", 500, "reason for payment")
if response.get("TransactionStatus") == "SUCCEEDED":
# Payment was successful
else:
# Payment failed
```
# To test withdraw funds API with public Key configured
```
YoPay = yopayments.YoPay("yo_api_username", "yo_api_password")
YoPay.set_external_reference("TestWithPython"+YoPay.generate_random())
username="yo_api_username"
account="256789092671"
amount="2000"
narrative="Reason for payments"
external_ref=YoPay.external_reference
nonce="xGLl39KNTN3467T-"+YoPay.generate_random()
data=username+amount+account+narrative+external_ref+nonce
base64_signature=YoP …