curl --request POST \
--url https://us.api.flexprice.io/v1/subscriptions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"currency": "<string>",
"plan_id": "<string>",
"addons": [
{
"addon_id": "<string>",
"line_item_commitments": {},
"metadata": {},
"start_date": "2023-11-07T05:31:56Z"
}
],
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_period_count": 123,
"commitment_amount": "<string>",
"coupons": [
"<string>"
],
"credit_grants": [
{
"credits": "<string>",
"name": "<string>",
"addon_id": "<string>",
"conversion_rate": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"expiration_duration": 123,
"metadata": {},
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"topup_conversion_rate": "<string>"
}
],
"customer_id": "<string>",
"enable_true_up": true,
"end_date": "2023-11-07T05:31:56Z",
"external_customer_id": "<string>",
"gateway_payment_method_id": "<string>",
"inheritance": {
"external_customer_ids_to_inherit_subscription": [
"<string>"
],
"invoicing_customer_external_id": "<string>",
"parent_subscription_id": "<string>",
"subscriptions_ids_for_grouped_invoicing": [
"<string>"
]
},
"line_item_commitments": {},
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"override_entitlements": [
{
"entitlement_id": "<string>",
"config_value": {},
"is_enabled": true,
"static_value": "<string>",
"usage_limit": 123
}
],
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
}
}
],
"phases": [
{
"start_date": "2023-11-07T05:31:56Z",
"coupons": [
"<string>"
],
"end_date": "2023-11-07T05:31:56Z",
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"metadata": {},
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
}
}
],
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
]
}
],
"start_date": "2023-11-07T05:31:56Z",
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
],
"tax_rate_overrides": [
{
"currency": "<string>",
"tax_rate_code": "<string>",
"auto_apply": true,
"metadata": {},
"priority": 123
}
],
"timezone": "<string>",
"trial_period_days": 123
}
'import requests
url = "https://us.api.flexprice.io/v1/subscriptions"
payload = {
"currency": "<string>",
"plan_id": "<string>",
"addons": [
{
"addon_id": "<string>",
"line_item_commitments": {},
"metadata": {},
"start_date": "2023-11-07T05:31:56Z"
}
],
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_period_count": 123,
"commitment_amount": "<string>",
"coupons": ["<string>"],
"credit_grants": [
{
"credits": "<string>",
"name": "<string>",
"addon_id": "<string>",
"conversion_rate": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"expiration_duration": 123,
"metadata": {},
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"topup_conversion_rate": "<string>"
}
],
"customer_id": "<string>",
"enable_true_up": True,
"end_date": "2023-11-07T05:31:56Z",
"external_customer_id": "<string>",
"gateway_payment_method_id": "<string>",
"inheritance": {
"external_customer_ids_to_inherit_subscription": ["<string>"],
"invoicing_customer_external_id": "<string>",
"parent_subscription_id": "<string>",
"subscriptions_ids_for_grouped_invoicing": ["<string>"]
},
"line_item_commitments": {},
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": True
}
],
"commitment_true_up_enabled": True,
"commitment_windowed": True,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"override_entitlements": [
{
"entitlement_id": "<string>",
"config_value": {},
"is_enabled": True,
"static_value": "<string>",
"usage_limit": 123
}
],
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": { "divide_by": 123 }
}
],
"phases": [
{
"start_date": "2023-11-07T05:31:56Z",
"coupons": ["<string>"],
"end_date": "2023-11-07T05:31:56Z",
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": True
}
],
"commitment_true_up_enabled": True,
"commitment_windowed": True,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"metadata": {},
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": { "divide_by": 123 }
}
],
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
]
}
],
"start_date": "2023-11-07T05:31:56Z",
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
],
"tax_rate_overrides": [
{
"currency": "<string>",
"tax_rate_code": "<string>",
"auto_apply": True,
"metadata": {},
"priority": 123
}
],
"timezone": "<string>",
"trial_period_days": 123
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: '<string>',
plan_id: '<string>',
addons: [
{
addon_id: '<string>',
line_item_commitments: {},
metadata: {},
start_date: '2023-11-07T05:31:56Z'
}
],
auto_invoice_threshold: '<string>',
billing_anchor: '2023-11-07T05:31:56Z',
billing_period_count: 123,
commitment_amount: '<string>',
coupons: ['<string>'],
credit_grants: [
{
credits: '<string>',
name: '<string>',
addon_id: '<string>',
conversion_rate: '<string>',
end_date: '2023-11-07T05:31:56Z',
expiration_duration: 123,
metadata: {},
period_count: 123,
plan_id: '<string>',
priority: 123,
start_date: '2023-11-07T05:31:56Z',
subscription_id: '<string>',
topup_conversion_rate: '<string>'
}
],
customer_id: '<string>',
enable_true_up: true,
end_date: '2023-11-07T05:31:56Z',
external_customer_id: '<string>',
gateway_payment_method_id: '<string>',
inheritance: {
external_customer_ids_to_inherit_subscription: ['<string>'],
invoicing_customer_external_id: '<string>',
parent_subscription_id: '<string>',
subscriptions_ids_for_grouped_invoicing: ['<string>']
},
line_item_commitments: {},
line_item_coupons: {},
line_items: [
{
commitment_amount: 123,
commitment_overage_factor: 123,
commitment_quantity: 123,
commitment_time_buckets: [
{
commitment_value: '<string>',
end: {hour: 12, minute: 29},
id: '<string>',
overage_factor: '<string>',
start: {hour: 12, minute: 29},
true_up_enabled: true
}
],
commitment_true_up_enabled: true,
commitment_windowed: true,
display_name: '<string>',
end_date: '2023-11-07T05:31:56Z',
metadata: {},
price_id: '<string>',
quantity: 123,
start_date: '2023-11-07T05:31:56Z',
subscription_phase_id: '<string>'
}
],
lookup_key: '<string>',
metadata: {},
overage_factor: '<string>',
override_entitlements: [
{
entitlement_id: '<string>',
config_value: {},
is_enabled: true,
static_value: '<string>',
usage_limit: 123
}
],
override_line_items: [
{
price_id: '<string>',
amount: '<string>',
price_unit_amount: '<string>',
price_unit_tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
quantity: '<string>',
tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
transform_quantity: {divide_by: 123}
}
],
phases: [
{
start_date: '2023-11-07T05:31:56Z',
coupons: ['<string>'],
end_date: '2023-11-07T05:31:56Z',
line_item_coupons: {},
line_items: [
{
commitment_amount: 123,
commitment_overage_factor: 123,
commitment_quantity: 123,
commitment_time_buckets: [
{
commitment_value: '<string>',
end: {hour: 12, minute: 29},
id: '<string>',
overage_factor: '<string>',
start: {hour: 12, minute: 29},
true_up_enabled: true
}
],
commitment_true_up_enabled: true,
commitment_windowed: true,
display_name: '<string>',
end_date: '2023-11-07T05:31:56Z',
metadata: {},
price_id: '<string>',
quantity: 123,
start_date: '2023-11-07T05:31:56Z',
subscription_phase_id: '<string>'
}
],
metadata: {},
override_line_items: [
{
price_id: '<string>',
amount: '<string>',
price_unit_amount: '<string>',
price_unit_tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
quantity: '<string>',
tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
transform_quantity: {divide_by: 123}
}
],
subscription_coupons: [
{
coupon_code: '<string>',
end_date: '2023-11-07T05:31:56Z',
price_id: '<string>',
start_date: '2023-11-07T05:31:56Z'
}
]
}
],
start_date: '2023-11-07T05:31:56Z',
subscription_coupons: [
{
coupon_code: '<string>',
end_date: '2023-11-07T05:31:56Z',
price_id: '<string>',
start_date: '2023-11-07T05:31:56Z'
}
],
tax_rate_overrides: [
{
currency: '<string>',
tax_rate_code: '<string>',
auto_apply: true,
metadata: {},
priority: 123
}
],
timezone: '<string>',
trial_period_days: 123
})
};
fetch('https://us.api.flexprice.io/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://us.api.flexprice.io/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([
'currency' => '<string>',
'plan_id' => '<string>',
'addons' => [
[
'addon_id' => '<string>',
'line_item_commitments' => [
],
'metadata' => [
],
'start_date' => '2023-11-07T05:31:56Z'
]
],
'auto_invoice_threshold' => '<string>',
'billing_anchor' => '2023-11-07T05:31:56Z',
'billing_period_count' => 123,
'commitment_amount' => '<string>',
'coupons' => [
'<string>'
],
'credit_grants' => [
[
'credits' => '<string>',
'name' => '<string>',
'addon_id' => '<string>',
'conversion_rate' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'expiration_duration' => 123,
'metadata' => [
],
'period_count' => 123,
'plan_id' => '<string>',
'priority' => 123,
'start_date' => '2023-11-07T05:31:56Z',
'subscription_id' => '<string>',
'topup_conversion_rate' => '<string>'
]
],
'customer_id' => '<string>',
'enable_true_up' => true,
'end_date' => '2023-11-07T05:31:56Z',
'external_customer_id' => '<string>',
'gateway_payment_method_id' => '<string>',
'inheritance' => [
'external_customer_ids_to_inherit_subscription' => [
'<string>'
],
'invoicing_customer_external_id' => '<string>',
'parent_subscription_id' => '<string>',
'subscriptions_ids_for_grouped_invoicing' => [
'<string>'
]
],
'line_item_commitments' => [
],
'line_item_coupons' => [
],
'line_items' => [
[
'commitment_amount' => 123,
'commitment_overage_factor' => 123,
'commitment_quantity' => 123,
'commitment_time_buckets' => [
[
'commitment_value' => '<string>',
'end' => [
'hour' => 12,
'minute' => 29
],
'id' => '<string>',
'overage_factor' => '<string>',
'start' => [
'hour' => 12,
'minute' => 29
],
'true_up_enabled' => true
]
],
'commitment_true_up_enabled' => true,
'commitment_windowed' => true,
'display_name' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'metadata' => [
],
'price_id' => '<string>',
'quantity' => 123,
'start_date' => '2023-11-07T05:31:56Z',
'subscription_phase_id' => '<string>'
]
],
'lookup_key' => '<string>',
'metadata' => [
],
'overage_factor' => '<string>',
'override_entitlements' => [
[
'entitlement_id' => '<string>',
'config_value' => [
],
'is_enabled' => true,
'static_value' => '<string>',
'usage_limit' => 123
]
],
'override_line_items' => [
[
'price_id' => '<string>',
'amount' => '<string>',
'price_unit_amount' => '<string>',
'price_unit_tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'quantity' => '<string>',
'tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'transform_quantity' => [
'divide_by' => 123
]
]
],
'phases' => [
[
'start_date' => '2023-11-07T05:31:56Z',
'coupons' => [
'<string>'
],
'end_date' => '2023-11-07T05:31:56Z',
'line_item_coupons' => [
],
'line_items' => [
[
'commitment_amount' => 123,
'commitment_overage_factor' => 123,
'commitment_quantity' => 123,
'commitment_time_buckets' => [
[
'commitment_value' => '<string>',
'end' => [
'hour' => 12,
'minute' => 29
],
'id' => '<string>',
'overage_factor' => '<string>',
'start' => [
'hour' => 12,
'minute' => 29
],
'true_up_enabled' => true
]
],
'commitment_true_up_enabled' => true,
'commitment_windowed' => true,
'display_name' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'metadata' => [
],
'price_id' => '<string>',
'quantity' => 123,
'start_date' => '2023-11-07T05:31:56Z',
'subscription_phase_id' => '<string>'
]
],
'metadata' => [
],
'override_line_items' => [
[
'price_id' => '<string>',
'amount' => '<string>',
'price_unit_amount' => '<string>',
'price_unit_tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'quantity' => '<string>',
'tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'transform_quantity' => [
'divide_by' => 123
]
]
],
'subscription_coupons' => [
[
'coupon_code' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'price_id' => '<string>',
'start_date' => '2023-11-07T05:31:56Z'
]
]
]
],
'start_date' => '2023-11-07T05:31:56Z',
'subscription_coupons' => [
[
'coupon_code' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'price_id' => '<string>',
'start_date' => '2023-11-07T05:31:56Z'
]
],
'tax_rate_overrides' => [
[
'currency' => '<string>',
'tax_rate_code' => '<string>',
'auto_apply' => true,
'metadata' => [
],
'priority' => 123
]
],
'timezone' => '<string>',
'trial_period_days' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://us.api.flexprice.io/v1/subscriptions"
payload := strings.NewReader("{\n \"currency\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"addons\": [\n {\n \"addon_id\": \"<string>\",\n \"line_item_commitments\": {},\n \"metadata\": {},\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"auto_invoice_threshold\": \"<string>\",\n \"billing_anchor\": \"2023-11-07T05:31:56Z\",\n \"billing_period_count\": 123,\n \"commitment_amount\": \"<string>\",\n \"coupons\": [\n \"<string>\"\n ],\n \"credit_grants\": [\n {\n \"credits\": \"<string>\",\n \"name\": \"<string>\",\n \"addon_id\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"expiration_duration\": 123,\n \"metadata\": {},\n \"period_count\": 123,\n \"plan_id\": \"<string>\",\n \"priority\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_id\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"enable_true_up\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"external_customer_id\": \"<string>\",\n \"gateway_payment_method_id\": \"<string>\",\n \"inheritance\": {\n \"external_customer_ids_to_inherit_subscription\": [\n \"<string>\"\n ],\n \"invoicing_customer_external_id\": \"<string>\",\n \"parent_subscription_id\": \"<string>\",\n \"subscriptions_ids_for_grouped_invoicing\": [\n \"<string>\"\n ]\n },\n \"line_item_commitments\": {},\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"overage_factor\": \"<string>\",\n \"override_entitlements\": [\n {\n \"entitlement_id\": \"<string>\",\n \"config_value\": {},\n \"is_enabled\": true,\n \"static_value\": \"<string>\",\n \"usage_limit\": 123\n }\n ],\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"phases\": [\n {\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"coupons\": [\n \"<string>\"\n ],\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ]\n }\n ],\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"tax_rate_overrides\": [\n {\n \"currency\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"auto_apply\": true,\n \"metadata\": {},\n \"priority\": 123\n }\n ],\n \"timezone\": \"<string>\",\n \"trial_period_days\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://us.api.flexprice.io/v1/subscriptions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"addons\": [\n {\n \"addon_id\": \"<string>\",\n \"line_item_commitments\": {},\n \"metadata\": {},\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"auto_invoice_threshold\": \"<string>\",\n \"billing_anchor\": \"2023-11-07T05:31:56Z\",\n \"billing_period_count\": 123,\n \"commitment_amount\": \"<string>\",\n \"coupons\": [\n \"<string>\"\n ],\n \"credit_grants\": [\n {\n \"credits\": \"<string>\",\n \"name\": \"<string>\",\n \"addon_id\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"expiration_duration\": 123,\n \"metadata\": {},\n \"period_count\": 123,\n \"plan_id\": \"<string>\",\n \"priority\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_id\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"enable_true_up\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"external_customer_id\": \"<string>\",\n \"gateway_payment_method_id\": \"<string>\",\n \"inheritance\": {\n \"external_customer_ids_to_inherit_subscription\": [\n \"<string>\"\n ],\n \"invoicing_customer_external_id\": \"<string>\",\n \"parent_subscription_id\": \"<string>\",\n \"subscriptions_ids_for_grouped_invoicing\": [\n \"<string>\"\n ]\n },\n \"line_item_commitments\": {},\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"overage_factor\": \"<string>\",\n \"override_entitlements\": [\n {\n \"entitlement_id\": \"<string>\",\n \"config_value\": {},\n \"is_enabled\": true,\n \"static_value\": \"<string>\",\n \"usage_limit\": 123\n }\n ],\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"phases\": [\n {\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"coupons\": [\n \"<string>\"\n ],\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ]\n }\n ],\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"tax_rate_overrides\": [\n {\n \"currency\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"auto_apply\": true,\n \"metadata\": {},\n \"priority\": 123\n }\n ],\n \"timezone\": \"<string>\",\n \"trial_period_days\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"addons\": [\n {\n \"addon_id\": \"<string>\",\n \"line_item_commitments\": {},\n \"metadata\": {},\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"auto_invoice_threshold\": \"<string>\",\n \"billing_anchor\": \"2023-11-07T05:31:56Z\",\n \"billing_period_count\": 123,\n \"commitment_amount\": \"<string>\",\n \"coupons\": [\n \"<string>\"\n ],\n \"credit_grants\": [\n {\n \"credits\": \"<string>\",\n \"name\": \"<string>\",\n \"addon_id\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"expiration_duration\": 123,\n \"metadata\": {},\n \"period_count\": 123,\n \"plan_id\": \"<string>\",\n \"priority\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_id\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"enable_true_up\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"external_customer_id\": \"<string>\",\n \"gateway_payment_method_id\": \"<string>\",\n \"inheritance\": {\n \"external_customer_ids_to_inherit_subscription\": [\n \"<string>\"\n ],\n \"invoicing_customer_external_id\": \"<string>\",\n \"parent_subscription_id\": \"<string>\",\n \"subscriptions_ids_for_grouped_invoicing\": [\n \"<string>\"\n ]\n },\n \"line_item_commitments\": {},\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"overage_factor\": \"<string>\",\n \"override_entitlements\": [\n {\n \"entitlement_id\": \"<string>\",\n \"config_value\": {},\n \"is_enabled\": true,\n \"static_value\": \"<string>\",\n \"usage_limit\": 123\n }\n ],\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"phases\": [\n {\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"coupons\": [\n \"<string>\"\n ],\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ]\n }\n ],\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"tax_rate_overrides\": [\n {\n \"currency\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"auto_apply\": true,\n \"metadata\": {},\n \"priority\": 123\n }\n ],\n \"timezone\": \"<string>\",\n \"trial_period_days\": 123\n}"
response = http.request(request)
puts response.read_body{
"active_pause_id": "<string>",
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"cancelled_at": "2023-11-07T05:31:56Z",
"collection_method": "<string>",
"commitment_amount": "<string>",
"coupon_associations": [
{
"coupon": {
"amount_off": "<string>",
"coupon_code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"duration_in_periods": 123,
"environment_id": "<string>",
"id": "<string>",
"max_redemptions": 123,
"metadata": {},
"name": "<string>",
"percentage_off": "<string>",
"redeem_after": "<string>",
"redeem_before": "<string>",
"rules": {},
"tenant_id": "<string>",
"total_redemptions": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"coupon_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_line_item": {
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": 123,
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"event_name": "<string>",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "<string>",
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"entitlements": [
{
"addon": "<unknown>",
"config_value": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"display_order": 123,
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": "<string>"
},
"info": {
"threshold": "<string>"
},
"warning": {
"threshold": "<string>"
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"id": "<string>",
"is_enabled": true,
"is_soft_limit": true,
"parent_entitlement_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"static_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_limit": 123
}
],
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"subscription_line_item_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"currency": "<string>",
"current_period_end": "2023-11-07T05:31:56Z",
"current_period_start": "2023-11-07T05:31:56Z",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"contact": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"timezone": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"enable_true_up": true,
"end_date": "2023-11-07T05:31:56Z",
"entitlements": [
{
"entitlement": {
"config_values": [
{}
],
"is_enabled": true,
"is_soft_limit": true,
"static_values": [
"<string>"
],
"usage_limit": 123
},
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": "<string>"
},
"info": {
"threshold": "<string>"
},
"warning": {
"threshold": "<string>"
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"sources": [
{
"config_value": {},
"entitlement_id": "<string>",
"entity_id": "<string>",
"entity_name": "<string>",
"is_enabled": true,
"quantity": 123,
"static_value": "<string>",
"subscription_id": "<string>",
"usage_limit": 123
}
]
}
],
"environment_id": "<string>",
"gateway_payment_method_id": "<string>",
"id": "<string>",
"invoicing_customer_id": "<string>",
"latest_invoice": {
"adjustment_amount": "<string>",
"amount_due": "<string>",
"amount_paid": "<string>",
"amount_remaining": "<string>",
"billing_period": "<string>",
"billing_reason": "<string>",
"billing_sequence": 123,
"coupon_applications": [
{
"applied_at": "2023-11-07T05:31:56Z",
"coupon_association_id": "<string>",
"coupon_id": "<string>",
"coupon_snapshot": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"discount_percentage": "<string>",
"discounted_amount": "<string>",
"environment_id": "<string>",
"final_price": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_line_item_id": "<string>",
"metadata": {},
"original_price": "<string>",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"contact": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"timezone": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"description": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"finalized_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"idempotency_key": "<string>",
"invoice_number": "<string>",
"invoice_pdf_url": "<string>",
"issue_date": "2023-11-07T05:31:56Z",
"last_computed_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"adjusted_entitlement_quantity": "<string>",
"amount": "<string>",
"commitment_info": {
"amount": "<string>",
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"is_windowed": true,
"overage_factor": "<string>",
"quantity": "<string>",
"true_up_enabled": true
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"entity_id": "<string>",
"entity_type": "<string>",
"environment_id": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_level_discount": "<string>",
"line_item_discount": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"plan_display_name": "<string>",
"prepaid_credits_applied": "<string>",
"price_id": "<string>",
"price_type": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"subscription_id": "<string>",
"subscription_line_item_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_analytics": [
{
"cost": "<string>",
"event_count": 123,
"percentage": "<string>",
"source": "<string>",
"usage": "<string>"
}
],
"usage_breakdown": [
{
"cost": "<string>",
"event_count": 123,
"grouped_by": {},
"percentage": "<string>",
"usage": "<string>"
}
]
}
],
"metadata": {},
"overpaid_amount": "<string>",
"paid_at": "2023-11-07T05:31:56Z",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"recalculated_invoice_id": "<string>",
"refunded_amount": "<string>",
"subscription": "<unknown>",
"subscription_customer_id": "<string>",
"subscription_id": "<string>",
"subtotal": "<string>",
"taxes": [
{
"applied_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"tax_amount": "<string>",
"tax_association_id": "<string>",
"tax_rate": {
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"fixed_value": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"percentage_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"tax_rate_id": "<string>",
"taxable_amount": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"total": "<string>",
"total_discount": "<string>",
"total_prepaid_credits_applied": "<string>",
"total_tax": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123,
"voided_at": "2023-11-07T05:31:56Z"
},
"line_items": [
{
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": 123,
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"event_name": "<string>",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "<string>",
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"parent_subscription_id": "<string>",
"pauses": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"original_period_end": "2023-11-07T05:31:56Z",
"original_period_start": "2023-11-07T05:31:56Z",
"pause_end": "2023-11-07T05:31:56Z",
"pause_start": "2023-11-07T05:31:56Z",
"reason": "<string>",
"resumed_at": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"payment_behavior": "<string>",
"phases": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"synced_price_sequence": 123,
"tenant_id": "<string>",
"timezone": "<string>",
"trial_end": "2023-11-07T05:31:56Z",
"trial_start": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}Create subscription
Use when onboarding a customer to a plan or starting a new subscription. Ideal for draft subscriptions (activate later) or active from start.
curl --request POST \
--url https://us.api.flexprice.io/v1/subscriptions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"currency": "<string>",
"plan_id": "<string>",
"addons": [
{
"addon_id": "<string>",
"line_item_commitments": {},
"metadata": {},
"start_date": "2023-11-07T05:31:56Z"
}
],
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_period_count": 123,
"commitment_amount": "<string>",
"coupons": [
"<string>"
],
"credit_grants": [
{
"credits": "<string>",
"name": "<string>",
"addon_id": "<string>",
"conversion_rate": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"expiration_duration": 123,
"metadata": {},
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"topup_conversion_rate": "<string>"
}
],
"customer_id": "<string>",
"enable_true_up": true,
"end_date": "2023-11-07T05:31:56Z",
"external_customer_id": "<string>",
"gateway_payment_method_id": "<string>",
"inheritance": {
"external_customer_ids_to_inherit_subscription": [
"<string>"
],
"invoicing_customer_external_id": "<string>",
"parent_subscription_id": "<string>",
"subscriptions_ids_for_grouped_invoicing": [
"<string>"
]
},
"line_item_commitments": {},
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"override_entitlements": [
{
"entitlement_id": "<string>",
"config_value": {},
"is_enabled": true,
"static_value": "<string>",
"usage_limit": 123
}
],
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
}
}
],
"phases": [
{
"start_date": "2023-11-07T05:31:56Z",
"coupons": [
"<string>"
],
"end_date": "2023-11-07T05:31:56Z",
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"metadata": {},
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
}
}
],
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
]
}
],
"start_date": "2023-11-07T05:31:56Z",
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
],
"tax_rate_overrides": [
{
"currency": "<string>",
"tax_rate_code": "<string>",
"auto_apply": true,
"metadata": {},
"priority": 123
}
],
"timezone": "<string>",
"trial_period_days": 123
}
'import requests
url = "https://us.api.flexprice.io/v1/subscriptions"
payload = {
"currency": "<string>",
"plan_id": "<string>",
"addons": [
{
"addon_id": "<string>",
"line_item_commitments": {},
"metadata": {},
"start_date": "2023-11-07T05:31:56Z"
}
],
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_period_count": 123,
"commitment_amount": "<string>",
"coupons": ["<string>"],
"credit_grants": [
{
"credits": "<string>",
"name": "<string>",
"addon_id": "<string>",
"conversion_rate": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"expiration_duration": 123,
"metadata": {},
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"topup_conversion_rate": "<string>"
}
],
"customer_id": "<string>",
"enable_true_up": True,
"end_date": "2023-11-07T05:31:56Z",
"external_customer_id": "<string>",
"gateway_payment_method_id": "<string>",
"inheritance": {
"external_customer_ids_to_inherit_subscription": ["<string>"],
"invoicing_customer_external_id": "<string>",
"parent_subscription_id": "<string>",
"subscriptions_ids_for_grouped_invoicing": ["<string>"]
},
"line_item_commitments": {},
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": True
}
],
"commitment_true_up_enabled": True,
"commitment_windowed": True,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"override_entitlements": [
{
"entitlement_id": "<string>",
"config_value": {},
"is_enabled": True,
"static_value": "<string>",
"usage_limit": 123
}
],
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": { "divide_by": 123 }
}
],
"phases": [
{
"start_date": "2023-11-07T05:31:56Z",
"coupons": ["<string>"],
"end_date": "2023-11-07T05:31:56Z",
"line_item_coupons": {},
"line_items": [
{
"commitment_amount": 123,
"commitment_overage_factor": 123,
"commitment_quantity": 123,
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": True
}
],
"commitment_true_up_enabled": True,
"commitment_windowed": True,
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"metadata": {},
"price_id": "<string>",
"quantity": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_phase_id": "<string>"
}
],
"metadata": {},
"override_line_items": [
{
"price_id": "<string>",
"amount": "<string>",
"price_unit_amount": "<string>",
"price_unit_tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"quantity": "<string>",
"tiers": [
{
"unit_amount": "<string>",
"flat_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": { "divide_by": 123 }
}
],
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
]
}
],
"start_date": "2023-11-07T05:31:56Z",
"subscription_coupons": [
{
"coupon_code": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"price_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
],
"tax_rate_overrides": [
{
"currency": "<string>",
"tax_rate_code": "<string>",
"auto_apply": True,
"metadata": {},
"priority": 123
}
],
"timezone": "<string>",
"trial_period_days": 123
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: '<string>',
plan_id: '<string>',
addons: [
{
addon_id: '<string>',
line_item_commitments: {},
metadata: {},
start_date: '2023-11-07T05:31:56Z'
}
],
auto_invoice_threshold: '<string>',
billing_anchor: '2023-11-07T05:31:56Z',
billing_period_count: 123,
commitment_amount: '<string>',
coupons: ['<string>'],
credit_grants: [
{
credits: '<string>',
name: '<string>',
addon_id: '<string>',
conversion_rate: '<string>',
end_date: '2023-11-07T05:31:56Z',
expiration_duration: 123,
metadata: {},
period_count: 123,
plan_id: '<string>',
priority: 123,
start_date: '2023-11-07T05:31:56Z',
subscription_id: '<string>',
topup_conversion_rate: '<string>'
}
],
customer_id: '<string>',
enable_true_up: true,
end_date: '2023-11-07T05:31:56Z',
external_customer_id: '<string>',
gateway_payment_method_id: '<string>',
inheritance: {
external_customer_ids_to_inherit_subscription: ['<string>'],
invoicing_customer_external_id: '<string>',
parent_subscription_id: '<string>',
subscriptions_ids_for_grouped_invoicing: ['<string>']
},
line_item_commitments: {},
line_item_coupons: {},
line_items: [
{
commitment_amount: 123,
commitment_overage_factor: 123,
commitment_quantity: 123,
commitment_time_buckets: [
{
commitment_value: '<string>',
end: {hour: 12, minute: 29},
id: '<string>',
overage_factor: '<string>',
start: {hour: 12, minute: 29},
true_up_enabled: true
}
],
commitment_true_up_enabled: true,
commitment_windowed: true,
display_name: '<string>',
end_date: '2023-11-07T05:31:56Z',
metadata: {},
price_id: '<string>',
quantity: 123,
start_date: '2023-11-07T05:31:56Z',
subscription_phase_id: '<string>'
}
],
lookup_key: '<string>',
metadata: {},
overage_factor: '<string>',
override_entitlements: [
{
entitlement_id: '<string>',
config_value: {},
is_enabled: true,
static_value: '<string>',
usage_limit: 123
}
],
override_line_items: [
{
price_id: '<string>',
amount: '<string>',
price_unit_amount: '<string>',
price_unit_tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
quantity: '<string>',
tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
transform_quantity: {divide_by: 123}
}
],
phases: [
{
start_date: '2023-11-07T05:31:56Z',
coupons: ['<string>'],
end_date: '2023-11-07T05:31:56Z',
line_item_coupons: {},
line_items: [
{
commitment_amount: 123,
commitment_overage_factor: 123,
commitment_quantity: 123,
commitment_time_buckets: [
{
commitment_value: '<string>',
end: {hour: 12, minute: 29},
id: '<string>',
overage_factor: '<string>',
start: {hour: 12, minute: 29},
true_up_enabled: true
}
],
commitment_true_up_enabled: true,
commitment_windowed: true,
display_name: '<string>',
end_date: '2023-11-07T05:31:56Z',
metadata: {},
price_id: '<string>',
quantity: 123,
start_date: '2023-11-07T05:31:56Z',
subscription_phase_id: '<string>'
}
],
metadata: {},
override_line_items: [
{
price_id: '<string>',
amount: '<string>',
price_unit_amount: '<string>',
price_unit_tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
quantity: '<string>',
tiers: [{unit_amount: '<string>', flat_amount: '<string>', up_to: 123}],
transform_quantity: {divide_by: 123}
}
],
subscription_coupons: [
{
coupon_code: '<string>',
end_date: '2023-11-07T05:31:56Z',
price_id: '<string>',
start_date: '2023-11-07T05:31:56Z'
}
]
}
],
start_date: '2023-11-07T05:31:56Z',
subscription_coupons: [
{
coupon_code: '<string>',
end_date: '2023-11-07T05:31:56Z',
price_id: '<string>',
start_date: '2023-11-07T05:31:56Z'
}
],
tax_rate_overrides: [
{
currency: '<string>',
tax_rate_code: '<string>',
auto_apply: true,
metadata: {},
priority: 123
}
],
timezone: '<string>',
trial_period_days: 123
})
};
fetch('https://us.api.flexprice.io/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://us.api.flexprice.io/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([
'currency' => '<string>',
'plan_id' => '<string>',
'addons' => [
[
'addon_id' => '<string>',
'line_item_commitments' => [
],
'metadata' => [
],
'start_date' => '2023-11-07T05:31:56Z'
]
],
'auto_invoice_threshold' => '<string>',
'billing_anchor' => '2023-11-07T05:31:56Z',
'billing_period_count' => 123,
'commitment_amount' => '<string>',
'coupons' => [
'<string>'
],
'credit_grants' => [
[
'credits' => '<string>',
'name' => '<string>',
'addon_id' => '<string>',
'conversion_rate' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'expiration_duration' => 123,
'metadata' => [
],
'period_count' => 123,
'plan_id' => '<string>',
'priority' => 123,
'start_date' => '2023-11-07T05:31:56Z',
'subscription_id' => '<string>',
'topup_conversion_rate' => '<string>'
]
],
'customer_id' => '<string>',
'enable_true_up' => true,
'end_date' => '2023-11-07T05:31:56Z',
'external_customer_id' => '<string>',
'gateway_payment_method_id' => '<string>',
'inheritance' => [
'external_customer_ids_to_inherit_subscription' => [
'<string>'
],
'invoicing_customer_external_id' => '<string>',
'parent_subscription_id' => '<string>',
'subscriptions_ids_for_grouped_invoicing' => [
'<string>'
]
],
'line_item_commitments' => [
],
'line_item_coupons' => [
],
'line_items' => [
[
'commitment_amount' => 123,
'commitment_overage_factor' => 123,
'commitment_quantity' => 123,
'commitment_time_buckets' => [
[
'commitment_value' => '<string>',
'end' => [
'hour' => 12,
'minute' => 29
],
'id' => '<string>',
'overage_factor' => '<string>',
'start' => [
'hour' => 12,
'minute' => 29
],
'true_up_enabled' => true
]
],
'commitment_true_up_enabled' => true,
'commitment_windowed' => true,
'display_name' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'metadata' => [
],
'price_id' => '<string>',
'quantity' => 123,
'start_date' => '2023-11-07T05:31:56Z',
'subscription_phase_id' => '<string>'
]
],
'lookup_key' => '<string>',
'metadata' => [
],
'overage_factor' => '<string>',
'override_entitlements' => [
[
'entitlement_id' => '<string>',
'config_value' => [
],
'is_enabled' => true,
'static_value' => '<string>',
'usage_limit' => 123
]
],
'override_line_items' => [
[
'price_id' => '<string>',
'amount' => '<string>',
'price_unit_amount' => '<string>',
'price_unit_tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'quantity' => '<string>',
'tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'transform_quantity' => [
'divide_by' => 123
]
]
],
'phases' => [
[
'start_date' => '2023-11-07T05:31:56Z',
'coupons' => [
'<string>'
],
'end_date' => '2023-11-07T05:31:56Z',
'line_item_coupons' => [
],
'line_items' => [
[
'commitment_amount' => 123,
'commitment_overage_factor' => 123,
'commitment_quantity' => 123,
'commitment_time_buckets' => [
[
'commitment_value' => '<string>',
'end' => [
'hour' => 12,
'minute' => 29
],
'id' => '<string>',
'overage_factor' => '<string>',
'start' => [
'hour' => 12,
'minute' => 29
],
'true_up_enabled' => true
]
],
'commitment_true_up_enabled' => true,
'commitment_windowed' => true,
'display_name' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'metadata' => [
],
'price_id' => '<string>',
'quantity' => 123,
'start_date' => '2023-11-07T05:31:56Z',
'subscription_phase_id' => '<string>'
]
],
'metadata' => [
],
'override_line_items' => [
[
'price_id' => '<string>',
'amount' => '<string>',
'price_unit_amount' => '<string>',
'price_unit_tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'quantity' => '<string>',
'tiers' => [
[
'unit_amount' => '<string>',
'flat_amount' => '<string>',
'up_to' => 123
]
],
'transform_quantity' => [
'divide_by' => 123
]
]
],
'subscription_coupons' => [
[
'coupon_code' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'price_id' => '<string>',
'start_date' => '2023-11-07T05:31:56Z'
]
]
]
],
'start_date' => '2023-11-07T05:31:56Z',
'subscription_coupons' => [
[
'coupon_code' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'price_id' => '<string>',
'start_date' => '2023-11-07T05:31:56Z'
]
],
'tax_rate_overrides' => [
[
'currency' => '<string>',
'tax_rate_code' => '<string>',
'auto_apply' => true,
'metadata' => [
],
'priority' => 123
]
],
'timezone' => '<string>',
'trial_period_days' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://us.api.flexprice.io/v1/subscriptions"
payload := strings.NewReader("{\n \"currency\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"addons\": [\n {\n \"addon_id\": \"<string>\",\n \"line_item_commitments\": {},\n \"metadata\": {},\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"auto_invoice_threshold\": \"<string>\",\n \"billing_anchor\": \"2023-11-07T05:31:56Z\",\n \"billing_period_count\": 123,\n \"commitment_amount\": \"<string>\",\n \"coupons\": [\n \"<string>\"\n ],\n \"credit_grants\": [\n {\n \"credits\": \"<string>\",\n \"name\": \"<string>\",\n \"addon_id\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"expiration_duration\": 123,\n \"metadata\": {},\n \"period_count\": 123,\n \"plan_id\": \"<string>\",\n \"priority\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_id\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"enable_true_up\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"external_customer_id\": \"<string>\",\n \"gateway_payment_method_id\": \"<string>\",\n \"inheritance\": {\n \"external_customer_ids_to_inherit_subscription\": [\n \"<string>\"\n ],\n \"invoicing_customer_external_id\": \"<string>\",\n \"parent_subscription_id\": \"<string>\",\n \"subscriptions_ids_for_grouped_invoicing\": [\n \"<string>\"\n ]\n },\n \"line_item_commitments\": {},\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"overage_factor\": \"<string>\",\n \"override_entitlements\": [\n {\n \"entitlement_id\": \"<string>\",\n \"config_value\": {},\n \"is_enabled\": true,\n \"static_value\": \"<string>\",\n \"usage_limit\": 123\n }\n ],\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"phases\": [\n {\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"coupons\": [\n \"<string>\"\n ],\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ]\n }\n ],\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"tax_rate_overrides\": [\n {\n \"currency\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"auto_apply\": true,\n \"metadata\": {},\n \"priority\": 123\n }\n ],\n \"timezone\": \"<string>\",\n \"trial_period_days\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://us.api.flexprice.io/v1/subscriptions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"addons\": [\n {\n \"addon_id\": \"<string>\",\n \"line_item_commitments\": {},\n \"metadata\": {},\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"auto_invoice_threshold\": \"<string>\",\n \"billing_anchor\": \"2023-11-07T05:31:56Z\",\n \"billing_period_count\": 123,\n \"commitment_amount\": \"<string>\",\n \"coupons\": [\n \"<string>\"\n ],\n \"credit_grants\": [\n {\n \"credits\": \"<string>\",\n \"name\": \"<string>\",\n \"addon_id\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"expiration_duration\": 123,\n \"metadata\": {},\n \"period_count\": 123,\n \"plan_id\": \"<string>\",\n \"priority\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_id\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"enable_true_up\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"external_customer_id\": \"<string>\",\n \"gateway_payment_method_id\": \"<string>\",\n \"inheritance\": {\n \"external_customer_ids_to_inherit_subscription\": [\n \"<string>\"\n ],\n \"invoicing_customer_external_id\": \"<string>\",\n \"parent_subscription_id\": \"<string>\",\n \"subscriptions_ids_for_grouped_invoicing\": [\n \"<string>\"\n ]\n },\n \"line_item_commitments\": {},\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"overage_factor\": \"<string>\",\n \"override_entitlements\": [\n {\n \"entitlement_id\": \"<string>\",\n \"config_value\": {},\n \"is_enabled\": true,\n \"static_value\": \"<string>\",\n \"usage_limit\": 123\n }\n ],\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"phases\": [\n {\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"coupons\": [\n \"<string>\"\n ],\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ]\n }\n ],\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"tax_rate_overrides\": [\n {\n \"currency\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"auto_apply\": true,\n \"metadata\": {},\n \"priority\": 123\n }\n ],\n \"timezone\": \"<string>\",\n \"trial_period_days\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"addons\": [\n {\n \"addon_id\": \"<string>\",\n \"line_item_commitments\": {},\n \"metadata\": {},\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"auto_invoice_threshold\": \"<string>\",\n \"billing_anchor\": \"2023-11-07T05:31:56Z\",\n \"billing_period_count\": 123,\n \"commitment_amount\": \"<string>\",\n \"coupons\": [\n \"<string>\"\n ],\n \"credit_grants\": [\n {\n \"credits\": \"<string>\",\n \"name\": \"<string>\",\n \"addon_id\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"expiration_duration\": 123,\n \"metadata\": {},\n \"period_count\": 123,\n \"plan_id\": \"<string>\",\n \"priority\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_id\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"enable_true_up\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"external_customer_id\": \"<string>\",\n \"gateway_payment_method_id\": \"<string>\",\n \"inheritance\": {\n \"external_customer_ids_to_inherit_subscription\": [\n \"<string>\"\n ],\n \"invoicing_customer_external_id\": \"<string>\",\n \"parent_subscription_id\": \"<string>\",\n \"subscriptions_ids_for_grouped_invoicing\": [\n \"<string>\"\n ]\n },\n \"line_item_commitments\": {},\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"overage_factor\": \"<string>\",\n \"override_entitlements\": [\n {\n \"entitlement_id\": \"<string>\",\n \"config_value\": {},\n \"is_enabled\": true,\n \"static_value\": \"<string>\",\n \"usage_limit\": 123\n }\n ],\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"phases\": [\n {\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"coupons\": [\n \"<string>\"\n ],\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"line_item_coupons\": {},\n \"line_items\": [\n {\n \"commitment_amount\": 123,\n \"commitment_overage_factor\": 123,\n \"commitment_quantity\": 123,\n \"commitment_time_buckets\": [\n {\n \"commitment_value\": \"<string>\",\n \"end\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"id\": \"<string>\",\n \"overage_factor\": \"<string>\",\n \"start\": {\n \"hour\": 12,\n \"minute\": 29\n },\n \"true_up_enabled\": true\n }\n ],\n \"commitment_true_up_enabled\": true,\n \"commitment_windowed\": true,\n \"display_name\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"price_id\": \"<string>\",\n \"quantity\": 123,\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_phase_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"override_line_items\": [\n {\n \"price_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"price_unit_amount\": \"<string>\",\n \"price_unit_tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"quantity\": \"<string>\",\n \"tiers\": [\n {\n \"unit_amount\": \"<string>\",\n \"flat_amount\": \"<string>\",\n \"up_to\": 123\n }\n ],\n \"transform_quantity\": {\n \"divide_by\": 123\n }\n }\n ],\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ]\n }\n ],\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"subscription_coupons\": [\n {\n \"coupon_code\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"price_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"tax_rate_overrides\": [\n {\n \"currency\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"auto_apply\": true,\n \"metadata\": {},\n \"priority\": 123\n }\n ],\n \"timezone\": \"<string>\",\n \"trial_period_days\": 123\n}"
response = http.request(request)
puts response.read_body{
"active_pause_id": "<string>",
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"cancelled_at": "2023-11-07T05:31:56Z",
"collection_method": "<string>",
"commitment_amount": "<string>",
"coupon_associations": [
{
"coupon": {
"amount_off": "<string>",
"coupon_code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"duration_in_periods": 123,
"environment_id": "<string>",
"id": "<string>",
"max_redemptions": 123,
"metadata": {},
"name": "<string>",
"percentage_off": "<string>",
"redeem_after": "<string>",
"redeem_before": "<string>",
"rules": {},
"tenant_id": "<string>",
"total_redemptions": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"coupon_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_line_item": {
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": 123,
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"event_name": "<string>",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "<string>",
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"entitlements": [
{
"addon": "<unknown>",
"config_value": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"display_order": 123,
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": "<string>"
},
"info": {
"threshold": "<string>"
},
"warning": {
"threshold": "<string>"
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"id": "<string>",
"is_enabled": true,
"is_soft_limit": true,
"parent_entitlement_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"static_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_limit": 123
}
],
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"subscription_line_item_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"currency": "<string>",
"current_period_end": "2023-11-07T05:31:56Z",
"current_period_start": "2023-11-07T05:31:56Z",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"contact": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"timezone": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"enable_true_up": true,
"end_date": "2023-11-07T05:31:56Z",
"entitlements": [
{
"entitlement": {
"config_values": [
{}
],
"is_enabled": true,
"is_soft_limit": true,
"static_values": [
"<string>"
],
"usage_limit": 123
},
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": "<string>"
},
"info": {
"threshold": "<string>"
},
"warning": {
"threshold": "<string>"
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"sources": [
{
"config_value": {},
"entitlement_id": "<string>",
"entity_id": "<string>",
"entity_name": "<string>",
"is_enabled": true,
"quantity": 123,
"static_value": "<string>",
"subscription_id": "<string>",
"usage_limit": 123
}
]
}
],
"environment_id": "<string>",
"gateway_payment_method_id": "<string>",
"id": "<string>",
"invoicing_customer_id": "<string>",
"latest_invoice": {
"adjustment_amount": "<string>",
"amount_due": "<string>",
"amount_paid": "<string>",
"amount_remaining": "<string>",
"billing_period": "<string>",
"billing_reason": "<string>",
"billing_sequence": 123,
"coupon_applications": [
{
"applied_at": "2023-11-07T05:31:56Z",
"coupon_association_id": "<string>",
"coupon_id": "<string>",
"coupon_snapshot": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"discount_percentage": "<string>",
"discounted_amount": "<string>",
"environment_id": "<string>",
"final_price": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_line_item_id": "<string>",
"metadata": {},
"original_price": "<string>",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"contact": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"timezone": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"description": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"finalized_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"idempotency_key": "<string>",
"invoice_number": "<string>",
"invoice_pdf_url": "<string>",
"issue_date": "2023-11-07T05:31:56Z",
"last_computed_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"adjusted_entitlement_quantity": "<string>",
"amount": "<string>",
"commitment_info": {
"amount": "<string>",
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"is_windowed": true,
"overage_factor": "<string>",
"quantity": "<string>",
"true_up_enabled": true
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"entity_id": "<string>",
"entity_type": "<string>",
"environment_id": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_level_discount": "<string>",
"line_item_discount": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"plan_display_name": "<string>",
"prepaid_credits_applied": "<string>",
"price_id": "<string>",
"price_type": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"subscription_id": "<string>",
"subscription_line_item_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_analytics": [
{
"cost": "<string>",
"event_count": 123,
"percentage": "<string>",
"source": "<string>",
"usage": "<string>"
}
],
"usage_breakdown": [
{
"cost": "<string>",
"event_count": 123,
"grouped_by": {},
"percentage": "<string>",
"usage": "<string>"
}
]
}
],
"metadata": {},
"overpaid_amount": "<string>",
"paid_at": "2023-11-07T05:31:56Z",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"recalculated_invoice_id": "<string>",
"refunded_amount": "<string>",
"subscription": "<unknown>",
"subscription_customer_id": "<string>",
"subscription_id": "<string>",
"subtotal": "<string>",
"taxes": [
{
"applied_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"tax_amount": "<string>",
"tax_association_id": "<string>",
"tax_rate": {
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"fixed_value": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"percentage_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"tax_rate_id": "<string>",
"taxable_amount": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"total": "<string>",
"total_discount": "<string>",
"total_prepaid_credits_applied": "<string>",
"total_tax": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123,
"voided_at": "2023-11-07T05:31:56Z"
},
"line_items": [
{
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": 123,
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"event_name": "<string>",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "<string>",
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"parent_subscription_id": "<string>",
"pauses": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"original_period_end": "2023-11-07T05:31:56Z",
"original_period_start": "2023-11-07T05:31:56Z",
"pause_end": "2023-11-07T05:31:56Z",
"pause_start": "2023-11-07T05:31:56Z",
"reason": "<string>",
"resumed_at": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"payment_behavior": "<string>",
"phases": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"addon_id": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"synced_price_sequence": 123,
"tenant_id": "<string>",
"timezone": "<string>",
"trial_end": "2023-11-07T05:31:56Z",
"trial_start": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
Subscription Request
MONTHLY, ANNUAL, WEEKLY, DAILY, QUARTERLY, HALF_YEARLY, ONETIME Addons represents addons to be added to the subscription during creation
Show child attributes
Show child attributes
AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers an intermediate invoice mid-period. Set once at creation; cannot be changed later. Allowed only when the subscription resolves to type standalone (no parent hierarchy rows). Plan line items must be usage-based only (no fixed or other non-usage plan prices). Nil means auto invoice threshold billing is disabled for this subscription.
BillingAnchor overrides the derived billing anchor when billing_cycle is anniversary. For monthly billing, the day-of-month (and time-of-day) define cycle boundaries: if start_date is before that day in the month, the first billing period ends on the next occurrence of that day in the same month (a shorter first period); subsequent periods follow the usual interval.
anniversary, calendar charge_automatically, send_invoice CommitmentAmount is the minimum amount a customer commits to paying for a billing period
MONTHLY, ANNUAL, WEEKLY, DAILY, QUARTERLY, HALF_YEARLY, ONETIME Deprecated: use SubscriptionCoupons instead.
Credit grants to be applied when subscription is created
Show child attributes
Show child attributes
customer_id is the flexprice customer id and it is prioritized over external_customer_id in case both are provided.
Enable Commitment True Up Fee
external_customer_id is the customer id in your DB and must be same as what you provided as external_id while creating the customer in flexprice.
Show child attributes
Show child attributes
LineItemCommitments allows setting commitment configuration per line item (keyed by price_id)
Show child attributes
Show child attributes
Deprecated: use SubscriptionCoupons instead.
Show child attributes
Show child attributes
LineItems are extra line items to add at creation (each with price_id or price), in addition to plan prices
Show child attributes
Show child attributes
Show child attributes
Show child attributes
OverageFactor is a multiplier applied to usage beyond the commitment amount
OverrideEntitlements allows customizing specific entitlements for this subscription
Show child attributes
Show child attributes
OverrideLineItems allows customizing specific prices for this subscription
Show child attributes
Show child attributes
allow_incomplete, default_incomplete, error_if_incomplete, default_active 15 NET, 30 NET, 45 NET, 60 NET, 75 NET, 90 NET Phases represents subscription phases to be created with the subscription
Show child attributes
Show child attributes
create_prorations, none SubscriptionCoupons is the preferred way to attach coupons at creation. Accepts coupon_code; optionally targets a line item via price_id.
Show child attributes
Show child attributes
active, paused, cancelled, incomplete, trialing, draft tax_rate_overrides is the tax rate overrides to be applied to the subscription
Show child attributes
Show child attributes
Timezone of the customer. If not set, the default value is UTC.
TrialPeriodDays: nil = inherit trial length from plan recurring-fixed prices (must be uniform). 0 = explicitly no trial (overrides catalog). >0 = override duration in days.
Response
Created
ActivePauseID references the current active pause configuration This will be null if no pause is active or scheduled
AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers an intermediate invoice. Overrides the plan-level threshold when set. Nil means: inherit from the plan's threshold (which may also be nil = disabled).
BillingAnchor is the reference point that aligns future billing cycle dates. It sets the day of week for week intervals, the day of month for month and year intervals, and the month of year for year intervals. The timestamp is in UTC format.
RECURRING anniversary, calendar MONTHLY, ANNUAL, WEEKLY, DAILY, QUARTERLY, HALF_YEARLY, ONETIME BillingPeriodCount is the total number units of the billing period.
CancelAt is the date the subscription will be canceled
CancelAtPeriodEnd is whether the subscription was canceled at the end of the current period
CanceledAt is the date the subscription was canceled
CollectionMethod determines how invoices are collected
CommitmentAmount is the minimum amount a customer commits to paying for a billing period
MONTHLY, ANNUAL, WEEKLY, DAILY, QUARTERLY, HALF_YEARLY, ONETIME CouponAssociations are the coupon associations for this subscription
Show child attributes
Show child attributes
Credit grants are the credit grants for this subscription
Show child attributes
Show child attributes
Currency is the currency of the subscription in lowercase 3 digit ISO codes
CurrentPeriodEnd is the end of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.
CurrentPeriodStart is the end of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.
Customer response object containing all customer information
Show child attributes
Show child attributes
CustomerID is the identifier for the customer in our system
EndDate is the end date of the subscription
Entitlements is populated only when the caller adds "entitlements" to the search filter's expand string. Each entry is a feature with its aggregated entitlement info (same shape as CustomerEntitlementsResponse.Features).
Show child attributes
Show child attributes
EnvironmentID is the environment identifier for the subscription
GatewayPaymentMethodID is the gateway payment method ID for this subscription
ID is the unique identifier for the subscription
InvoicingCustomerID is the customer ID to use for invoicing This can differ from the subscription customer (e.g., parent company invoicing for child company)
Show child attributes
Show child attributes
Show child attributes
Show child attributes
LookupKey is the key used to lookup the subscription in our system
Show child attributes
Show child attributes
OverageFactor is a multiplier applied to usage beyond the commitment amount
ParentSubscriptionID is the parent subscription ID for hierarchy (e.g. child subscription under a parent)
none, active, scheduled, completed, cancelled Show child attributes
Show child attributes
PaymentBehavior determines how subscription payments are handled
15 NET, 30 NET, 45 NET, 60 NET, 75 NET, 90 NET Phases are the subscription phases for this subscription
Show child attributes
Show child attributes
Show child attributes
Show child attributes
PlanID is the identifier for the plan in our system
create_prorations, none StartDate is the start date of the subscription
published, deleted, archived active, paused, cancelled, incomplete, trialing, draft standalone, delegated_invoicing, parent, inherited, grouped_invoicing SyncedPriceSequence is the plan-price sequence up to which this subscription's line items have been reconciled. Bumped by the plan-price sync after a successful pass.
TrialEnd is the end date of the trial period
TrialStart is the start date of the trial period
Version is used for optimistic locking

