POST /billing/checkout
Create a Stripe Checkout session for plan upgrade.

Authentication

API Key (header: X-API-Key) API Key (cookie: better-auth.session_token)

Request Body required

Request body

application/json
plan string REQUIRED
Plan name (pro or enterprise)
interval string
Billing interval: monthly or annual
coupon string
Coupon code to apply

Responses

200 Checkout session created
application/json
checkout_url string | null REQUIRED
Stripe Checkout URL to redirect the user
400 Invalid plan or interval
401 Unauthorized
curl -X POST 'https://hookstream.io/v1/billing/checkout' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "plan": "pro",
  "interval": "monthly",
  "coupon": "string"
}'
const response = await fetch('https://hookstream.io/v1/billing/checkout', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "plan": "pro",
    "interval": "monthly",
    "coupon": "string"
  })
});

const data = await response.json();
console.log(data);
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.post('https://hookstream.io/v1/billing/checkout', headers=headers, json={
  "plan": "pro",
  "interval": "monthly",
  "coupon": "string"
})
print(response.json())
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "plan": "pro",
  "interval": "monthly",
  "coupon": "string"
}`)
	req, _ := http.NewRequest("POST", "https://hookstream.io/v1/billing/checkout", body)
	req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
	req.Header.Set("Content-Type", "application/json")

	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
	result, _ := io.ReadAll(resp.Body)
	fmt.Println(string(result))
}
200 Response
{
  "checkout_url": "<string>"
}
POST /billing/checkout
Ask a question... ⌘I