Create Checkout Session
Create a customer-specific checkout session link to purchase a set of plans
curl --request POST \
--url https://api.getmeasure.com/api/v1/companies/{company_id}/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"config_items": [
{
"hide_at_checkout": true,
"minimum_units": 1,
"num_licenses": 1,
"product_metric_pricing_id": "<string>",
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": true,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123,
"upsell_product_metric_pricing_id": "<string>"
}
],
"customer_id": "<string>",
"type": "CHECKOUT_SESSION",
"auto_charges": true,
"auto_renews": true,
"bundle_pricing_id": "<string>",
"change_reset_billing_anchor": true,
"discounts": [
{
"name": "<string>",
"amount": {
"currency": "<string>",
"value_in_cents": 123
},
"cap": {
"currency": "<string>",
"value_in_cents": 123
},
"coupon_id": "<string>",
"customer_id": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"import_created_at_ref": "2023-11-07T05:31:56Z",
"import_ref": "<string>",
"imported_from": "<string>",
"item_pricing_id": "<string>",
"onetime_billable_id": "<string>",
"percent": 0.5,
"product_id": "<string>",
"product_pricing_id": "<string>",
"proposal_id": "<string>",
"subscription_id": "<string>"
}
],
"metadata": {},
"onetime_items": [
{
"aggregate": 123,
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": true,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123
}
],
"options": {
"allow_promo_code": true,
"confirmation_message": "<string>",
"redirect_url": "<string>",
"requires_customer_address": true
},
"previous_subscription_id": "<string>",
"product_pricing_ids": [
"<string>"
],
"trial": true
}
'import requests
url = "https://api.getmeasure.com/api/v1/companies/{company_id}/checkout"
payload = {
"config_items": [
{
"hide_at_checkout": True,
"minimum_units": 1,
"num_licenses": 1,
"product_metric_pricing_id": "<string>",
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": True,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123,
"upsell_product_metric_pricing_id": "<string>"
}
],
"customer_id": "<string>",
"type": "CHECKOUT_SESSION",
"auto_charges": True,
"auto_renews": True,
"bundle_pricing_id": "<string>",
"change_reset_billing_anchor": True,
"discounts": [
{
"name": "<string>",
"amount": {
"currency": "<string>",
"value_in_cents": 123
},
"cap": {
"currency": "<string>",
"value_in_cents": 123
},
"coupon_id": "<string>",
"customer_id": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"import_created_at_ref": "2023-11-07T05:31:56Z",
"import_ref": "<string>",
"imported_from": "<string>",
"item_pricing_id": "<string>",
"onetime_billable_id": "<string>",
"percent": 0.5,
"product_id": "<string>",
"product_pricing_id": "<string>",
"proposal_id": "<string>",
"subscription_id": "<string>"
}
],
"metadata": {},
"onetime_items": [
{
"aggregate": 123,
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": True,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123
}
],
"options": {
"allow_promo_code": True,
"confirmation_message": "<string>",
"redirect_url": "<string>",
"requires_customer_address": True
},
"previous_subscription_id": "<string>",
"product_pricing_ids": ["<string>"],
"trial": 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({
config_items: [
{
hide_at_checkout: true,
minimum_units: 1,
num_licenses: 1,
product_metric_pricing_id: '<string>',
product_pricing_id: '<string>',
quantity_config: {allow_custom_quantity: true, max_quantity: 123, min_quantity: 123},
sort_order: 123,
upsell_product_metric_pricing_id: '<string>'
}
],
customer_id: '<string>',
type: 'CHECKOUT_SESSION',
auto_charges: true,
auto_renews: true,
bundle_pricing_id: '<string>',
change_reset_billing_anchor: true,
discounts: [
{
name: '<string>',
amount: {currency: '<string>', value_in_cents: 123},
cap: {currency: '<string>', value_in_cents: 123},
coupon_id: '<string>',
customer_id: '<string>',
expiration_date: '2023-11-07T05:31:56Z',
import_created_at_ref: '2023-11-07T05:31:56Z',
import_ref: '<string>',
imported_from: '<string>',
item_pricing_id: '<string>',
onetime_billable_id: '<string>',
percent: 0.5,
product_id: '<string>',
product_pricing_id: '<string>',
proposal_id: '<string>',
subscription_id: '<string>'
}
],
metadata: {},
onetime_items: [
{
aggregate: 123,
product_pricing_id: '<string>',
quantity_config: {allow_custom_quantity: true, max_quantity: 123, min_quantity: 123},
sort_order: 123
}
],
options: {
allow_promo_code: true,
confirmation_message: '<string>',
redirect_url: '<string>',
requires_customer_address: true
},
previous_subscription_id: '<string>',
product_pricing_ids: ['<string>'],
trial: true
})
};
fetch('https://api.getmeasure.com/api/v1/companies/{company_id}/checkout', 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.getmeasure.com/api/v1/companies/{company_id}/checkout",
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([
'config_items' => [
[
'hide_at_checkout' => true,
'minimum_units' => 1,
'num_licenses' => 1,
'product_metric_pricing_id' => '<string>',
'product_pricing_id' => '<string>',
'quantity_config' => [
'allow_custom_quantity' => true,
'max_quantity' => 123,
'min_quantity' => 123
],
'sort_order' => 123,
'upsell_product_metric_pricing_id' => '<string>'
]
],
'customer_id' => '<string>',
'type' => 'CHECKOUT_SESSION',
'auto_charges' => true,
'auto_renews' => true,
'bundle_pricing_id' => '<string>',
'change_reset_billing_anchor' => true,
'discounts' => [
[
'name' => '<string>',
'amount' => [
'currency' => '<string>',
'value_in_cents' => 123
],
'cap' => [
'currency' => '<string>',
'value_in_cents' => 123
],
'coupon_id' => '<string>',
'customer_id' => '<string>',
'expiration_date' => '2023-11-07T05:31:56Z',
'import_created_at_ref' => '2023-11-07T05:31:56Z',
'import_ref' => '<string>',
'imported_from' => '<string>',
'item_pricing_id' => '<string>',
'onetime_billable_id' => '<string>',
'percent' => 0.5,
'product_id' => '<string>',
'product_pricing_id' => '<string>',
'proposal_id' => '<string>',
'subscription_id' => '<string>'
]
],
'metadata' => [
],
'onetime_items' => [
[
'aggregate' => 123,
'product_pricing_id' => '<string>',
'quantity_config' => [
'allow_custom_quantity' => true,
'max_quantity' => 123,
'min_quantity' => 123
],
'sort_order' => 123
]
],
'options' => [
'allow_promo_code' => true,
'confirmation_message' => '<string>',
'redirect_url' => '<string>',
'requires_customer_address' => true
],
'previous_subscription_id' => '<string>',
'product_pricing_ids' => [
'<string>'
],
'trial' => 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.getmeasure.com/api/v1/companies/{company_id}/checkout"
payload := strings.NewReader("{\n \"config_items\": [\n {\n \"hide_at_checkout\": true,\n \"minimum_units\": 1,\n \"num_licenses\": 1,\n \"product_metric_pricing_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123,\n \"upsell_product_metric_pricing_id\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"type\": \"CHECKOUT_SESSION\",\n \"auto_charges\": true,\n \"auto_renews\": true,\n \"bundle_pricing_id\": \"<string>\",\n \"change_reset_billing_anchor\": true,\n \"discounts\": [\n {\n \"name\": \"<string>\",\n \"amount\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"cap\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"coupon_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"expiration_date\": \"2023-11-07T05:31:56Z\",\n \"import_created_at_ref\": \"2023-11-07T05:31:56Z\",\n \"import_ref\": \"<string>\",\n \"imported_from\": \"<string>\",\n \"item_pricing_id\": \"<string>\",\n \"onetime_billable_id\": \"<string>\",\n \"percent\": 0.5,\n \"product_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"proposal_id\": \"<string>\",\n \"subscription_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"onetime_items\": [\n {\n \"aggregate\": 123,\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123\n }\n ],\n \"options\": {\n \"allow_promo_code\": true,\n \"confirmation_message\": \"<string>\",\n \"redirect_url\": \"<string>\",\n \"requires_customer_address\": true\n },\n \"previous_subscription_id\": \"<string>\",\n \"product_pricing_ids\": [\n \"<string>\"\n ],\n \"trial\": true\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.getmeasure.com/api/v1/companies/{company_id}/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"config_items\": [\n {\n \"hide_at_checkout\": true,\n \"minimum_units\": 1,\n \"num_licenses\": 1,\n \"product_metric_pricing_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123,\n \"upsell_product_metric_pricing_id\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"type\": \"CHECKOUT_SESSION\",\n \"auto_charges\": true,\n \"auto_renews\": true,\n \"bundle_pricing_id\": \"<string>\",\n \"change_reset_billing_anchor\": true,\n \"discounts\": [\n {\n \"name\": \"<string>\",\n \"amount\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"cap\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"coupon_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"expiration_date\": \"2023-11-07T05:31:56Z\",\n \"import_created_at_ref\": \"2023-11-07T05:31:56Z\",\n \"import_ref\": \"<string>\",\n \"imported_from\": \"<string>\",\n \"item_pricing_id\": \"<string>\",\n \"onetime_billable_id\": \"<string>\",\n \"percent\": 0.5,\n \"product_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"proposal_id\": \"<string>\",\n \"subscription_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"onetime_items\": [\n {\n \"aggregate\": 123,\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123\n }\n ],\n \"options\": {\n \"allow_promo_code\": true,\n \"confirmation_message\": \"<string>\",\n \"redirect_url\": \"<string>\",\n \"requires_customer_address\": true\n },\n \"previous_subscription_id\": \"<string>\",\n \"product_pricing_ids\": [\n \"<string>\"\n ],\n \"trial\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmeasure.com/api/v1/companies/{company_id}/checkout")
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 \"config_items\": [\n {\n \"hide_at_checkout\": true,\n \"minimum_units\": 1,\n \"num_licenses\": 1,\n \"product_metric_pricing_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123,\n \"upsell_product_metric_pricing_id\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"type\": \"CHECKOUT_SESSION\",\n \"auto_charges\": true,\n \"auto_renews\": true,\n \"bundle_pricing_id\": \"<string>\",\n \"change_reset_billing_anchor\": true,\n \"discounts\": [\n {\n \"name\": \"<string>\",\n \"amount\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"cap\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"coupon_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"expiration_date\": \"2023-11-07T05:31:56Z\",\n \"import_created_at_ref\": \"2023-11-07T05:31:56Z\",\n \"import_ref\": \"<string>\",\n \"imported_from\": \"<string>\",\n \"item_pricing_id\": \"<string>\",\n \"onetime_billable_id\": \"<string>\",\n \"percent\": 0.5,\n \"product_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"proposal_id\": \"<string>\",\n \"subscription_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"onetime_items\": [\n {\n \"aggregate\": 123,\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123\n }\n ],\n \"options\": {\n \"allow_promo_code\": true,\n \"confirmation_message\": \"<string>\",\n \"redirect_url\": \"<string>\",\n \"requires_customer_address\": true\n },\n \"previous_subscription_id\": \"<string>\",\n \"product_pricing_ids\": [\n \"<string>\"\n ],\n \"trial\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The idempotency key that will be used to ensure the request is only performed once
Path Parameters
The company ID with the prefix 'cmp_'.
Body
Show child attributes
Show child attributes
The customer attached to the checkout session
The type of the checkout session
CHECKOUT_SESSION Whether the subscription is automatically charged to the payment method after the checkout session
Whether this subscription auto renews at the end of the term. This is to be used without end date or renewal date
The bundle pricing that forms the checkout session
The proration type of the existing subscription, if provided. This is one of NEXT, IMMEDIATE or NONE based on whether the proration is charged on the next invoice, immediately or no proration is applied respectively
NEXT, IMMEDIATE, NONE Whether to reset the billing anchor of the existing subscription, if provided
The change timing of the existing subscription, if provided. This is one of IMMEDIATE, PERIOD_END or RENEWAL based on whether the change timing needs to be immediate, at the end of the current period, on renewal respectively
IMMEDIATE, PERIOD_END, RENEWAL The discounts attached to the checkout session
Show child attributes
Show child attributes
Any additional as key-value pairs that needs to be attached to the subscription after the checkout session
Any one time charges to be attached to the checkout session
Show child attributes
Show child attributes
The detailed options for the checkout session such as confirmation messages, redirect urls etc.
Show child attributes
Show child attributes
The ID of an existing subscription whose plan will change with the checkout session
The list of product pricings that form the checkout session
The term for the subscription created by the checkout session
Show child attributes
Show child attributes
Whether the checkout session creates a subscription in a trial
The trial term for the subscription after the checkout session
Show child attributes
Show child attributes
curl --request POST \
--url https://api.getmeasure.com/api/v1/companies/{company_id}/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"config_items": [
{
"hide_at_checkout": true,
"minimum_units": 1,
"num_licenses": 1,
"product_metric_pricing_id": "<string>",
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": true,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123,
"upsell_product_metric_pricing_id": "<string>"
}
],
"customer_id": "<string>",
"type": "CHECKOUT_SESSION",
"auto_charges": true,
"auto_renews": true,
"bundle_pricing_id": "<string>",
"change_reset_billing_anchor": true,
"discounts": [
{
"name": "<string>",
"amount": {
"currency": "<string>",
"value_in_cents": 123
},
"cap": {
"currency": "<string>",
"value_in_cents": 123
},
"coupon_id": "<string>",
"customer_id": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"import_created_at_ref": "2023-11-07T05:31:56Z",
"import_ref": "<string>",
"imported_from": "<string>",
"item_pricing_id": "<string>",
"onetime_billable_id": "<string>",
"percent": 0.5,
"product_id": "<string>",
"product_pricing_id": "<string>",
"proposal_id": "<string>",
"subscription_id": "<string>"
}
],
"metadata": {},
"onetime_items": [
{
"aggregate": 123,
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": true,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123
}
],
"options": {
"allow_promo_code": true,
"confirmation_message": "<string>",
"redirect_url": "<string>",
"requires_customer_address": true
},
"previous_subscription_id": "<string>",
"product_pricing_ids": [
"<string>"
],
"trial": true
}
'import requests
url = "https://api.getmeasure.com/api/v1/companies/{company_id}/checkout"
payload = {
"config_items": [
{
"hide_at_checkout": True,
"minimum_units": 1,
"num_licenses": 1,
"product_metric_pricing_id": "<string>",
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": True,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123,
"upsell_product_metric_pricing_id": "<string>"
}
],
"customer_id": "<string>",
"type": "CHECKOUT_SESSION",
"auto_charges": True,
"auto_renews": True,
"bundle_pricing_id": "<string>",
"change_reset_billing_anchor": True,
"discounts": [
{
"name": "<string>",
"amount": {
"currency": "<string>",
"value_in_cents": 123
},
"cap": {
"currency": "<string>",
"value_in_cents": 123
},
"coupon_id": "<string>",
"customer_id": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"import_created_at_ref": "2023-11-07T05:31:56Z",
"import_ref": "<string>",
"imported_from": "<string>",
"item_pricing_id": "<string>",
"onetime_billable_id": "<string>",
"percent": 0.5,
"product_id": "<string>",
"product_pricing_id": "<string>",
"proposal_id": "<string>",
"subscription_id": "<string>"
}
],
"metadata": {},
"onetime_items": [
{
"aggregate": 123,
"product_pricing_id": "<string>",
"quantity_config": {
"allow_custom_quantity": True,
"max_quantity": 123,
"min_quantity": 123
},
"sort_order": 123
}
],
"options": {
"allow_promo_code": True,
"confirmation_message": "<string>",
"redirect_url": "<string>",
"requires_customer_address": True
},
"previous_subscription_id": "<string>",
"product_pricing_ids": ["<string>"],
"trial": 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({
config_items: [
{
hide_at_checkout: true,
minimum_units: 1,
num_licenses: 1,
product_metric_pricing_id: '<string>',
product_pricing_id: '<string>',
quantity_config: {allow_custom_quantity: true, max_quantity: 123, min_quantity: 123},
sort_order: 123,
upsell_product_metric_pricing_id: '<string>'
}
],
customer_id: '<string>',
type: 'CHECKOUT_SESSION',
auto_charges: true,
auto_renews: true,
bundle_pricing_id: '<string>',
change_reset_billing_anchor: true,
discounts: [
{
name: '<string>',
amount: {currency: '<string>', value_in_cents: 123},
cap: {currency: '<string>', value_in_cents: 123},
coupon_id: '<string>',
customer_id: '<string>',
expiration_date: '2023-11-07T05:31:56Z',
import_created_at_ref: '2023-11-07T05:31:56Z',
import_ref: '<string>',
imported_from: '<string>',
item_pricing_id: '<string>',
onetime_billable_id: '<string>',
percent: 0.5,
product_id: '<string>',
product_pricing_id: '<string>',
proposal_id: '<string>',
subscription_id: '<string>'
}
],
metadata: {},
onetime_items: [
{
aggregate: 123,
product_pricing_id: '<string>',
quantity_config: {allow_custom_quantity: true, max_quantity: 123, min_quantity: 123},
sort_order: 123
}
],
options: {
allow_promo_code: true,
confirmation_message: '<string>',
redirect_url: '<string>',
requires_customer_address: true
},
previous_subscription_id: '<string>',
product_pricing_ids: ['<string>'],
trial: true
})
};
fetch('https://api.getmeasure.com/api/v1/companies/{company_id}/checkout', 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.getmeasure.com/api/v1/companies/{company_id}/checkout",
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([
'config_items' => [
[
'hide_at_checkout' => true,
'minimum_units' => 1,
'num_licenses' => 1,
'product_metric_pricing_id' => '<string>',
'product_pricing_id' => '<string>',
'quantity_config' => [
'allow_custom_quantity' => true,
'max_quantity' => 123,
'min_quantity' => 123
],
'sort_order' => 123,
'upsell_product_metric_pricing_id' => '<string>'
]
],
'customer_id' => '<string>',
'type' => 'CHECKOUT_SESSION',
'auto_charges' => true,
'auto_renews' => true,
'bundle_pricing_id' => '<string>',
'change_reset_billing_anchor' => true,
'discounts' => [
[
'name' => '<string>',
'amount' => [
'currency' => '<string>',
'value_in_cents' => 123
],
'cap' => [
'currency' => '<string>',
'value_in_cents' => 123
],
'coupon_id' => '<string>',
'customer_id' => '<string>',
'expiration_date' => '2023-11-07T05:31:56Z',
'import_created_at_ref' => '2023-11-07T05:31:56Z',
'import_ref' => '<string>',
'imported_from' => '<string>',
'item_pricing_id' => '<string>',
'onetime_billable_id' => '<string>',
'percent' => 0.5,
'product_id' => '<string>',
'product_pricing_id' => '<string>',
'proposal_id' => '<string>',
'subscription_id' => '<string>'
]
],
'metadata' => [
],
'onetime_items' => [
[
'aggregate' => 123,
'product_pricing_id' => '<string>',
'quantity_config' => [
'allow_custom_quantity' => true,
'max_quantity' => 123,
'min_quantity' => 123
],
'sort_order' => 123
]
],
'options' => [
'allow_promo_code' => true,
'confirmation_message' => '<string>',
'redirect_url' => '<string>',
'requires_customer_address' => true
],
'previous_subscription_id' => '<string>',
'product_pricing_ids' => [
'<string>'
],
'trial' => 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.getmeasure.com/api/v1/companies/{company_id}/checkout"
payload := strings.NewReader("{\n \"config_items\": [\n {\n \"hide_at_checkout\": true,\n \"minimum_units\": 1,\n \"num_licenses\": 1,\n \"product_metric_pricing_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123,\n \"upsell_product_metric_pricing_id\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"type\": \"CHECKOUT_SESSION\",\n \"auto_charges\": true,\n \"auto_renews\": true,\n \"bundle_pricing_id\": \"<string>\",\n \"change_reset_billing_anchor\": true,\n \"discounts\": [\n {\n \"name\": \"<string>\",\n \"amount\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"cap\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"coupon_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"expiration_date\": \"2023-11-07T05:31:56Z\",\n \"import_created_at_ref\": \"2023-11-07T05:31:56Z\",\n \"import_ref\": \"<string>\",\n \"imported_from\": \"<string>\",\n \"item_pricing_id\": \"<string>\",\n \"onetime_billable_id\": \"<string>\",\n \"percent\": 0.5,\n \"product_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"proposal_id\": \"<string>\",\n \"subscription_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"onetime_items\": [\n {\n \"aggregate\": 123,\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123\n }\n ],\n \"options\": {\n \"allow_promo_code\": true,\n \"confirmation_message\": \"<string>\",\n \"redirect_url\": \"<string>\",\n \"requires_customer_address\": true\n },\n \"previous_subscription_id\": \"<string>\",\n \"product_pricing_ids\": [\n \"<string>\"\n ],\n \"trial\": true\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.getmeasure.com/api/v1/companies/{company_id}/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"config_items\": [\n {\n \"hide_at_checkout\": true,\n \"minimum_units\": 1,\n \"num_licenses\": 1,\n \"product_metric_pricing_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123,\n \"upsell_product_metric_pricing_id\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"type\": \"CHECKOUT_SESSION\",\n \"auto_charges\": true,\n \"auto_renews\": true,\n \"bundle_pricing_id\": \"<string>\",\n \"change_reset_billing_anchor\": true,\n \"discounts\": [\n {\n \"name\": \"<string>\",\n \"amount\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"cap\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"coupon_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"expiration_date\": \"2023-11-07T05:31:56Z\",\n \"import_created_at_ref\": \"2023-11-07T05:31:56Z\",\n \"import_ref\": \"<string>\",\n \"imported_from\": \"<string>\",\n \"item_pricing_id\": \"<string>\",\n \"onetime_billable_id\": \"<string>\",\n \"percent\": 0.5,\n \"product_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"proposal_id\": \"<string>\",\n \"subscription_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"onetime_items\": [\n {\n \"aggregate\": 123,\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123\n }\n ],\n \"options\": {\n \"allow_promo_code\": true,\n \"confirmation_message\": \"<string>\",\n \"redirect_url\": \"<string>\",\n \"requires_customer_address\": true\n },\n \"previous_subscription_id\": \"<string>\",\n \"product_pricing_ids\": [\n \"<string>\"\n ],\n \"trial\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmeasure.com/api/v1/companies/{company_id}/checkout")
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 \"config_items\": [\n {\n \"hide_at_checkout\": true,\n \"minimum_units\": 1,\n \"num_licenses\": 1,\n \"product_metric_pricing_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123,\n \"upsell_product_metric_pricing_id\": \"<string>\"\n }\n ],\n \"customer_id\": \"<string>\",\n \"type\": \"CHECKOUT_SESSION\",\n \"auto_charges\": true,\n \"auto_renews\": true,\n \"bundle_pricing_id\": \"<string>\",\n \"change_reset_billing_anchor\": true,\n \"discounts\": [\n {\n \"name\": \"<string>\",\n \"amount\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"cap\": {\n \"currency\": \"<string>\",\n \"value_in_cents\": 123\n },\n \"coupon_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"expiration_date\": \"2023-11-07T05:31:56Z\",\n \"import_created_at_ref\": \"2023-11-07T05:31:56Z\",\n \"import_ref\": \"<string>\",\n \"imported_from\": \"<string>\",\n \"item_pricing_id\": \"<string>\",\n \"onetime_billable_id\": \"<string>\",\n \"percent\": 0.5,\n \"product_id\": \"<string>\",\n \"product_pricing_id\": \"<string>\",\n \"proposal_id\": \"<string>\",\n \"subscription_id\": \"<string>\"\n }\n ],\n \"metadata\": {},\n \"onetime_items\": [\n {\n \"aggregate\": 123,\n \"product_pricing_id\": \"<string>\",\n \"quantity_config\": {\n \"allow_custom_quantity\": true,\n \"max_quantity\": 123,\n \"min_quantity\": 123\n },\n \"sort_order\": 123\n }\n ],\n \"options\": {\n \"allow_promo_code\": true,\n \"confirmation_message\": \"<string>\",\n \"redirect_url\": \"<string>\",\n \"requires_customer_address\": true\n },\n \"previous_subscription_id\": \"<string>\",\n \"product_pricing_ids\": [\n \"<string>\"\n ],\n \"trial\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>"
}
