The Hypno Academy

Studio

Integrations

Connect any external site so every new enrollment lands here as a draft invoice.

How it works

  1. In Sources, create a source for the site (e.g. soulkey) and mark it active.
  2. On that site, store the shared secret as an environment variable named ENROLLMENT_SECRET. Use the same value that is set here as SOULKEY_WEBHOOK_SECRET.
  3. After a successful enrollment, the site POSTs the payload below to the webhook.
  4. A draft invoice is created and shows up under Invoices, tagged with the source.

Endpoint

POST https://invoicesuite.lovable.app/api/public/enrollment
Required header
X-Enrollment-Secret: <your shared secret>
Payload schema
FieldTypeRequiredNotes
sourcestringyesMatches a slug in Sources
idstringyesUnique enrollment id (idempotency key)
fullNamestringyes
emailstringyes
phonestringno
countrystringno
tierstringnoPackage / bundle name (shown on invoice)
amountnumbernoFalls back to source default
currencystring (3)noISO code, default USD
descriptionstringnoOverrides invoice line label
metaobjectnoArbitrary extra data, stored on invoice

Copy-paste snippets

Paste this into the chat of any other Lovable project to wire it up.

When a new enrollment is completed on this site, send it to my invoicing app so a draft invoice is created automatically.

Add a server-side handler that POSTs to:
  https://invoicesuite.lovable.app/api/public/enrollment

Headers:
  Content-Type: application/json
  X-Enrollment-Secret: <value of the ENROLLMENT_SECRET env var / Lovable Cloud secret>

Body (JSON):
  {
    "source": "soulkey",          // identifies this site in my dashboard
    "id": "<unique enrollment id>", // used as idempotency key
    "fullName": "<full name>",
    "email": "<email>",
    "phone": "<phone, optional>",
    "country": "<country, optional>",
    "tier": "<package or tier name, optional>",
    "amount": <number, optional>,
    "currency": "<3-letter ISO code, optional, default USD>"
  }

Requirements:
- Call this from server-side code only (server function / edge function / API route). Never from the browser.
- Add ENROLLMENT_SECRET as a secret in Lovable Cloud (do not hardcode).
- Treat any non-2xx response as a failure and log the response body for debugging.
- The same "id" must always represent the same enrollment so retries do not create duplicates.

Responses

  • 200 — invoice created (or deduped if the same id was sent before).
  • 400 — invalid JSON or payload failed validation.
  • 401 — missing or wrong X-Enrollment-Secret.
  • 403 — unknown source slug, or the source is disabled in the dashboard.
  • 500 — server error; the response body includes details.