Studio
Integrations
Connect any external site so every new enrollment lands here as a draft invoice.
How it works
- In Sources, create a source for the site (e.g.
soulkey) and mark it active. - On that site, store the shared secret as an environment variable named
ENROLLMENT_SECRET. Use the same value that is set here asSOULKEY_WEBHOOK_SECRET. - After a successful enrollment, the site POSTs the payload below to the webhook.
- A draft invoice is created and shows up under Invoices, tagged with the source.
Endpoint
POST https://invoicesuite.lovable.app/api/public/enrollmentRequired header
X-Enrollment-Secret: <your shared secret>Payload schema
| Field | Type | Required | Notes |
|---|---|---|---|
source | string | yes | Matches a slug in Sources |
id | string | yes | Unique enrollment id (idempotency key) |
fullName | string | yes | |
email | string | yes | |
phone | string | no | |
country | string | no | |
tier | string | no | Package / bundle name (shown on invoice) |
amount | number | no | Falls back to source default |
currency | string (3) | no | ISO code, default USD |
description | string | no | Overrides invoice line label |
meta | object | no | Arbitrary 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 sameidwas sent before).400— invalid JSON or payload failed validation.401— missing or wrongX-Enrollment-Secret.403— unknown source slug, or the source is disabled in the dashboard.500— server error; the response body includes details.
