curl -X POST "https://api.adrelay.dev/v1/billing/create-checkout-session" \
-H "X-API-Key: $ADRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"plan": "pro"}'
const response = await fetch(
"https://api.adrelay.dev/v1/billing/create-checkout-session",
{
method: "POST",
headers: {
"X-API-Key": process.env.ADRELAY_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ plan: "pro" }),
}
);
const data = await response.json();
// Redirect user to data.checkout_url
import requests
response = requests.post(
"https://api.adrelay.dev/v1/billing/create-checkout-session",
headers={
"X-API-Key": "your-api-key-here",
"Content-Type": "application/json",
},
json={"plan": "pro"},
)
data = response.json()
# Redirect user to data["checkout_url"]
{
"checkout_url": "https://checkout.stripe.com/c/pay/cs_live_...",
"session_id": "cs_live_abc123"
}
{
"error": "Invalid plan. Must be one of: starter, pro, enterprise.",
"code": "VALIDATION_ERROR",
"timestamp": 1711036800,
"request_id": "req_abc123"
}
checkout_url to complete payment. After successful payment, the plan upgrade takes effect immediately.