Skip to main content
POST
/
billing
/
checkout
Create billing checkout session
curl --request POST \
  --url https://api.videodb.io/billing/checkout \
  --header 'Content-Type: application/json' \
  --header 'x-access-token: <api-key>' \
  --data '
{
  "mode": "payment",
  "plan_id": "plan-basic",
  "amount": 100
}
'
{
  "success": true,
  "data": {
    "url": "https://checkout.stripe.com/pay/xxx"
  }
}
Initiate a checkout session to purchase credits using your preferred payment method. Returns a checkout URL for the payment flow.
import requests

payload = {
    "amount": 50,
    "success_url": "https://yourapp.com/billing/success",
    "cancel_url": "https://yourapp.com/billing/cancelled"
}

response = requests.post(
    "https://api.videodb.io/billing/checkout",
    json=payload,
    headers={"x-access-token": "your_api_key"}
)

checkout_data = response.json()
print(f"Checkout URL: {checkout_data.get('checkout_url')}")
print(f"Session ID: {checkout_data.get('id')}")
  • Amount is specified in USD (whole dollars)
  • Success and cancel URLs redirect users after payment completion or cancellation
  • Checkout sessions expire after 24 hours if not completed
  • Credits are added to your account immediately upon successful payment

Authorizations

x-access-token
string
header
required

API key for authentication (sk-xxx format)

Body

application/json
mode
enum<string>
Available options:
payment,
subscription
Example:

"payment"

plan_id
string
Example:

"plan-basic"

amount
number
Example:

100

Response

200 - application/json

Checkout URL

success
boolean
Example:

true

data
object