Bezza Logo

Bezza API Documentation

Your Gateway to Seamless API Integration

How It Works

The Bezza API enables seamless integration for handling payments, balances, and customer data.

Start Integrating

How to Integrate Bezza API

Follow these steps to integrate the Bezza API into your application:

  1. Obtain your API key from the Bezza dashboard.
  2. Use the API key to authenticate your requests.
  3. Start sending requests to Bezza endpoints based on your requirements.

Example Code

Node.js

const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; const url = 'https://api.bezza.io/pay_api_meterId'; const data = { amount: '10.50', phone: '123456789', meterId: 'METER_ID', paymentType: 'Zaad' }; axios.post(url, data, { headers: { 'Authorization': `Bearer ${apiKey}` } }) .then(response => { console.log('Payment initiated:', response.data); }) .catch(error => { console.error('Error:', error.response.data); });

Python

import requests api_key = 'YOUR_API_KEY' url = 'https://api.bezza.io/pay_api_meterId' data = { "amount": "10.50", "phone": "123456789", "meterId": "METER_ID", "paymentType": "Zaad" } headers = { "Authorization": f"Bearer {api_key}" } response = requests.post(url, json=data, headers=headers) if response.status_code == 200: print("Payment initiated:", response.json()) else: print("Error:", response.json())

Bezza Checkout

Bezza Checkout is a flexible, secure, and seamless way to integrate payment processing into your application.

Features:

  • Initiate payments with USSD codes.
  • Track real-time payment statuses.
  • Supports multiple payment methods and card payments via DPO.

To integrate Bezza Checkout, use the following API endpoints:

1. USSD Payment Initiation

POST /pay_api_meterId

Request Parameters:

Example Response:

{ "message": "Payment Initiated. Dial USSD to proceed.", "ussdCode": "*789*630533*10*50#", "meterId": "METER_ID" }

2. DPO Card Payment Initiation

POST /dpo_createToken

Request Parameters:

Example Response:

{ "message": "Token created and updated successfully.", "redirectUrl": "https://secure.3gdirectpay.com/payv3.php?ID=...", "token": "DPO_TRANSACTION_TOKEN" }

3. DPO Transaction Verification

GET /dpo_verifyToken?token=...

Use this to confirm whether a DPO transaction has been paid. Redirects to:

See Example Code

DPO Integration

Integrate with Direct Pay Online (DPO) to accept card and mobile money payments. You will create a transaction token, update it with customer details, redirect users to pay, and verify the payment status.

Tokens have a 30 minute TTL before it expires.

1. Create Transaction Token

POST /dpo_createToken

Request Headers:

Request Body (JSON):

Parameter Type Required Description
companyId string Yes Your Bezza companyId
amount string Yes Payment amount in BWP
firstName string Yes Customer first name
lastName string Yes Customer last name
email string Yes Customer email address
phone string Yes Customer phone number (international format)
city string Yes Customer city
country string Yes ISO 2-letter country code (e.g., "BW")
apiKey string Yes Your Bezza API key

Sample Request:

curl -X POST https://api.bezza.io/dpo_createToken \ -H "Content-Type: application/json" \ -d '{ "companyId": "YOUR_COMPANYID", "amount": "50.00", "firstName": "John", "lastName": "Smith", "email": "john.smith@gmail.com", "phone": "26777453256", "city": "Gaborone", "country": "BW", "apiKey": "YOUR_API_KEY" }'

Sample Node.js:

const axios = require('axios'); const payload = {companyId: 'YOUR_COMPANYID' , amount: '50.00', firstName: 'John', lastName: 'Smith', email: 'john.smith@gmail.com', phone: '26777453256', city: 'Gaborone', country: 'BW', apiKey: 'YOUR_API_KEY' }; axios.post('https://api.bezza.io/dpo_createToken', payload) .then(res => console.log(res.data)) .catch(err => console.error(err.response.data));

Successful Response:

{ "message": "Token created and updated successfully.", "redirectUrl": "https://secure.3gdirectpay.com/payv3.php?ID=TOKEN_ID", "token": "TOKEN_ID" }

2. Verify Transaction Token

GET /dpo_verifyToken?companyId=COMPANY_ID&token=TOKEN_ID

Verifies if the DPO transaction has been paid within the 30-minute window.

Sample Request:

curl "https://api.bezza.io/dpo_verifyToken?companyId=COMPANY_ID&token=TOKEN_ID"

Sample Node.js:

axios.get('https://api.bezza.io/dpo_verifyToken', { params: { companyId: 'COMPANY_ID', token: 'TOKEN_ID' } }) .then(res => console.log(res.data)) .catch(err => console.error(err.response.data));

On Success:

User is redirected to /payment_success

On Failure:

User is redirected to /payment_failed