create_checkout_session
Create a Stripe Checkout link for an end user to buy credits; returns checkout_url and session_id. Nothing is charged until the buyer pays on that page; credits are issued when payment completes. Price either a pricing tier (pricing_tier_id, optionally × quantity) or a custom amount (credit_type_id + amount credits, priced at the credit type's exchange_rate). billing: "recurring" creates a subscription (tier required; billing_type recurring or both), credited on every paid invoice; otherwise it is a one-time purchase even on a recurring tier. save_payment_method: true (one-time only) keeps the card for charge_saved_card and auto top-up. success_url and cancel_url must be https on a Cred host or a domain listed under Dashboard → Payments → Allowed redirect domains; on any other domain the link is still created and silently redirects to Cred's default pages. Requires an sk_live_ API key. Not CRD-metered.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | Custom-amount checkout: number of credits to sell | |
| api_key | No | Cred API key (optional if set via the x-api-key header) | |
| billing | No | Default one_time | |
| user_id | Yes | External user ID of the buyer (created if new) | |
| quantity | No | Tier packs (or seats for a subscription); default 1 | |
| user_name | No | Buyer display name | |
| cancel_url | No | Redirect if the buyer cancels, on an allowed domain (else Cred's default page, no error) | |
| project_id | No | Cred project ID (optional; the API key already identifies the project) | |
| signup_url | No | App/page URL the buyer came from (attribution) | |
| user_email | No | Buyer email (prefills Checkout, matched first) | |
| success_url | No | Redirect after payment, on an allowed domain (else Cred's default page, no error) | |
| x402_payment | No | Base64 x402 PaymentPayload, only when a previous call failed with an x402 PaymentRequired because the account is out of CRD | |
| credit_type_id | No | Credit type to grant. Required with amount, and with a tier that allows several types (400 CREDIT_TYPE_REQUIRED otherwise). | |
| pricing_tier_id | No | Tier to sell | |
| save_payment_method | No | Save the card for off-session charges (one-time checkouts only) |