TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Jason-AML/MonzaSport-Nextjs/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/checkout route handles the first step of the Monza Motors purchase flow. It verifies that the requesting user is authenticated via a Supabase server-side session, fetches the target vehicle’s details from the vehiculos table using getCollectionById(), and then creates a Stripe Checkout session pre-configured with the vehicle’s name and price. The full Stripe session object — including the hosted checkout url — is returned to the client, which immediately redirects the user to complete payment on Stripe’s platform.
Endpoint
| Property | Value |
|---|---|
| Method | POST |
| Path | /api/checkout |
| Auth | Required — returns 401 if the user is not signed in |
| Content-Type | application/json |
Request Body
The vehicle UUID from the
vehiculos Supabase table. Used to look up the vehicle’s name and price before creating the Stripe session.Response
200 OK — Returns the full Stripe Checkout session object. The two most important fields for the client are:The Stripe-hosted checkout URL. Redirect the user to this address to complete payment. The URL is valid for 24 hours.
The Stripe session ID (prefixed
cs_). Can be stored client-side for reconciliation or status polling.getUser() resolves to null — i.e., no valid Supabase session cookie is present.
500 Internal Server Error
Example Request
Session Parameters
The Stripe Checkout session is created with the following configuration:| Parameter | Value | Notes |
|---|---|---|
payment_method_types | ['card'] | Credit and debit cards only |
mode | 'payment' | One-time payment, not a subscription |
currency | 'usd' | All Monza Motors prices are denominated in US dollars |
unit_amount | vehicle.precio * 100 | Prices are stored in dollars; Stripe requires cents |
product_data.name | vehicle.nombre_vehiculo | Displayed on the Stripe-hosted checkout page |
quantity | 1 | Fixed at one vehicle per session |
metadata.vehicleId | vehicle.id | Attached to the session for post-payment webhook handling |
metadata.userId | user.id | Enables order attribution after payment confirmation |
success_url | /success | Where Stripe redirects after successful payment |
cancel_url | /cancel | Where Stripe redirects if the user abandons checkout |
success_url and cancel_url are resolved against the app’s base URL: https://<VERCEL_URL> in production and NEXT_PUBLIC_BASE_URL in development.