curl --request POST \
--url https://api.salesbricks.com/api/v2/subscriptions/estimate \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"starts_at": "2023-12-25",
"contract_length": 2,
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bricks": [
{
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"discount": [
{
"rate": "<string>",
"amount": 123,
"renews": false
}
]
}
],
"currency": "USD",
"discount_coupons": [
"<string>"
]
}
'import requests
url = "https://api.salesbricks.com/api/v2/subscriptions/estimate"
payload = {
"starts_at": "2023-12-25",
"contract_length": 2,
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bricks": [
{
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"discount": [
{
"rate": "<string>",
"amount": 123,
"renews": False
}
]
}
],
"currency": "USD",
"discount_coupons": ["<string>"]
}
headers = {
"X-SALESBRICKS-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SALESBRICKS-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
starts_at: '2023-12-25',
contract_length: 2,
plan_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bricks: [
{
brick_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 123,
discount: [{rate: '<string>', amount: 123, renews: false}]
}
],
currency: 'USD',
discount_coupons: ['<string>']
})
};
fetch('https://api.salesbricks.com/api/v2/subscriptions/estimate', 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.salesbricks.com/api/v2/subscriptions/estimate",
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([
'starts_at' => '2023-12-25',
'contract_length' => 2,
'plan_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bricks' => [
[
'brick_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123,
'discount' => [
[
'rate' => '<string>',
'amount' => 123,
'renews' => false
]
]
]
],
'currency' => 'USD',
'discount_coupons' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SALESBRICKS-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://api.salesbricks.com/api/v2/subscriptions/estimate"
payload := strings.NewReader("{\n \"starts_at\": \"2023-12-25\",\n \"contract_length\": 2,\n \"plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bricks\": [\n {\n \"brick_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"discount\": [\n {\n \"rate\": \"<string>\",\n \"amount\": 123,\n \"renews\": false\n }\n ]\n }\n ],\n \"currency\": \"USD\",\n \"discount_coupons\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SALESBRICKS-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://api.salesbricks.com/api/v2/subscriptions/estimate")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"starts_at\": \"2023-12-25\",\n \"contract_length\": 2,\n \"plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bricks\": [\n {\n \"brick_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"discount\": [\n {\n \"rate\": \"<string>\",\n \"amount\": 123,\n \"renews\": false\n }\n ]\n }\n ],\n \"currency\": \"USD\",\n \"discount_coupons\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/subscriptions/estimate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"starts_at\": \"2023-12-25\",\n \"contract_length\": 2,\n \"plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bricks\": [\n {\n \"brick_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"discount\": [\n {\n \"rate\": \"<string>\",\n \"amount\": 123,\n \"renews\": false\n }\n ]\n }\n ],\n \"currency\": \"USD\",\n \"discount_coupons\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"ends_at": "2023-12-25",
"sub_total": 123,
"grand_total": 123,
"line_items": [
{
"quantity": 123,
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brick_name": "<string>",
"sub_total": 123,
"plan_id": "<string>",
"plan_name": "<string>",
"grand_total": "<string>",
"grand_total_details": "<string>",
"tiers_breakdown": [
{
"quantity": 0,
"unit_price": "<string>",
"sub_total": "<string>",
"duration_text": "<string>"
}
],
"pre_commitment_schedule": "<string>",
"discount": [
{
"rate": "<string>",
"amount": 123,
"renews": false
}
]
}
],
"billing_schedule": [
{
"starts_at": "<string>",
"ends_at": "<string>",
"sub_total": 123,
"grand_total": "<string>",
"grand_total_details": "<string>"
}
],
"grand_total_details": "<unknown>"
}{
"error": {
"code": "ERR_BAD_REQUEST",
"message": "Bad request — the input payload is malformed, missing required fields, or contains invalid data."
}
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Not found — the resource you are looking for does not exist."
}
}Estimate a subscription
Gets a pricing estimate for a subscription including the billing schedule and grand total.
curl --request POST \
--url https://api.salesbricks.com/api/v2/subscriptions/estimate \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"starts_at": "2023-12-25",
"contract_length": 2,
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bricks": [
{
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"discount": [
{
"rate": "<string>",
"amount": 123,
"renews": false
}
]
}
],
"currency": "USD",
"discount_coupons": [
"<string>"
]
}
'import requests
url = "https://api.salesbricks.com/api/v2/subscriptions/estimate"
payload = {
"starts_at": "2023-12-25",
"contract_length": 2,
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bricks": [
{
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"discount": [
{
"rate": "<string>",
"amount": 123,
"renews": False
}
]
}
],
"currency": "USD",
"discount_coupons": ["<string>"]
}
headers = {
"X-SALESBRICKS-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SALESBRICKS-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
starts_at: '2023-12-25',
contract_length: 2,
plan_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bricks: [
{
brick_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 123,
discount: [{rate: '<string>', amount: 123, renews: false}]
}
],
currency: 'USD',
discount_coupons: ['<string>']
})
};
fetch('https://api.salesbricks.com/api/v2/subscriptions/estimate', 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.salesbricks.com/api/v2/subscriptions/estimate",
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([
'starts_at' => '2023-12-25',
'contract_length' => 2,
'plan_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bricks' => [
[
'brick_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123,
'discount' => [
[
'rate' => '<string>',
'amount' => 123,
'renews' => false
]
]
]
],
'currency' => 'USD',
'discount_coupons' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SALESBRICKS-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://api.salesbricks.com/api/v2/subscriptions/estimate"
payload := strings.NewReader("{\n \"starts_at\": \"2023-12-25\",\n \"contract_length\": 2,\n \"plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bricks\": [\n {\n \"brick_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"discount\": [\n {\n \"rate\": \"<string>\",\n \"amount\": 123,\n \"renews\": false\n }\n ]\n }\n ],\n \"currency\": \"USD\",\n \"discount_coupons\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SALESBRICKS-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://api.salesbricks.com/api/v2/subscriptions/estimate")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"starts_at\": \"2023-12-25\",\n \"contract_length\": 2,\n \"plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bricks\": [\n {\n \"brick_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"discount\": [\n {\n \"rate\": \"<string>\",\n \"amount\": 123,\n \"renews\": false\n }\n ]\n }\n ],\n \"currency\": \"USD\",\n \"discount_coupons\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/subscriptions/estimate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"starts_at\": \"2023-12-25\",\n \"contract_length\": 2,\n \"plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bricks\": [\n {\n \"brick_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"discount\": [\n {\n \"rate\": \"<string>\",\n \"amount\": 123,\n \"renews\": false\n }\n ]\n }\n ],\n \"currency\": \"USD\",\n \"discount_coupons\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"ends_at": "2023-12-25",
"sub_total": 123,
"grand_total": 123,
"line_items": [
{
"quantity": 123,
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brick_name": "<string>",
"sub_total": 123,
"plan_id": "<string>",
"plan_name": "<string>",
"grand_total": "<string>",
"grand_total_details": "<string>",
"tiers_breakdown": [
{
"quantity": 0,
"unit_price": "<string>",
"sub_total": "<string>",
"duration_text": "<string>"
}
],
"pre_commitment_schedule": "<string>",
"discount": [
{
"rate": "<string>",
"amount": 123,
"renews": false
}
]
}
],
"billing_schedule": [
{
"starts_at": "<string>",
"ends_at": "<string>",
"sub_total": 123,
"grand_total": "<string>",
"grand_total_details": "<string>"
}
],
"grand_total_details": "<unknown>"
}{
"error": {
"code": "ERR_BAD_REQUEST",
"message": "Bad request — the input payload is malformed, missing required fields, or contains invalid data."
}
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Not found — the resource you are looking for does not exist."
}
}Authorizations
API key for authentication
Body
Subscription estimate input serializer for generating a pricing estimate.
The start date of the subscription.
The length of the contract in months.
x >= 1The billing frequency
MONTHLY- MonthlyQUARTERLY- QuarterlySEMI_ANNUALLY- Semi-annuallyANNUALLY- AnnuallyALL_UPFRONT- All upfront
MONTHLY, QUARTERLY, SEMI_ANNUALLY, ANNUALLY, ALL_UPFRONT The ID of the plan.
The bricks included in the subscription.
Show child attributes
Show child attributes
Optional currency to be used for the subscription. Defaults to USD.
USD- United States DollarEUR- EurosGBP- Great British PoundAUD- Australian DollarCAD- Canadian DollarINR- Indian Rupee
USD, EUR, GBP, AUD, CAD, INR Discount coupon codes to apply to the subscription. Currently only supports one discount coupon - only the first one in the list will be applied.
Response
Subscription /estimate output serializer from OrderPricing
The end date of the subscription
Subtotal before taxes and discounts
Final total after taxes and discounts
The line items of the subscription
Show child attributes
Show child attributes
The billing schedule of the subscription
Show child attributes
Show child attributes
Breakdown containing total discount and tax amounts