pythonPython

ZenoPay Documentation for Order Creating , USSD Payment and Webhook

1. Creating an Order and Pushing USSD Payment

To create an order and initiate USSD payment, you need to send a POST request to the endpoint. Here’s how to handle it:

API Endpoint:

POST https://api.zeno.africa

Request Data:

{
    'buyer_email': 'YOUR_CUSTOMER_EMAIL',
    'buyer_name': 'YOUR_CUSTOMER_NAME',
    'buyer_phone': '0742920510',
    'amount': 10000,
    'account_id': 'YOUR_ACCOUNT_ID',
    'api_key': 'YOUR_API_KEY',
    'secret_key': 'YOUR_SECRET_KEY',
}

Example Python Code:

import requests

# URL of the API endpoint
url = "https://api.zeno.africa"

# Data to send for creating the order and pushing USSD payment
order_data = {
    'create_order': 1,
    'buyer_email': 'YOUR_CUSTOMER_EMAIL',
    'buyer_name': 'YOUR_CUSTOMER_NAME',
    'buyer_phone': '0752117588',
    'amount': 10000,
    'account_id': 'YOUR_ACCOUNT_ID',
    'api_key': 'YOUR_API_KEY',
    'secret_key': 'YOUR_SECRET_KEY',
}

try:
    # Send POST request to create the order and initiate USSD payment
    response = requests.post(url, data=order_data)
    
    # Print the response
    print(response.text)

except requests.RequestException as e:
    # Log errors to a file
    with open('error_log.txt', 'a') as log_file:
        log_file.write(f"Error: {e}\n")

2. Checking Order Status

To check the status of an order, you need to send a POST request to the status checking endpoint.

API Endpoint:

Request Data:

Example Python Code:

Sample Response:

3. Setting Up the Webhook

To handle incoming webhook notifications, set up an endpoint on your server to receive and process POST requests.

Example Webhook Handler in Python:

Summary

  • Create an Order and Push USSD Payment: Send a POST request to https://api.zeno.africa with order and payment details.

  • Check Order Status: Send a POST request to https://api.zeno.africa/order-status with order_id.

  • Webhook Handling: Set up an endpoint to receive and process webhook notifications.

Last updated