Skip to content

Developers

Bills

For an organisation that bills visit by visit or invoice by invoice: your system sends each bill and Wellth keeps the payer's balance, the sum of what is open. Anyone with the payer's number pays it, and you hear about each bill paid.

Before the first bill

  • Set your webhook address on Connect: bills answer 409 until there is one.
  • Make the payer: PUT /api/org/v1/payers/:externalRef without balanceMinor. You get its payment number to print or text.

Create a bill

POST/api/org/v1/bills

201 with the bill. 200 with the bill already made when you send an externalRef Wellth has seen (a retry).

payerRefstring, requiredThe externalRef you made the payer with. Unknown: 404.
descriptionstring, requiredOne of your type's descriptions (any case). Free text is refused, so a bill never says what is wrong with a patient.
amountMinorstring, requiredWhole shillings as a string, "30000". At least 1, at most 2,000,000,000.
currencystring, requiredThe payer's currency, UGX or KES.
externalRefstring or nullYour invoice id: 1 to 120 printable characters, no spaces, unique in your organisation. Send it: it makes retries safe.
siteCodestring or nullThe site the bill is for. Default: the payer's site.
dueAtstring or nullWhen it is due, as an ISO time. Bills with a date are paid first.
Request
curl -X POST https://wellth.example/api/org/v1/bills \
  -H "Authorization: Bearer $WELLTH_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "payerRef": "pt_4471",
    "externalRef": "inv_20931",
    "description": "Clinic services",
    "amountMinor": "30000",
    "currency": "UGX",
    "dueAt": "2026-11-30T00:00:00Z"
  }'
201 Created
{
  "id": "cm3x8k2p40001ab12cd34ef56",
  "externalRef": "inv_20931",
  "payerRef": "pt_4471",
  "payNumber": "4027186354",
  "description": "Clinic services",
  "amountMinor": "30000",
  "paidMinor": "0",
  "currency": "UGX",
  "siteCode": "kyanja",
  "dueAt": "2026-11-30T00:00:00.000Z",
  "status": "OPEN",
  "createdAt": "2026-11-01T09:05:42.000Z"
}

status is OPEN, PAID (paid in full) or CANCELLED. The payer's balanceMinor goes up by the bill at once.

Read or cancel a bill

GET/api/org/v1/bills/:id

The bill as above. 404 if it isn't yours.

POST/api/org/v1/bills/:id/cancel

Only while nothing is paid on it: its open family shares stop and the payer's balance comes down. Answers the bill, status CANCELLED.

Something already paid on it: 409 “Something was already paid on this bill, so it can't be cancelled.” (or the same for a family share). A share with a payment on its way: 400, wait until it lands or fails. For a part refund, talk to Tall Grass.

How a payment goes to bills

  • A payer pays any whole amount up to the balance with their number. Wellth puts it on the open bills oldest first: by due date (bills without one last), then by when they were made.
  • You get one learner.payment_succeeded for the whole payment, and one bill.payment_succeeded for each bill it touched, with that bill's part and whether the bill is now PAID.
  • Staff can split a bill into family shares in the portal (“Sister, London”): each share is a collection with its own link and pay code, and its payment comes as collection.payment_succeeded plus bill.payment_succeeded.

Descriptions, by type of organisation

A bill's description, and the termLabel any organisation but a school sends on payers and collections, is one of these. A school's termLabel can be any text up to 40 characters.

SchoolSCHOOLSchool fees · Uniform · Transport · Meals · Other school charges
ClinicCLINICClinic services · Medicines · Deposit · Balance brought forward
HospitalHOSPITALHospital services · Admission deposit · Medicines · Balance brought forward
Petrol stationPETROL_STATIONFuel · Fuel account · Lubricants and service · Shop
ShopSHOPGoods · Account · Delivery
NGONGOProgramme contribution · Donation · Service fee
SACCOSACCOSavings · Loan repayment · Membership fee · Shares
ChurchCHURCHOffering · Tithe · Building fund · Event
OrganisationOTHERServices · Goods · Account
Boda and taxi fleetTRANSPORTDeposit · Repairs · Insurance · Other charges