/prices route displays subscription plans loaded from configuration and allows the authenticated customer to select a plan. Selecting a plan creates a Stripe subscription and redirects the user to the payment confirmation flow.
Both the loader and action read the session cookie to retrieve the current
customerId. Requests without a valid session containing a customerId will not be able to create a subscription.GET /prices
Loads the list of available prices from application configuration and returns the current customer ID from the session.Loader source
Response data
Array of price objects returned by
getConfig(). Each price includes expanded product data from Stripe (name, description, metadata).The Stripe customer ID read from the active session. Used by the UI to associate the selected plan with the correct customer when the form is submitted.
POST /prices
Accepts a selected price ID, creates an incomplete Stripe subscription for the session customer, and redirects to the Stripe Elements payment confirmation page.Request
Content-Type:multipart/form-data
The Stripe price ID of the plan the customer has selected (e.g.
price_1Abc123). Must correspond to a recurring price in your Stripe account.Action source
Side effects
- Reads
customerIdfrom the active session. - Calls
subscribe(customerId, priceId), which creates a Stripe subscription withpayment_behavior: 'default_incomplete'and returns the associatedclientSecretfrom the first invoice’s PaymentIntent. - Commits the session and forwards it as a
Set-Cookieheader on the redirect response.
Response
| Status | Description |
|---|---|
302 | Redirects to /subscribe?client_secret=<clientSecret>. The client_secret query parameter is the PaymentIntent client secret required to confirm payment in Stripe Elements. |
200 | Returns { error } if subscribe() throws (e.g. invalid customer ID or Stripe error). The error is surfaced inline on the prices page. |