subscription-plans
Create a subscription plan
Create a subscription plan
POST
/
api
/
subscription_plans
Create a subscription plan
curl --request POST \
--url https://api.fluid.app/api/subscription_plans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription_plan": {
"name": "<string>",
"billing_interval": 123,
"billing_interval_unit": "<string>",
"shipping_interval": 123,
"shipping_interval_unit": "<string>",
"volume_interval": 123,
"volume_interval_unit": "<string>",
"trial_period": 123,
"trial_period_unit": "<string>",
"allow_skipping": true,
"max_skips": 123,
"allow_max_billing_cycles": true,
"max_billing_cycles": 123,
"split_volume": true,
"price_adjustment_type": "<string>",
"price_adjustment_amount": 123,
"active": true,
"company_default": true
},
"product_subscription_plans": {
"product_id": 123,
"default": true
}
}
'import requests
url = "https://api.fluid.app/api/subscription_plans"
payload = {
"subscription_plan": {
"name": "<string>",
"billing_interval": 123,
"billing_interval_unit": "<string>",
"shipping_interval": 123,
"shipping_interval_unit": "<string>",
"volume_interval": 123,
"volume_interval_unit": "<string>",
"trial_period": 123,
"trial_period_unit": "<string>",
"allow_skipping": True,
"max_skips": 123,
"allow_max_billing_cycles": True,
"max_billing_cycles": 123,
"split_volume": True,
"price_adjustment_type": "<string>",
"price_adjustment_amount": 123,
"active": True,
"company_default": True
},
"product_subscription_plans": {
"product_id": 123,
"default": True
}
}
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({
subscription_plan: {
name: '<string>',
billing_interval: 123,
billing_interval_unit: '<string>',
shipping_interval: 123,
shipping_interval_unit: '<string>',
volume_interval: 123,
volume_interval_unit: '<string>',
trial_period: 123,
trial_period_unit: '<string>',
allow_skipping: true,
max_skips: 123,
allow_max_billing_cycles: true,
max_billing_cycles: 123,
split_volume: true,
price_adjustment_type: '<string>',
price_adjustment_amount: 123,
active: true,
company_default: true
},
product_subscription_plans: {product_id: 123, default: true}
})
};
fetch('https://api.fluid.app/api/subscription_plans', 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.fluid.app/api/subscription_plans",
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([
'subscription_plan' => [
'name' => '<string>',
'billing_interval' => 123,
'billing_interval_unit' => '<string>',
'shipping_interval' => 123,
'shipping_interval_unit' => '<string>',
'volume_interval' => 123,
'volume_interval_unit' => '<string>',
'trial_period' => 123,
'trial_period_unit' => '<string>',
'allow_skipping' => true,
'max_skips' => 123,
'allow_max_billing_cycles' => true,
'max_billing_cycles' => 123,
'split_volume' => true,
'price_adjustment_type' => '<string>',
'price_adjustment_amount' => 123,
'active' => true,
'company_default' => true
],
'product_subscription_plans' => [
'product_id' => 123,
'default' => true
]
]),
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.fluid.app/api/subscription_plans"
payload := strings.NewReader("{\n \"subscription_plan\": {\n \"name\": \"<string>\",\n \"billing_interval\": 123,\n \"billing_interval_unit\": \"<string>\",\n \"shipping_interval\": 123,\n \"shipping_interval_unit\": \"<string>\",\n \"volume_interval\": 123,\n \"volume_interval_unit\": \"<string>\",\n \"trial_period\": 123,\n \"trial_period_unit\": \"<string>\",\n \"allow_skipping\": true,\n \"max_skips\": 123,\n \"allow_max_billing_cycles\": true,\n \"max_billing_cycles\": 123,\n \"split_volume\": true,\n \"price_adjustment_type\": \"<string>\",\n \"price_adjustment_amount\": 123,\n \"active\": true,\n \"company_default\": true\n },\n \"product_subscription_plans\": {\n \"product_id\": 123,\n \"default\": true\n }\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.fluid.app/api/subscription_plans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscription_plan\": {\n \"name\": \"<string>\",\n \"billing_interval\": 123,\n \"billing_interval_unit\": \"<string>\",\n \"shipping_interval\": 123,\n \"shipping_interval_unit\": \"<string>\",\n \"volume_interval\": 123,\n \"volume_interval_unit\": \"<string>\",\n \"trial_period\": 123,\n \"trial_period_unit\": \"<string>\",\n \"allow_skipping\": true,\n \"max_skips\": 123,\n \"allow_max_billing_cycles\": true,\n \"max_billing_cycles\": 123,\n \"split_volume\": true,\n \"price_adjustment_type\": \"<string>\",\n \"price_adjustment_amount\": 123,\n \"active\": true,\n \"company_default\": true\n },\n \"product_subscription_plans\": {\n \"product_id\": 123,\n \"default\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/subscription_plans")
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 \"subscription_plan\": {\n \"name\": \"<string>\",\n \"billing_interval\": 123,\n \"billing_interval_unit\": \"<string>\",\n \"shipping_interval\": 123,\n \"shipping_interval_unit\": \"<string>\",\n \"volume_interval\": 123,\n \"volume_interval_unit\": \"<string>\",\n \"trial_period\": 123,\n \"trial_period_unit\": \"<string>\",\n \"allow_skipping\": true,\n \"max_skips\": 123,\n \"allow_max_billing_cycles\": true,\n \"max_billing_cycles\": 123,\n \"split_volume\": true,\n \"price_adjustment_type\": \"<string>\",\n \"price_adjustment_amount\": 123,\n \"active\": true,\n \"company_default\": true\n },\n \"product_subscription_plans\": {\n \"product_id\": 123,\n \"default\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"subscription_plan": {
"id": 123,
"name": "<string>",
"billing_interval": 1,
"billing_interval_unit": "month",
"billing_frequency_in_words": "<string>",
"shipping_interval": 1,
"shipping_interval_unit": "month",
"volume_interval": 1,
"volume_interval_unit": "month",
"trial_period": 2,
"trial_period_unit": "<string>",
"split_volume": false,
"allow_skipping": true,
"max_skips": 2,
"allow_max_billing_cycles": false,
"max_billing_cycles": 123,
"price_adjustment_type": "<string>",
"price_adjustment_amount": 123,
"savings_label": "<string>",
"active": true,
"company_default": false,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"products_count": 123,
"subscribers_count": 123,
"company": {
"id": 123,
"name": "<string>"
},
"subscriptions": [
{
"id": 123
}
],
"products": [
{
"id": 123
}
]
},
"meta": {
"request_id": "<string>",
"timestamp": "<string>"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Bearer token authentication
Body
application/json
⌘I
Create a subscription plan
curl --request POST \
--url https://api.fluid.app/api/subscription_plans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription_plan": {
"name": "<string>",
"billing_interval": 123,
"billing_interval_unit": "<string>",
"shipping_interval": 123,
"shipping_interval_unit": "<string>",
"volume_interval": 123,
"volume_interval_unit": "<string>",
"trial_period": 123,
"trial_period_unit": "<string>",
"allow_skipping": true,
"max_skips": 123,
"allow_max_billing_cycles": true,
"max_billing_cycles": 123,
"split_volume": true,
"price_adjustment_type": "<string>",
"price_adjustment_amount": 123,
"active": true,
"company_default": true
},
"product_subscription_plans": {
"product_id": 123,
"default": true
}
}
'import requests
url = "https://api.fluid.app/api/subscription_plans"
payload = {
"subscription_plan": {
"name": "<string>",
"billing_interval": 123,
"billing_interval_unit": "<string>",
"shipping_interval": 123,
"shipping_interval_unit": "<string>",
"volume_interval": 123,
"volume_interval_unit": "<string>",
"trial_period": 123,
"trial_period_unit": "<string>",
"allow_skipping": True,
"max_skips": 123,
"allow_max_billing_cycles": True,
"max_billing_cycles": 123,
"split_volume": True,
"price_adjustment_type": "<string>",
"price_adjustment_amount": 123,
"active": True,
"company_default": True
},
"product_subscription_plans": {
"product_id": 123,
"default": True
}
}
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({
subscription_plan: {
name: '<string>',
billing_interval: 123,
billing_interval_unit: '<string>',
shipping_interval: 123,
shipping_interval_unit: '<string>',
volume_interval: 123,
volume_interval_unit: '<string>',
trial_period: 123,
trial_period_unit: '<string>',
allow_skipping: true,
max_skips: 123,
allow_max_billing_cycles: true,
max_billing_cycles: 123,
split_volume: true,
price_adjustment_type: '<string>',
price_adjustment_amount: 123,
active: true,
company_default: true
},
product_subscription_plans: {product_id: 123, default: true}
})
};
fetch('https://api.fluid.app/api/subscription_plans', 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.fluid.app/api/subscription_plans",
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([
'subscription_plan' => [
'name' => '<string>',
'billing_interval' => 123,
'billing_interval_unit' => '<string>',
'shipping_interval' => 123,
'shipping_interval_unit' => '<string>',
'volume_interval' => 123,
'volume_interval_unit' => '<string>',
'trial_period' => 123,
'trial_period_unit' => '<string>',
'allow_skipping' => true,
'max_skips' => 123,
'allow_max_billing_cycles' => true,
'max_billing_cycles' => 123,
'split_volume' => true,
'price_adjustment_type' => '<string>',
'price_adjustment_amount' => 123,
'active' => true,
'company_default' => true
],
'product_subscription_plans' => [
'product_id' => 123,
'default' => true
]
]),
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.fluid.app/api/subscription_plans"
payload := strings.NewReader("{\n \"subscription_plan\": {\n \"name\": \"<string>\",\n \"billing_interval\": 123,\n \"billing_interval_unit\": \"<string>\",\n \"shipping_interval\": 123,\n \"shipping_interval_unit\": \"<string>\",\n \"volume_interval\": 123,\n \"volume_interval_unit\": \"<string>\",\n \"trial_period\": 123,\n \"trial_period_unit\": \"<string>\",\n \"allow_skipping\": true,\n \"max_skips\": 123,\n \"allow_max_billing_cycles\": true,\n \"max_billing_cycles\": 123,\n \"split_volume\": true,\n \"price_adjustment_type\": \"<string>\",\n \"price_adjustment_amount\": 123,\n \"active\": true,\n \"company_default\": true\n },\n \"product_subscription_plans\": {\n \"product_id\": 123,\n \"default\": true\n }\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.fluid.app/api/subscription_plans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscription_plan\": {\n \"name\": \"<string>\",\n \"billing_interval\": 123,\n \"billing_interval_unit\": \"<string>\",\n \"shipping_interval\": 123,\n \"shipping_interval_unit\": \"<string>\",\n \"volume_interval\": 123,\n \"volume_interval_unit\": \"<string>\",\n \"trial_period\": 123,\n \"trial_period_unit\": \"<string>\",\n \"allow_skipping\": true,\n \"max_skips\": 123,\n \"allow_max_billing_cycles\": true,\n \"max_billing_cycles\": 123,\n \"split_volume\": true,\n \"price_adjustment_type\": \"<string>\",\n \"price_adjustment_amount\": 123,\n \"active\": true,\n \"company_default\": true\n },\n \"product_subscription_plans\": {\n \"product_id\": 123,\n \"default\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/subscription_plans")
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 \"subscription_plan\": {\n \"name\": \"<string>\",\n \"billing_interval\": 123,\n \"billing_interval_unit\": \"<string>\",\n \"shipping_interval\": 123,\n \"shipping_interval_unit\": \"<string>\",\n \"volume_interval\": 123,\n \"volume_interval_unit\": \"<string>\",\n \"trial_period\": 123,\n \"trial_period_unit\": \"<string>\",\n \"allow_skipping\": true,\n \"max_skips\": 123,\n \"allow_max_billing_cycles\": true,\n \"max_billing_cycles\": 123,\n \"split_volume\": true,\n \"price_adjustment_type\": \"<string>\",\n \"price_adjustment_amount\": 123,\n \"active\": true,\n \"company_default\": true\n },\n \"product_subscription_plans\": {\n \"product_id\": 123,\n \"default\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"subscription_plan": {
"id": 123,
"name": "<string>",
"billing_interval": 1,
"billing_interval_unit": "month",
"billing_frequency_in_words": "<string>",
"shipping_interval": 1,
"shipping_interval_unit": "month",
"volume_interval": 1,
"volume_interval_unit": "month",
"trial_period": 2,
"trial_period_unit": "<string>",
"split_volume": false,
"allow_skipping": true,
"max_skips": 2,
"allow_max_billing_cycles": false,
"max_billing_cycles": 123,
"price_adjustment_type": "<string>",
"price_adjustment_amount": 123,
"savings_label": "<string>",
"active": true,
"company_default": false,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"products_count": 123,
"subscribers_count": 123,
"company": {
"id": 123,
"name": "<string>"
},
"subscriptions": [
{
"id": 123
}
],
"products": [
{
"id": 123
}
]
},
"meta": {
"request_id": "<string>",
"timestamp": "<string>"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}