- Plans define the billing amount, currency, frequency, and total number of cycles.
- Customers hold your end-user’s contact and billing details.
- Subscriptions link a customer to a plan and track the current billing status.
Step 1: Create a plan
A plan defines what you charge, how often, and for how long. POST /api/v1/subscriptions/plans/Request
| Field | Type | Description |
|---|---|---|
name | string | Unique name for the plan within your account |
amount | decimal | Amount to charge each billing cycle |
currency | string | 3-letter ISO currency code (e.g. KES, USD) |
frequency | integer | How many units between each billing cycle |
frequency_unit | string | D (day), W (week), M (month), or Y (year) |
billing_cycles | integer | Total number of times to bill the customer |
Response
POST a plan with a name that already exists on your account, Kulmi Pay updates the existing plan instead of creating a duplicate.
Step 2: Create a customer
A customer record stores the details of the person you want to bill. POST /api/v1/subscriptions/customers/Request
| Field | Type | Description |
|---|---|---|
email | string | Customer’s email address (unique per account) |
first_name | string | Customer’s first name |
last_name | string | Customer’s last name |
phone_number | string | Customer’s phone number (optional) |
Response
Step 3: Create a subscription
Link a customer to a plan to start the billing cycle. POST /api/v1/subscriptions/subscriptions/Request
| Field | Type | Description |
|---|---|---|
plan_id | string | The id of the plan to use |
customer_id | string | The id of the customer to bill |
start_date | string | ISO 8601 date for the first billing attempt (YYYY-MM-DD). Must not be in the past. |
Response
PENDING status. Once the customer completes the initial card enrollment step, the status moves to ACTIVE and Kulmi Pay begins billing automatically on the plan’s schedule.
Subscription statuses:
| Status | Meaning |
|---|---|
PENDING | Subscription created, awaiting card enrollment |
ACTIVE | Card enrolled, billing is running |
COMPLETE | All billing cycles have been successfully charged |
CANCELED | Subscription was cancelled by you or the customer |
FAILED | The most recent billing attempt failed |
Step 4: Monitor payment history
Retrieve a list of all payment attempts for a subscription. GET /api/v1/subscriptions/subscriptions//transactions/Response
status field is SUCCESS, PROCESSING, or FAILED.
Cancel a subscription
Send aPOST request to cancel an active subscription immediately. No further billing cycles will be attempted.
POST /api/v1/subscriptions/subscriptions//unsubscribe/
Response
List and manage resources
| Endpoint | Method | Description |
|---|---|---|
/api/v1/subscriptions/plans/ | GET | List all plans |
/api/v1/subscriptions/plans/ | POST | Create or update a plan |
/api/v1/subscriptions/customers/ | GET | List all customers |
/api/v1/subscriptions/customers/ | POST | Create or update a customer |
/api/v1/subscriptions/subscriptions/ | GET | List all subscriptions |
/api/v1/subscriptions/subscriptions/ | POST | Create a subscription |
/api/v1/subscriptions/subscriptions/{id}/unsubscribe/ | POST | Cancel a subscription |
/api/v1/subscriptions/subscriptions/{id}/transactions/ | GET | List payment history |
Kulmi Pay fires a
subscription_event webhook each time a subscription’s status changes or a billing cycle completes. Enable this event on your webhook to stay in sync without polling. See Webhook event types for payload details.