Back to KB
Difficulty
Intermediate
Read Time
4 min

`/api/checkout/create-session`

By Codcompass Team··4 min read

/api/checkout/create-session

Overview

The /api/checkout/create-session endpoint acts as a lightweight price resolution and configuration utility for Paddle subscription billing. Rather than initiating a full checkout session server-side, this endpoint maps a requested plan and billing cycle to a valid Paddle priceId, which the frontend can then use to initialize the Paddle.js checkout modal. It also exposes a configuration health-check via a GET request, allowing applications to verify that all required Paddle environment variables are properly set before rendering pricing UI.

This endpoint is primarily consumed by frontend applications during the subscription checkout flow. Developers invoke the POST method when a user selects a tier and proceeds to payment. The GET method is typically called during application initialization or when rendering the pricing page to conditionally enable checkout buttons based on environment readiness.

Endpoint Reference

PropertyValue
Full URLhttps://<your-domain>/api/checkout/create-session
HTTP MethodsPOST, GET
AuthenticationNone (Public)
Content-Typeapplication/json (required for POST)
Rate LimitingNot enforced at the route level

Request Format

POST Request

The POST method expects a JSON payload containing subscription selection details. While the endpoint accepts name, successUrl, and returnUrl, it currently only validates and processes planId, billing, and email to resolve the price ID. These additional fields are passed through for frontend routing or Paddle.js configuration but are not utilized in the server-side response

🎉 Mid-Year Sale — Unlock Full Article

Base plan from just $4.99/mo or $49/yr

Sign in to read the full article and unlock all 635+ tutorials.

Sign In / Register — Start Free Trial

7-day free trial · Cancel anytime · 30-day money-back

Sources

  • api-reference