Skip to main content

Create Bill

Create a new payment bill. If a mobile number is provided, a USSD push is automatically sent to the customer's phone.

POSThttps://api.cashless.co.tz/api/v3/bills/create

Request body

FieldTypeRequiredDescription
amountnumberYesBill amount in local currency (TZS)
referencestringYesYour unique reference for this transaction (e.g., order ID)
mobilestringNoCustomer's mobile number in national format (e.g., 0712345678). If provided, triggers a USSD push.

Response

Returns a BillDto object.

FieldTypeDescription
idstringUnique bill identifier (UUID)
mobilestringCustomer's mobile number
amountnumberBill amount
statusstringPayment status: NOT_PAID, PARTIALLY_PAID, or FULLY_PAID
referencestringYour reference from the request
webPayUrlstringURL to the web payment page for this bill
datenumberBill creation timestamp (Unix milliseconds)

Examples

curl -X POST https://api.cashless.co.tz/api/v3/bills/create \
-H "Authorization: ApiKey YOUR_KEY:YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{
"amount": 15000,
"reference": "INV-2024-0042",
"mobile": "0712345678"
}'

Response:

{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"mobile": "0712345678",
"amount": 15000.0,
"status": "NOT_PAID",
"reference": "INV-2024-0042",
"webPayUrl": "https://webpay.cashless.co.tz?bill=a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"date": 1708185600000
}

Without a mobile number

If you omit mobile, no USSD push is sent. Instead, redirect the customer to the webPayUrl where they can enter their mobile number and pay.

curl -X POST https://api.cashless.co.tz/api/v3/bills/create \
-H "Authorization: ApiKey YOUR_KEY:YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{"amount": 15000, "reference": "INV-2024-0042"}'