Create a subscription
curl --request POST \
--url https://api.useplinth.com/v1/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "cus_01JABC...",
"plan_id": "pln_01JABC...",
"default_payment_method_id": "tok_test_visa",
"preferred_rail": "card",
"quantity": 1,
"metadata": {}
}
'import requests
url = "https://api.useplinth.com/v1/subscriptions"
payload = {
"customer_id": "cus_01JABC...",
"plan_id": "pln_01JABC...",
"default_payment_method_id": "tok_test_visa",
"preferred_rail": "card",
"quantity": 1,
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: 'cus_01JABC...',
plan_id: 'pln_01JABC...',
default_payment_method_id: 'tok_test_visa',
preferred_rail: 'card',
quantity: 1,
metadata: {}
})
};
fetch('https://api.useplinth.com/v1/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.useplinth.com/v1/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => 'cus_01JABC...',
'plan_id' => 'pln_01JABC...',
'default_payment_method_id' => 'tok_test_visa',
'preferred_rail' => 'card',
'quantity' => 1,
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.useplinth.com/v1/subscriptions"
payload := strings.NewReader("{\n \"customer_id\": \"cus_01JABC...\",\n \"plan_id\": \"pln_01JABC...\",\n \"default_payment_method_id\": \"tok_test_visa\",\n \"preferred_rail\": \"card\",\n \"quantity\": 1,\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.useplinth.com/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"cus_01JABC...\",\n \"plan_id\": \"pln_01JABC...\",\n \"default_payment_method_id\": \"tok_test_visa\",\n \"preferred_rail\": \"card\",\n \"quantity\": 1,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useplinth.com/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"cus_01JABC...\",\n \"plan_id\": \"pln_01JABC...\",\n \"default_payment_method_id\": \"tok_test_visa\",\n \"preferred_rail\": \"card\",\n \"quantity\": 1,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"object": "subscription",
"id": "sub_01JABC...",
"state": "active",
"current_period_start": "2026-06-01T00:00:00Z",
"current_period_end": "2026-07-01T00:00:00Z",
"trial_end_at": null,
"next_bill_at": "2026-07-01T00:00:00Z"
}Subscriptions
Create a subscription
Subscribes a customer to a plan. If the plan has a trial period, the subscription starts in trialing state and the first charge fires at trial_end_at. Use preferred_rail: transfer for customers who pay by bank transfer.
POST
/
v1
/
subscriptions
Create a subscription
curl --request POST \
--url https://api.useplinth.com/v1/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "cus_01JABC...",
"plan_id": "pln_01JABC...",
"default_payment_method_id": "tok_test_visa",
"preferred_rail": "card",
"quantity": 1,
"metadata": {}
}
'import requests
url = "https://api.useplinth.com/v1/subscriptions"
payload = {
"customer_id": "cus_01JABC...",
"plan_id": "pln_01JABC...",
"default_payment_method_id": "tok_test_visa",
"preferred_rail": "card",
"quantity": 1,
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: 'cus_01JABC...',
plan_id: 'pln_01JABC...',
default_payment_method_id: 'tok_test_visa',
preferred_rail: 'card',
quantity: 1,
metadata: {}
})
};
fetch('https://api.useplinth.com/v1/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.useplinth.com/v1/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => 'cus_01JABC...',
'plan_id' => 'pln_01JABC...',
'default_payment_method_id' => 'tok_test_visa',
'preferred_rail' => 'card',
'quantity' => 1,
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.useplinth.com/v1/subscriptions"
payload := strings.NewReader("{\n \"customer_id\": \"cus_01JABC...\",\n \"plan_id\": \"pln_01JABC...\",\n \"default_payment_method_id\": \"tok_test_visa\",\n \"preferred_rail\": \"card\",\n \"quantity\": 1,\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.useplinth.com/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"cus_01JABC...\",\n \"plan_id\": \"pln_01JABC...\",\n \"default_payment_method_id\": \"tok_test_visa\",\n \"preferred_rail\": \"card\",\n \"quantity\": 1,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useplinth.com/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"cus_01JABC...\",\n \"plan_id\": \"pln_01JABC...\",\n \"default_payment_method_id\": \"tok_test_visa\",\n \"preferred_rail\": \"card\",\n \"quantity\": 1,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"object": "subscription",
"id": "sub_01JABC...",
"state": "active",
"current_period_start": "2026-06-01T00:00:00Z",
"current_period_end": "2026-07-01T00:00:00Z",
"trial_end_at": null,
"next_bill_at": "2026-07-01T00:00:00Z"
}Authorizations
Use sk_test_ keys for sandbox. Use sk_live_ keys for production. Obtain your key from the dashboard.
Body
application/json
Example:
"cus_01JABC..."
Example:
"pln_01JABC..."
Card token from Nomba. Required for card-rail subscriptions.
Example:
"tok_test_visa"
Available options:
card, transfer, direct_debit Example:
"card"
Example:
1
Response
201 - application/json
Subscription created
Available options:
subscription Example:
"sub_01JABC..."
Available options:
incomplete, active, trialing, past_due, grace, delinquent, paused, canceled Example:
"active"
True when the subscription is set to cancel at period end (still active until then).
Example:
false
Whether a card token is on file. Transfer-funded subs have none.
Example:
true
A pending period-end plan change (e.g. a scheduled downgrade).
Show child attributes
Show child attributes