curl --request POST \
--url https://api.example.com/v1/account/checkout \
--header 'Content-Type: application/json' \
--header 'X-CSRF-Token: <x-csrf-token>' \
--data '
{
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"newSubscription": true
}
'import requests
url = "https://api.example.com/v1/account/checkout"
payload = {
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"newSubscription": True
}
headers = {
"X-CSRF-Token": "<x-csrf-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-CSRF-Token': '<x-csrf-token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
planVersionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
subscriptionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
newSubscription: true
})
};
fetch('https://api.example.com/v1/account/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.example.com/v1/account/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([
'planVersionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'subscriptionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'newSubscription' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-CSRF-Token: <x-csrf-token>"
],
]);
$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/v1/account/checkout"
payload := strings.NewReader("{\n \"planVersionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"newSubscription\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-CSRF-Token", "<x-csrf-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/v1/account/checkout")
.header("X-CSRF-Token", "<x-csrf-token>")
.header("Content-Type", "application/json")
.body("{\n \"planVersionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"newSubscription\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/account/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-CSRF-Token"] = '<x-csrf-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"planVersionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"newSubscription\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan": {
"planId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"kind": "trial",
"name": "<string>",
"billingPeriod": "<string>",
"durationSeconds": 123,
"price": {
"amountMinor": 123,
"currency": "<string>"
},
"operations": [
"purchase"
],
"eligible": true,
"description": "<string>",
"sortOrder": 123,
"gracePeriodSeconds": 123,
"recurringCapable": true,
"configurableSquads": true,
"held": true,
"ineligibleReason": "<string>",
"trafficAllowanceBytes": 123,
"deviceLimit": 123
},
"operation": "purchase",
"currency": "<string>",
"providers": [
{
"provider": "<string>",
"currency": "<string>",
"recurring": true,
"amountMinor": 123
}
],
"applyWallet": true,
"quote": {
"currency": "<string>",
"subtotalMinor": 123,
"addonMinor": 123,
"discountMinor": 123,
"walletBalanceMinor": 123,
"walletAppliedMinor": 123,
"externalMinor": 123
},
"subscriptions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slot": 123,
"plan": "<string>",
"status": "<string>",
"label": "<string>",
"endsAt": "2023-11-07T05:31:56Z"
}
],
"targetRequired": true,
"multiSubscription": true,
"squads": {
"selection": "<string>",
"minimum": 123,
"configurable": true,
"offered": [
{
"squadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"label": "<string>"
}
],
"maximum": 123
},
"selectedSquadIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"squadSelection": {
"required": true,
"reason": "squad_selection_required"
},
"quoteAvailable": true,
"addons": [
{
"addonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"addonVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"kind": "traffic",
"name": "<string>",
"maxQuantity": 123,
"proration": "<string>",
"price": {
"amountMinor": 123,
"currency": "<string>"
},
"description": "<string>",
"squadCount": 123,
"trafficBytes": 123,
"deviceSlots": 123
}
],
"selectedAddons": [
{
"addonVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123
}
],
"provider": "<string>",
"promoCode": "<string>",
"promoRejection": "promo_unknown",
"subscriptionId": "<string>",
"newSubscription": true,
"termsUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"request_id": "<string>"
}Post v1accountcheckout
curl --request POST \
--url https://api.example.com/v1/account/checkout \
--header 'Content-Type: application/json' \
--header 'X-CSRF-Token: <x-csrf-token>' \
--data '
{
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"newSubscription": true
}
'import requests
url = "https://api.example.com/v1/account/checkout"
payload = {
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"newSubscription": True
}
headers = {
"X-CSRF-Token": "<x-csrf-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-CSRF-Token': '<x-csrf-token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
planVersionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
subscriptionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
newSubscription: true
})
};
fetch('https://api.example.com/v1/account/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.example.com/v1/account/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([
'planVersionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'subscriptionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'newSubscription' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-CSRF-Token: <x-csrf-token>"
],
]);
$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/v1/account/checkout"
payload := strings.NewReader("{\n \"planVersionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"newSubscription\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-CSRF-Token", "<x-csrf-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/v1/account/checkout")
.header("X-CSRF-Token", "<x-csrf-token>")
.header("Content-Type", "application/json")
.body("{\n \"planVersionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"newSubscription\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/account/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-CSRF-Token"] = '<x-csrf-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"planVersionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"newSubscription\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan": {
"planId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"planVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"kind": "trial",
"name": "<string>",
"billingPeriod": "<string>",
"durationSeconds": 123,
"price": {
"amountMinor": 123,
"currency": "<string>"
},
"operations": [
"purchase"
],
"eligible": true,
"description": "<string>",
"sortOrder": 123,
"gracePeriodSeconds": 123,
"recurringCapable": true,
"configurableSquads": true,
"held": true,
"ineligibleReason": "<string>",
"trafficAllowanceBytes": 123,
"deviceLimit": 123
},
"operation": "purchase",
"currency": "<string>",
"providers": [
{
"provider": "<string>",
"currency": "<string>",
"recurring": true,
"amountMinor": 123
}
],
"applyWallet": true,
"quote": {
"currency": "<string>",
"subtotalMinor": 123,
"addonMinor": 123,
"discountMinor": 123,
"walletBalanceMinor": 123,
"walletAppliedMinor": 123,
"externalMinor": 123
},
"subscriptions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slot": 123,
"plan": "<string>",
"status": "<string>",
"label": "<string>",
"endsAt": "2023-11-07T05:31:56Z"
}
],
"targetRequired": true,
"multiSubscription": true,
"squads": {
"selection": "<string>",
"minimum": 123,
"configurable": true,
"offered": [
{
"squadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"label": "<string>"
}
],
"maximum": 123
},
"selectedSquadIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"squadSelection": {
"required": true,
"reason": "squad_selection_required"
},
"quoteAvailable": true,
"addons": [
{
"addonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"addonVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"kind": "traffic",
"name": "<string>",
"maxQuantity": 123,
"proration": "<string>",
"price": {
"amountMinor": 123,
"currency": "<string>"
},
"description": "<string>",
"squadCount": 123,
"trafficBytes": 123,
"deviceSlots": 123
}
],
"selectedAddons": [
{
"addonVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123
}
],
"provider": "<string>",
"promoCode": "<string>",
"promoRejection": "promo_unknown",
"subscriptionId": "<string>",
"newSubscription": true,
"termsUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"request_id": "<string>"
}Headers
Echoes the token from the current session. Required on every unsafe method.
Body
Response
Opened
Show child attributes
Show child attributes
purchase, renew, upgrade, downgrade Show child attributes
Show child attributes
The exact application breakdown. Every figure is computed on the server, so the number a customer is asked to approve and the number they are charged cannot be arrived at two different ways.
Show child attributes
Show child attributes
The subscriptions this checkout could target.
Show child attributes
Show child attributes
A target must be named before this checkout can be confirmed.
False means the panel renders no picker at all.
Show child attributes
Show child attributes
Whether the server choice still stands between this checkout and a price. A plan that asks the customer to choose servers opens with required: true and no quote rather than failing; reason is the commerce vocabulary the panel already explains.
Show child attributes
Show child attributes
False while the quote is withheld; quote then carries only the currency.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Why the entered code does not apply. Present on a 200, not an error.
promo_unknown, promo_ineligible, promo_exhausted, promo_invalid