Lovable Checkout (preview)
Paste-in SolvaPay hosted checkout for Lovable (Vite + shadcn/ui + Supabase Edge). Designed to paste reference content into Lovable chat on turn zero.
Guardrails
- Never put
SOLVAPAY_SECRET_KEYin.env,VITE_*, or browser-reachable files — Supabase edge secrets only. - Never hand-roll browser
fetchto SolvaPay API — all backend calls through edge functions. - Always install
@solvapay/react@previewand@solvapay/react-supabase@preview— never pin exact preview versions. - Always set
SOLVAPAY_API_BASE_URL=https://api-dev.solvapay.comas edge secret. - Not for production.
Full guardrails for paste-in: references/01-edge-and-secrets.md.
Gotchas
- Secret in
.envorVITE_*breaks security — edge secrets only (details:01-edge-and-secrets.md). - Pinning exact preview version breaks exports — use
@previewtag only. - Multiple GoTrueClient instances cause auth bugs — singleton pattern (details:
02-provider-and-routes.md). @solvapay/react/styles.cssmust import after./index.css(details:03-troubleshooting-and-sandbox.md).requireProductname must match Console product name exactly (details:03-troubleshooting-and-sandbox.md).- MCP App UI errors mean wrong skill — use
solvapay/sdk-integrationorsolvapay/create-mcp-app.
Mandatory read order
Read in order before generating code:
- references/GUIDE.md — index; then read the numbered files below
- references/01-edge-and-secrets.md
- references/02-provider-and-routes.md
- references/03-troubleshooting-and-sandbox.md
Load references/REFERENCE.md when adding billing UI beyond CheckoutLayout or when Stripe/CSP issues persist.
Paste-in tip: concatenate all three reference files into Lovable chat for turn-zero bias.
Integration procedure
- Read all reference files in mandatory read order.
- Install
@previewpackages via Deno one-liners in01-edge-and-secrets.md. - Create edge functions + Supabase secrets.
- Wire
SolvaPayProvider+ routes per02-provider-and-routes.md. - Gate content from server truth.
- Run verification loop.
Edge plan-validate-execute
- Plan: List edge functions + required secrets from templates in
01-edge-and-secrets.md. - Validate: Run
node scripts/check-import-map.mjs; confirm no secret inVITE_*/.env. - Execute: Deploy functions and wire provider.
Verification loop
- Complete edge setup and provider wiring.
- Sandbox redirect → return URL → access granted.
- On failure → consult troubleshooting table in
03-troubleshooting-and-sandbox.md→ fix → repeat until pass.
Handoff template
## Lovable checkout handoff
- **Edge functions:** [names]
- **Secrets set:** [list names, no values]
- **Routes:** [checkout / portal / gate]
- **Sandbox:** [redirect + return URL outcome]
- **Preview pin:** @preview (not production)
Scripts
| Script | Action | Purpose |
|---|---|---|
scripts/check-import-map.mjs |
Run | Validate Deno import map for @preview packages |
Task progress
- Read GUIDE.md index → 01-edge-and-secrets → 02-provider-and-routes → 03-troubleshooting
- Run Deno install one-liners (@preview packages)
- Create edge functions from templates
- Set Supabase edge secrets
- Wire SolvaPayProvider + checkout/portal routes
- Gate premium content from server truth
- Run verification loop until pass
References
- Edge + secrets: references/01-edge-and-secrets.md
- Provider + routes: references/02-provider-and-routes.md
- Troubleshooting + sandbox: references/03-troubleshooting-and-sandbox.md
- Package map: references/REFERENCE.md