Implementation notes

Everything the marketing site and the ten worker apps need in order to talk to this hub.

1. Squarespace buttons

The marketing site never collects cards. Every product card’s primary button points here. Optional: add &plan=monthly. Discovery calls stay on Squarespace for custom work only.

CardButton URL

2. What happens after the click

  1. Visitor lands on /start with the worker preselected.
  2. Logged out: we remember the destination and send them to the login page.
  3. Logged in without that worker: straight to the checkout page for it.
  4. Already a member: back to their workers with that one highlighted.
  5. After payment: a confirmation page with an Open button.

3. Handoff receiver for each worker app

Opening a worker sends the customer tohttps://SLUG.agentic-ai-adoption-now.com/handoff?token=…. Paste this section into the other Lovable apps.

// In each worker app: src/routes/handoff.tsx
// Reads ?token=..., calls the hub to exchange it once, then signs the user in.
//
// POST https://accounts.agentic-ai-adoption-now.com/api/public/handoff/consume
// Headers: content-type: application/json, x-product-secret: PRODUCT_SHARED_SECRET
// Body:    { "token": "<token from the url>" }
//
// 200 response:
// {
//   "user_id": "uuid",
//   "email": "owner@company.com",
//   "full_name": "Jane Doe",
//   "company_name": "Doe Plumbing",
//   "product_slug": "cora",
//   "membership_id": "uuid",
//   "tenant_id": "acct_123 or null",
//   "status": "active",
//   "plan": "monthly"
// }
//
// Errors (401/400): invalid_token, token_used, token_expired, unauthorized
//
// Rules:
// 1. Tokens are single use and expire in 5 minutes.
// 2. Call the endpoint from your server only. Never expose PRODUCT_SHARED_SECRET to the browser.
// 3. If status is not active/trialing/past_due, send the visitor back to the hub.
// 4. Create or look up the local tenant using tenant_id, falling back to user_id.
// 5. Then start your own session and redirect into the worker dashboard.

4. Stripe

Stripe webhook endpoint (set this in Stripe):
https://accounts.agentic-ai-adoption-now.com/api/public/stripe-webhook

Events to send:
  checkout.session.completed
  customer.subscription.created
  customer.subscription.updated
  customer.subscription.deleted

Price ids are set per worker in /admin. A worker with no price id shows “Price not configured” instead of a broken checkout.