CheckoutSession
info
This API is under active development and subject to change.
Path: /v1/checkout_session
Send a POST request to this endpoint when a user is ready to pay using TrueMed. We'll respond with a custom redirect URL for the user to checkout & pay via the TrueMed portal.
Request Parameters
interface CreateCheckoutSessionRequest {
"secret_api_key": process.env.TRUE_MEDICINE_SECRET_API_KEY,
"line_items": [
{
"price_data": {
"recurring": {
"interval": "month", // day, week, month, year
"interval_count": 1,
}
"currency": "usd",
"unit_amount_cents": 12399, // $123.99,
"product_data": {
"name": "Training with Tyler", // required
"description": "Get up to 3 classes per week with Tyler!", // optional
},
"quantity": 1,
"coupons": [{
"amount_off": 2400,
"currency": "usd",
"duration": "repeating", // "forever", "once", "repeating"
"duration_in_months": 3, // only required for "repeating" durations
"name": "First month discount!",
"client_reference_id": "NEW_USER_3",
}],
},
}
],
"mode": "subscription", // or "payment"
"success_url": "https://www.yoursite.co/sign-up/confirm",
"cancel_url": "https://www.yoursite.co/sign-up/cancel",
"client_reference_id": "d5d62a5f-5a9a-4073-8fbf-d6f0e777e89d",
"customer": {
"email": "[email protected]",
"name": "John Doe",
"metadata": {
"id": "your_id_here", // Optional ID. These will be included in the webhook events we forward.
}
}
}
Response Parameters
interface CreateCheckoutSessionResponse {
"redirect_url": "https://app.truemed.com/...",
"customer_id": "tm_8923DSFL23", // TrueMed will generate this ID for the customer in question.
}