Create Stripe Checkout session to add a payment method
/billing/checkout-setup-session
Returns a Stripe Checkout URL in setup mode to save a card for automatic payment of future invoices. Redirect the browser to url; on completion Stripe returns to success_url and Truto marks the card as the customer's default payment method.
Request Body
Must be on the app origin. Defaults to the Billing settings page.
Must be on the app origin. Defaults to the Billing settings page.
Response Body
cs_test_a1b2c3Errors
| Status | Description |
|---|---|
400 | A redirect URL is not on the app origin |
403 | Forbidden if the caller is not an admin of the team |
404 | The team has no Stripe customer yet |
503 | Billing is not configured on this deployment (STRIPE_SECRET_KEY unset) |
curl -X POST 'https://api.truto.one/billing/checkout-setup-session' \
-H 'Authorization: Bearer <your_api_token>' \
-H 'Content-Type: application/json' \
-d '{
"team_id": "your_team_id",
"success_url": "your_success_url",
"cancel_url": "your_cancel_url"
}'const body = {
"team_id": "your_team_id",
"success_url": "your_success_url",
"cancel_url": "your_cancel_url"
};
const response = await fetch('https://api.truto.one/billing/checkout-setup-session', {
method: 'POST',
headers: {
'Authorization': 'Bearer <your_api_token>',
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);import requests
url = "https://api.truto.one/billing/checkout-setup-session"
headers = {
"Authorization": "Bearer <your_api_token>",
"Content-Type": "application/json",
}
params = {
}
payload = {
"team_id": "your_team_id",
"success_url": "your_success_url",
"cancel_url": "your_cancel_url"
}
response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())