Accept payments
Donations
Fundraising campaigns with a public donate page that accept M-Pesa, wallet and card gifts.
Base URL
https://api.paysasa.com/api/v1Authx-api-keyFormatJSON
First-class fundraising for verified businesses. Create campaigns with a public donate page,
collect gifts over M-Pesa STK, wallet, or PayBill (DN-XXXXX), and issue
sequential receipts. Requires the Donations module and donations_enabled on the
business. Authenticate with a business API key, or a signed-in session plus
business_id.
| Endpoint | Description |
|---|---|
GET /donations/campaigns |
List campaigns |
POST /donations/campaigns |
Create draft campaign (purpose + beneficiary required) |
PATCH /donations/campaigns/:id |
Update campaign; set status to active|paused|closed |
GET /donations/gifts |
List gifts (optional campaign_id, q) |
GET /donations/campaigns/:id/export |
CSV export of gifts/receipts |
GET /donations/public/:slug |
Public campaign payload |
POST /donations/public/:slug |
Wallet pay (signed-in donor) |
POST /donations/public/:slug/mpesa-checkout |
Create M-Pesa STK checkout session |
const res = await fetch("https://api.paysasa.com/api/v1/donations/campaigns", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "apk_live_…",
},
body: JSON.stringify({
business_id: "biz_…",
title: "Community Fundraiser",
purpose: "School fees support",
beneficiary_name: "Acme Foundation",
amount_mode: "open",
min_amount: 10000,
}),
});
const { campaign } = await res.json();
// Public page: /donate/{campaign.slug}
// PayBill BillRef: campaign.public_reference (DN-XXXXX)
Buy Me a Coffee tips use Payment Links with link_purpose=buy_me_coffee (not
this Donations API).