Create a Plan

How to create a subscription plan

This API will help you to create and manage a subscription plans.

Subscription Fields

FieldDescription
currencyChoose a billing currency : KES, USD, EUR, GBP
nameProvide a name for your subscription plane e.g Basic Standard, Premium e.t.c
frequencyProvide a billing frequency. This determines the billing interval depending on the frequency unit selected. E.g if you set frequency as 1 and frequency unit as M(month), billing will happen every one month. If frequency was 3, billing will happen after every three months.
frequency_unitProvide a frequency unit: 'D'(day), 'W'(week), 'M'(month), 'Y'(year)
billing_cyclesThis determines set the number of times billing should be done. E.g if you want to bill your customer monthly for the next one year, you can set this field as 12.
amountBilling amount for the plan

Create a Plan Request

import requests

url = "https://sandbox.intasend.com/api/v1/subscriptions-plans/"

payload = {  
    "currency": "KES",  
    "name": "Basic",  
    "frequency": 1,  
    "frequency_unit": "M",  
    "billing_cycles": 12,  
    "amount": "1000"  
}  
headers = {  
    "accept": "application/json",  
    "content-type": "application/json",  
    "Authorization": "Bearer ISSecretKey_test..."  
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.intasend.com/api/v1/subscriptions-plans/', [
  'body' => '{"currency": "KES", "name": "Basic", "frequency": 1, "frequency_unit": "M", "billing_cycles": 12, "amount": "1000"}',
  'headers' => [
    'accept' => 'application/json',
    'content-type' => 'application/json',
    'Authorization' => 'Bearer ISSecretKey_test...' 
  ],
]);

$data = json_decode($response->getBody());

Create a Plan Response

{
  "name": "Basic",
  "plan_id": "LERG5RK",
  "frequency": 1,
  "frequency_unit": "M",
  "billing_cycles": 12,
  "currency": "KES",
  "amount": "1000.00",
  "created_at": "2023-10-05T10:25:25.499093+03:00",
  "updated_at": "2023-10-05T10:25:25.499123+03:00"
}

What’s Next

Creating a customer