/register route handles new user registration. A GET request renders the registration form; a POST request creates a Stripe customer and redirects the user to the pricing page.
GET /register
Renders the registration form, which collects the user’s email address and name.POST /register
Processes the registration form, creates a Stripe customer, persists the customer ID in the session cookie, and redirects to/prices.
Request
Content-Type:multipart/form-data
The user’s email address. Passed directly to
createCustomer when creating the Stripe customer record.The user’s display name. Passed to
createCustomer alongside the email address.Action source
Side effects
- Calls
createCustomer(email, name)to create a new customer object in Stripe. - Writes the returned
customer.idinto the session under the keycustomerId. - Commits the updated session and sets it as a
Set-Cookieresponse header.
Response
| Status | Description |
|---|---|
302 | Redirects to /prices. The Set-Cookie header carries the newly committed session containing the Stripe customerId. |
The
customerId stored in the session is required by the /prices route to create a subscription. Without a valid session, subsequent requests will fail to retrieve a customer ID.