Skip to main content
Checkout sessions are the entry point for subscribers. When a new user wants to subscribe to your service, you create a checkout session that ties together your service, the payment plan they’ve chosen, and optionally an existing user record. Retempo tracks the session through its lifecycle — from the moment it’s created until the subscriber pays and their subscription is activated (or the session expires).

Creating a checkout session

To create a checkout session, send a POST request to /api/v1/checkout-sessions with the serviceId and paymentPlanId of the plan you want to offer. Both fields are required. If you already have a user record in Retempo (for example, a returning subscriber or a pre-registered agent), pass their userId to link the session to that account. Omit userId to create an anonymous session that gets associated with a user once they complete payment.
Pass expiresAt to automatically expire sessions after a window — for example, 24 hours from creation. This prevents stale sessions from cluttering your subscriber funnel.
A successful response returns the full checkout session object, including the embedded service, paymentPlan, and user objects for your convenience. Every checkout session is created with status: "PENDING" — you cannot set any other status at creation time.

Checkout session lifecycle

Every checkout session starts as PENDING and moves through the following states as the subscriber takes action:
1

PENDING

The session has been created and is waiting for the subscriber to complete payment. This is always the initial status — you cannot create a session in any other state.
2

PAID

The subscriber has paid and their subscription has been activated. A subscription record is created and linked to the session. The session is now closed.
3

EXPIRED

The session reached its expiresAt timestamp without a completed payment. The subscriber must start a new session to subscribe.
4

CANCELLED

The session was explicitly cancelled before payment was completed. Like expired sessions, a cancelled session cannot be reactivated.

Fetching session status

To retrieve the current state of a checkout session — including any subscriptions that were created after payment — send a GET request with the session ID:
The response includes a subscriptions array that Retempo populates once the subscriber pays. Before payment, the array is empty.