Subscriptions
Model plans with customers, products and recurring prices, then start subscriptions that raise an invoice every billing period.
https://api.paysasa.com/api/v1Authx-api-keyFormatJSON
Create billing customers, products, and prices, then start subscriptions for your business.
Each billing period issues an invoice customers can pay with M-Pesa or wallet. Authenticate
with a business API key, or a signed-in session plus business_id.
| Endpoint | Description |
|---|---|
POST /billing/customers |
Create billing customer |
POST /billing/products |
Create product |
POST /billing/prices |
Recurring price (amount minor units,
interval day|week|month|year)
|
POST /subscriptions |
Create subscription; returns payment_url for first invoice |
POST /subscriptions/checkout |
Create a subscription and return a checkout URL |
POST /subscriptions/:id/cancel|pause|resume |
Cancel, pause, or resume a subscription |
GET /subscriptions/portal |
Customer portal (subscription_id + email or phone) |
const res = await fetch("https://api.paysasa.com/api/v1/subscriptions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "apk_live_…",
},
body: JSON.stringify({
business_id: "biz_…",
customer_id: "cust_…",
items: [{ price: "price_…", quantity: 1 }],
collection_method: "send_invoice",
trial_days: 0,
}),
});
const { subscription, payment_url } = await res.json();
Related webhooks include subscription.created,
subscription.updated, subscription.canceled,
customer.created, invoice.created, and invoice.paid.
Configure endpoints under your business webhook settings.