Skip to main content

Quickstart

Create your first bill and accept a payment in under 5 minutes.

Prerequisites

  • A Cashless merchant account with API credentials (key and secret)
  • For testing, use the sandbox environment

Step 1: Create a bill

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": 5000,
"reference": "ORDER-001",
"mobile": "0712345678"
}'

Response:

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

If you provided a mobile number, the customer will receive a USSD push on their phone prompting them to confirm the payment. You can also redirect the customer to the webPayUrl for a web-based payment experience.

Step 2: Check payment status

curl https://api.cashless.co.tz/api/v3/bills/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H "Authorization: ApiKey YOUR_KEY:YOUR_SECRET"

Step 3: Handle the result

When status is FULLY_PAID, the payment is complete. Fulfill the order.

For production, consider: