API Docs

Python Examples

Here are some examples of how to use the ZuriPay API with Python.

Initiating a Transaction

Python

import requests

url = "https://api.zuripay.app/v1/transactions"

headers = {
    "Authorization": "Bearer zp_test_26PHem9AhJZvU623DfE1x4sd",
    "Content-Type": "application/json"
}

data = {
    "currency": "USD",
    "amount": 1000,
    "email": "[email protected]",
    "mobile_money_number": "254712345678",
    "payment_method_code": "mpesa",
    "transaction_reference": "ZURIPAY1234567890"
}

response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
    print("Transaction initiated:", response.json())
else:
    print("Error:", response.status_code, response.text)

Listing Wallets

Python

import requests

url = "https://api.zuripay.app/v1/wallets/list"

params = {
    "limit": 100
}

headers = {
    "Authorization": "Bearer zp_test_26PHem9AhJZvU623DfE1x4sd",
    "Content-Type": "application/json"
}

response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
    print("Wallet details:", response.json())
else:
    print("Error:", response.status_code, response.text)

Authenticating API Requests

Python

import requests

url = "https://api.zuripay.app/v1/authenticate"

headers = {
    "Authorization": "Bearer undefined_test_26PHem9AhJZvU623DfE1x4sd",
    "Content-Type": "application/json"
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print("Authentication successful:", response.json())
else:
    print("Error:", response.status_code, response.text)

Creating a Wallet

Python

import requests

url = "https://api.zuripay.app/v1/wallets/create"

headers = {
    "Authorization": "Bearer zp_test_26PHem9AhJZvU623DfE1x4sd",
    "Content-Type": "application/json"
}

data = {
    "currency": "USD",
    "balance": 1000
}

response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
    print("Wallet created:", response.json())
else:
    print("Error:", response.status_code, response.text)

Fetching Wallet Balance

Python

import requests

url = "https://api.zuripay.app/v1/wallets/balance"

headers = {
    "Authorization": "Bearer zp_test_26PHem9AhJZvU623DfE1x4sd",
    "Content-Type": "application/json"
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print("Wallet balance:", response.json())
else:
    print("Error:", response.status_code, response.text)