Checkout and download endpoints use Supabase authentication (cookie-based). Make sure you are logged in through the Shipfastai frontend before calling these endpoints.
GET /api/checkout
Start a one-time purchase flow for a product tier. This endpoint redirects the browser to a Stripe-hosted checkout page. If the user is not authenticated, they are redirected to the login page first. If the user already owns the requested tier, they are redirected to the dashboard. Query parameters:string
required
The product tier to purchase. Must be one of
basic, pro, or enterprise.
After successful payment, Stripe redirects to
/dashboard?success=true&session_id={id}. If the user cancels, Stripe redirects to /pricing?canceled=true.
Available tiers
Promotion codes are supported. Stripe Checkout displays a promotion code field automatically.
GET /api/download
Download the purchased product as an AES-256 encrypted ZIP file. The ZIP password is the license key issued at purchase time. The license key is also returned in theX-License-Key response header.
Query parameters:
string
The UUID of a specific purchase to download. If omitted, the most recent completed purchase is used.
Rate limiting
Each user is limited to one download per purchase every 60 seconds. Requests within the cooldown window return429:
Download limits
Each purchase has a maximum number of downloads (default: 5 for new purchases). Once the limit is reached, the purchase status changes toexpired and further downloads are blocked.
Error responses
GET /api/download/history
Retrieve the download history for the authenticated user. Returns the most recent 50 download log entries, ordered by download time (newest first). Query parameters:string
Filter results to a specific purchase. If omitted, returns download logs across all purchases.
string
required
UUID of the download log entry.
string
required
UUID of the associated purchase.
string
required
UUID of the user who performed the download.
string
The product version that was downloaded (e.g.,
"1.0.0").string
IP address of the client at the time of download.
string
User-Agent header of the client at the time of download.
string
Country code derived from the client IP address, if available.
string
required
ISO 8601 timestamp of when the download occurred.
POST /api/stripe/webhook
Stripe webhook endpoint for the storefront. Handles purchase completion, payment confirmation, and refund events. This endpoint is called directly by Stripe, not by your application. Headers required by Stripe:string
required
The
Stripe-Signature header added automatically by Stripe. The backend verifies this against STRIPE_WEBHOOK_SECRET.Handled events
Response:
400 for an invalid payload or failed signature verification.
Local testing with the Stripe CLI
Forward events from Stripe to your local development server:STRIPE_WEBHOOK_SECRET in your .env.local.