Security for developers
How to store API keys, rotate them, verify webhooks, require HTTPS, and apply least privilege.
Security for developers
Key storage
- Store API keys and webhook secrets as environment variables on your server (
INVOICLY_API_KEY,INVOICLY_WEBHOOK_SECRET). - Never put keys in client-side JavaScript, mobile apps, URLs, logs, or git. If a key is committed, revoke it and rotate — don't just delete the commit.
- In Next.js, use server-only code or
server-onlyimports for anything that touches keys; never prefix them withNEXT_PUBLIC_.
Key rotation
Rotate on a schedule (quarterly is a good default) and immediately if a key leaks:
- Create the new key in Settings → API keys.
- Deploy it to your server.
- Verify live traffic uses the new key.
- Revoke the old key. Revocation is immediate and final.
Webhook verification
- Verify the
Biz Invoice Pay-Signatureheader on every delivery (see the Node and PHP code). - Compare against the raw request body, use constant-time comparison, and reject signatures older than 5 minutes (replay protection).
- Respond 2xx quickly (within 10 seconds) and do heavy work asynchronously — slow endpoints burn your retry budget.
HTTPS everywhere
- Live checkout redirects (
success_url,cancel_url) must be absolute HTTPS URLs. - Webhook endpoints must be HTTPS; HTTP endpoints are rejected in live mode.
- In dev,
http://localhostis fine.
Least privilege
- Use one key per integration ("Website checkout", "WooCommerce", "Reporting script") so revoking one doesn't break the others.
- Keys act as your business with owner-level API access — there are no per-key scopes yet, so guard them like passwords.
- Human team members get roles, not keys: staff and managers use their own logins with limited permissions (see Team and roles). Never share the owner's login.
Never use or share a Stripe secret key. You only need the Biz Invoice Pay key. Stripe credentials are exchanged during Stripe's own onboarding and never stored by Biz Invoice Pay — if anyone asks you for a Stripe secret key, don't share it with anyone.
Last updated: October 14, 2026
Was this page helpful?