Create and manage recurring subscription plans programmatically using the Kroxt SDK or directly inside the Kroxt Console. Created plans automatically sync with Paystack's Plan API (PLN_xxx).
Call baas.payment.createPlan(options):
const plan = await baas.payment.createPlan({
name: "Pro Monthly Subscription",
amount: 1000000, // 10,000 NGN in kobo
interval: "monthly", // "hourly" | "daily" | "weekly" | "monthly" | "quarterly" | "biannually" | "annually"
currency: "NGN",
description: "Access to all premium features and unlimited storage",
});
console.log("Plan Code:", plan.planCode); // e.g. PLN_v83k1sa
console.log("Plan Name:", plan.name);| Plan Property | Type | Description |
|---|---|---|
| name | string | Display name for the subscription plan. Required. |
| amount | number | Recurring charge amount in minor units (kobo). Required. |
| interval | string | Billing interval: "hourly" | "daily" | "weekly" | "monthly" | "quarterly" | "biannually" | "annually". Required. |
| currency | string | Plan currency code (defaults to "NGN"). |
| description | string | Summary description of what the plan includes. |
Call baas.payment.listPlans():
const plans = await baas.payment.listPlans();
plans.forEach((p) => {
console.log(`Plan: ${p.name} (${p.planCode}) - ${p.currency} ${p.amount / 100}/${p.interval}`);
});