cURL
curl --request POST \
--url https://api.example.com/v2/billing-plans/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"is_active": true,
"progressive_billing_threshold": "<string>",
"grace_period_hours": -1,
"late_ticket_grace_period_hours": -1,
"progressive_grace_period_hours": -1,
"payment_due_hours": -1,
"effective_date": "2023-12-25",
"payment_instructions": "<string>",
"charges": [
{
"description": "<string>",
"amount": "<string>",
"id": 123,
"filters": "<unknown>",
"source_type": "<string>",
"order": 1073741823,
"display_aggregated_value": true,
"display_rate_value": true
}
]
}
'import requests
url = "https://api.example.com/v2/billing-plans/"
payload = {
"name": "<string>",
"is_active": True,
"progressive_billing_threshold": "<string>",
"grace_period_hours": -1,
"late_ticket_grace_period_hours": -1,
"progressive_grace_period_hours": -1,
"payment_due_hours": -1,
"effective_date": "2023-12-25",
"payment_instructions": "<string>",
"charges": [
{
"description": "<string>",
"amount": "<string>",
"id": 123,
"filters": "<unknown>",
"source_type": "<string>",
"order": 1073741823,
"display_aggregated_value": True,
"display_rate_value": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
is_active: true,
progressive_billing_threshold: '<string>',
grace_period_hours: -1,
late_ticket_grace_period_hours: -1,
progressive_grace_period_hours: -1,
payment_due_hours: -1,
effective_date: '2023-12-25',
payment_instructions: '<string>',
charges: [
{
description: '<string>',
amount: '<string>',
id: 123,
filters: '<unknown>',
source_type: '<string>',
order: 1073741823,
display_aggregated_value: true,
display_rate_value: true
}
]
})
};
fetch('https://api.example.com/v2/billing-plans/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v2/billing-plans/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'is_active' => true,
'progressive_billing_threshold' => '<string>',
'grace_period_hours' => -1,
'late_ticket_grace_period_hours' => -1,
'progressive_grace_period_hours' => -1,
'payment_due_hours' => -1,
'effective_date' => '2023-12-25',
'payment_instructions' => '<string>',
'charges' => [
[
'description' => '<string>',
'amount' => '<string>',
'id' => 123,
'filters' => '<unknown>',
'source_type' => '<string>',
'order' => 1073741823,
'display_aggregated_value' => true,
'display_rate_value' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v2/billing-plans/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"is_active\": true,\n \"progressive_billing_threshold\": \"<string>\",\n \"grace_period_hours\": -1,\n \"late_ticket_grace_period_hours\": -1,\n \"progressive_grace_period_hours\": -1,\n \"payment_due_hours\": -1,\n \"effective_date\": \"2023-12-25\",\n \"payment_instructions\": \"<string>\",\n \"charges\": [\n {\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"id\": 123,\n \"filters\": \"<unknown>\",\n \"source_type\": \"<string>\",\n \"order\": 1073741823,\n \"display_aggregated_value\": true,\n \"display_rate_value\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v2/billing-plans/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"is_active\": true,\n \"progressive_billing_threshold\": \"<string>\",\n \"grace_period_hours\": -1,\n \"late_ticket_grace_period_hours\": -1,\n \"progressive_grace_period_hours\": -1,\n \"payment_due_hours\": -1,\n \"effective_date\": \"2023-12-25\",\n \"payment_instructions\": \"<string>\",\n \"charges\": [\n {\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"id\": 123,\n \"filters\": \"<unknown>\",\n \"source_type\": \"<string>\",\n \"order\": 1073741823,\n \"display_aggregated_value\": true,\n \"display_rate_value\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/billing-plans/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"is_active\": true,\n \"progressive_billing_threshold\": \"<string>\",\n \"grace_period_hours\": -1,\n \"late_ticket_grace_period_hours\": -1,\n \"progressive_grace_period_hours\": -1,\n \"payment_due_hours\": -1,\n \"effective_date\": \"2023-12-25\",\n \"payment_instructions\": \"<string>\",\n \"charges\": [\n {\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"id\": 123,\n \"filters\": \"<unknown>\",\n \"source_type\": \"<string>\",\n \"order\": 1073741823,\n \"display_aggregated_value\": true,\n \"display_rate_value\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"fleet": 123,
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"is_active": true,
"progressive_billing_threshold": "<string>",
"grace_period_hours": -1,
"late_ticket_grace_period_hours": -1,
"progressive_grace_period_hours": -1,
"payment_due_hours": -1,
"effective_date": "2023-12-25",
"payment_instructions": "<string>",
"charges": [
{
"description": "<string>",
"aggregation_type": "count",
"amount": "<string>",
"id": 123,
"aggregation_field": "amount",
"filters": "<unknown>",
"source_type": "<string>",
"order": 1073741823,
"display_aggregated_value": true,
"display_rate_value": true
}
]
}Billing Plans
Create Billing Plan
Create a billing plan with its charges.
POST
/
v2
/
billing-plans
/
cURL
curl --request POST \
--url https://api.example.com/v2/billing-plans/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"is_active": true,
"progressive_billing_threshold": "<string>",
"grace_period_hours": -1,
"late_ticket_grace_period_hours": -1,
"progressive_grace_period_hours": -1,
"payment_due_hours": -1,
"effective_date": "2023-12-25",
"payment_instructions": "<string>",
"charges": [
{
"description": "<string>",
"amount": "<string>",
"id": 123,
"filters": "<unknown>",
"source_type": "<string>",
"order": 1073741823,
"display_aggregated_value": true,
"display_rate_value": true
}
]
}
'import requests
url = "https://api.example.com/v2/billing-plans/"
payload = {
"name": "<string>",
"is_active": True,
"progressive_billing_threshold": "<string>",
"grace_period_hours": -1,
"late_ticket_grace_period_hours": -1,
"progressive_grace_period_hours": -1,
"payment_due_hours": -1,
"effective_date": "2023-12-25",
"payment_instructions": "<string>",
"charges": [
{
"description": "<string>",
"amount": "<string>",
"id": 123,
"filters": "<unknown>",
"source_type": "<string>",
"order": 1073741823,
"display_aggregated_value": True,
"display_rate_value": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
is_active: true,
progressive_billing_threshold: '<string>',
grace_period_hours: -1,
late_ticket_grace_period_hours: -1,
progressive_grace_period_hours: -1,
payment_due_hours: -1,
effective_date: '2023-12-25',
payment_instructions: '<string>',
charges: [
{
description: '<string>',
amount: '<string>',
id: 123,
filters: '<unknown>',
source_type: '<string>',
order: 1073741823,
display_aggregated_value: true,
display_rate_value: true
}
]
})
};
fetch('https://api.example.com/v2/billing-plans/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v2/billing-plans/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'is_active' => true,
'progressive_billing_threshold' => '<string>',
'grace_period_hours' => -1,
'late_ticket_grace_period_hours' => -1,
'progressive_grace_period_hours' => -1,
'payment_due_hours' => -1,
'effective_date' => '2023-12-25',
'payment_instructions' => '<string>',
'charges' => [
[
'description' => '<string>',
'amount' => '<string>',
'id' => 123,
'filters' => '<unknown>',
'source_type' => '<string>',
'order' => 1073741823,
'display_aggregated_value' => true,
'display_rate_value' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v2/billing-plans/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"is_active\": true,\n \"progressive_billing_threshold\": \"<string>\",\n \"grace_period_hours\": -1,\n \"late_ticket_grace_period_hours\": -1,\n \"progressive_grace_period_hours\": -1,\n \"payment_due_hours\": -1,\n \"effective_date\": \"2023-12-25\",\n \"payment_instructions\": \"<string>\",\n \"charges\": [\n {\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"id\": 123,\n \"filters\": \"<unknown>\",\n \"source_type\": \"<string>\",\n \"order\": 1073741823,\n \"display_aggregated_value\": true,\n \"display_rate_value\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v2/billing-plans/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"is_active\": true,\n \"progressive_billing_threshold\": \"<string>\",\n \"grace_period_hours\": -1,\n \"late_ticket_grace_period_hours\": -1,\n \"progressive_grace_period_hours\": -1,\n \"payment_due_hours\": -1,\n \"effective_date\": \"2023-12-25\",\n \"payment_instructions\": \"<string>\",\n \"charges\": [\n {\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"id\": 123,\n \"filters\": \"<unknown>\",\n \"source_type\": \"<string>\",\n \"order\": 1073741823,\n \"display_aggregated_value\": true,\n \"display_rate_value\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/billing-plans/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"is_active\": true,\n \"progressive_billing_threshold\": \"<string>\",\n \"grace_period_hours\": -1,\n \"late_ticket_grace_period_hours\": -1,\n \"progressive_grace_period_hours\": -1,\n \"payment_due_hours\": -1,\n \"effective_date\": \"2023-12-25\",\n \"payment_instructions\": \"<string>\",\n \"charges\": [\n {\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"id\": 123,\n \"filters\": \"<unknown>\",\n \"source_type\": \"<string>\",\n \"order\": 1073741823,\n \"display_aggregated_value\": true,\n \"display_rate_value\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"fleet": 123,
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"is_active": true,
"progressive_billing_threshold": "<string>",
"grace_period_hours": -1,
"late_ticket_grace_period_hours": -1,
"progressive_grace_period_hours": -1,
"payment_due_hours": -1,
"effective_date": "2023-12-25",
"payment_instructions": "<string>",
"charges": [
{
"description": "<string>",
"aggregation_type": "count",
"amount": "<string>",
"id": 123,
"aggregation_field": "amount",
"filters": "<unknown>",
"source_type": "<string>",
"order": 1073741823,
"display_aggregated_value": true,
"display_rate_value": true
}
]
}Authorizations
JWTAPIKey
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Response
201 - application/json
Was this page helpful?

