| name | website-checkout |
| description | Use when building a checkout or upgrade flow on an existing website: user clicks subscribe or upgrade → server creates a SolvaPay session → browser redirects to SolvaPay's hosted payment page → returns to your site with access unlocked. Also use for adding a customer portal so subscribers can manage, upgrade, or cancel their plan after checkout. Covers Next.js fully; React without a server framework is partial. Skip for: embedding plan cards or billing dashboards, webhook processing, usage metering, Lovable or Vite+Supabase setups, or MCP tool paywalls.
|
| metadata | {"version":"1.0.0"} |
| compatibility | Node.js >= 18.17 for npx solvapay init. Next.js fully supported; React (no Next.js) partial. Network required for init and hosted checkout.
|
Website Checkout
Hosted checkout + customer portal for web apps. Server creates checkout session; browser redirects to SolvaPay; return URL refreshes access from server truth.
Guardrails
- Never build custom card forms when hosted checkout is acceptable.
- Never expose
SOLVAPAY_SECRET_KEY in client code.
- Always keep checkout session creation on the server.
- Always verify access state from server truth after returning from checkout.
- Always use SolvaPay naming in user-facing text.
Gotchas
- Checkout succeeds but access unchanged → missing webhooks or stale client cache; refresh from server truth on return URL.
- React-only apps need a backend for checkout sessions — partial guidance here; full wiring →
solvapay/sdk-integration.
- Lovable / Vite + Supabase Edge →
solvapay/lovable-checkout, not this skill.
- Customer must exist in SolvaPay before checkout session — sync/ensure step first (details: references/nextjs.md).
- JWT/session must reach server routes that create sessions (details: references/nextjs.md).
- Durable access after redirect often needs webhooks, not return URL alone (details: references/nextjs.md).
Prerequisites
Before stack-specific implementation, run npx -y solvapay@latest init to configure SOLVAPAY_SECRET_KEY and install base SDK packages.
For advanced use cases (usage metering, Express/MCP paths, webhook-heavy flows), use solvapay/sdk-integration.
Mandatory read order
Checkout procedure
- Run
npx -y solvapay@latest init.
- Detect framework → load stack guide.
- Implement server checkout-session route.
- Implement return-URL handler + access refresh.
- Gate premium views from server truth.
- Run verification loop.
Verification loop
- Run stack-specific dev flow.
- Happy-path hosted checkout (redirect → return URL → access granted).
- Failure path (declined payment or unauthorized access check).
- Verify server-side access matches UI after return.
- Emit a runnable verification artifact — copy-pasteable
curl commands or a test script in outputs/ (not a prose summary). Include:
- Happy path: return from sandbox checkout → access check returns granted state.
- Failure path: unauthenticated or declined → access remains blocked.
- Fix and re-test until pass.
Handoff template
## Website checkout handoff
- **Framework:** [Next.js / React + backend]
- **Auth model:** [session / JWT / …]
- **Routes:** [checkout session / portal / access check]
- **Return URL behavior:** [post-checkout refresh path]
- **Sandbox:** [success + failure case outcomes]
- **Verification commands:**
# Happy path — after sandbox checkout, access refresh returns granted
curl -i -X POST http://localhost:3000/api/check-access \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"productRef":"prd_..."}'
# Failure path — unauthenticated checkout blocked
curl -i -X POST http://localhost:3000/api/create-checkout-session \
-H "Content-Type: application/json" -d '{"productRef":"prd_..."}'
Docs discovery hints
- Topics:
checkout sessions, customer sessions, nextjs guide, react guide, webhooks, test in sandbox.
- Retrieval hint: resolve topics via MCP search first, then
llms.txt.
Task progress
Stack support