HappierleadsDocs
Full white label

Build it with your AI coding assistant

A ready prompt that connects your sign-up and billing to Happierleads for a full white label.

Paste this into Claude (or any AI coding assistant) inside your marketing site's or billing service's code base. Do the setup in your dashboard first.

Prompt
Connect our billing to Happierleads for a full white label (clients use reveal.ourdomain.com).

Key on the server only: HL_MASTER_KEY (master-priv-…). Never send it to the browser, never log it. Add it to .env.example.
API base: https://rest-admin.happierleads.com (add ?privateKey=HL_MASTER_KEY to every call).

1. Sign-up on our marketing site: POST /admin/websites { name, domain } → { websiteId }; store it on the customer. Then PUT /admin/websites/set-limits/{websiteId} { credits: 500, emailAccounts: 2 } and PUT /admin/websites/toggle-limits/{websiteId} { trialEnabled: true, trialExpireDate: 7 days from now, enableWebsiteLimits: true }. Then POST /admin/invite { invites: [{ email, firstName, preset: "client", websites: [websiteId] }] } so they get our branded invite.
2. Billing webhook (Stripe/Chargebee/Paddle): on invoice paid, set-limits { credits for their plan } and toggle-limits { trialEnabled: false, activeWebsite: true, enableWebsiteLimits: true, refreshOnDate: the period end }. On cancellation, set-limits { credits: 0, emailAccounts: 0 } (tracking stops, data is kept).
3. Keep a mapping billing customer → websiteId, make the webhook idempotent and log every call's status.

Match this project's code style and add tests for the webhook handler.