Create Checkout
POST
/api/billing/checkout
const url = 'http://localhost:8000/api/billing/checkout';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"amount_usd":1,"cancel_url":"https://app.yupcha.com/billing?status=cancel","success_url":"https://app.yupcha.com/billing?status=success"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8000/api/billing/checkout \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "amount_usd": 1, "cancel_url": "https://app.yupcha.com/billing?status=cancel", "success_url": "https://app.yupcha.com/billing?status=success" }'Create a Stripe Checkout session to buy credits. Returns the hosted URL.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
CheckoutRequest
object
amount_usd
required
Amount Usd
USD of credit to purchase
number
cancel_url
Cancel Url
string
success_url
Success Url
string
Responses
Section titled “Responses”Successful Response
Media typeapplication/json
Examplegenerated
exampleValidation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}