Open the payment provider's hosted purchase page
curl --request POST \
--url https://app.trustivan.com/api/v1/billing/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": "pro",
"interval": "month"
}
'import requests
url = "https://app.trustivan.com/api/v1/billing/checkout"
payload = {
"plan": "pro",
"interval": "month"
}
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({plan: 'pro', interval: 'month'})
};
fetch('https://app.trustivan.com/api/v1/billing/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/billing/checkout"
payload := strings.NewReader("{\n \"plan\": \"pro\",\n \"interval\": \"month\"\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))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Open the payment provider's hosted purchase page
Mints a REDIRECT and writes nothing. No plan changes here: the customer pays at the provider, and the provider reports what they bought over the signature-verified webhook. An authenticated endpoint that upgraded its own tenant would be a way to grant yourself Enterprise, since every signup owns its personal organization.
organization:manage: the same bar as renaming the tenant, and
ungrantable to a machine, so a leaked CI key cannot commit a customer
to a subscription. The body names the plan and how often it is billed,
nothing else: a client that could choose the price could buy
Enterprise for nothing. interval picks between the monthly and
annual prices the deployment configured.
POST
/
billing
/
checkout
Open the payment provider's hosted purchase page
curl --request POST \
--url https://app.trustivan.com/api/v1/billing/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": "pro",
"interval": "month"
}
'import requests
url = "https://app.trustivan.com/api/v1/billing/checkout"
payload = {
"plan": "pro",
"interval": "month"
}
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({plan: 'pro', interval: 'month'})
};
fetch('https://app.trustivan.com/api/v1/billing/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/billing/checkout"
payload := strings.NewReader("{\n \"plan\": \"pro\",\n \"interval\": \"month\"\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))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Body
application/json
Response
A redirect: url and expires_at.