Repository navigation
Email each paid invoice as a PDF on Cloud - #1605
Merged
Merged
Conversation
helpcodeai
enabled auto-merge (rebase)
November 9, 2026 09:26
helpcodeai
force-pushed
the
feat/invoice-emails
branch
2 times, most recently
from
November 9, 2026 10:10
e1afd37 to
20d2abd
Compare
Settings → License gets an "Invoices by email" switch for workspace admins, with the billing contact or another address as recipient. The Cloud relays the choice to the licence site (service token), which stores it on the workspace's licence and sends the emails. GET/PUT /api/license/invoice-email take the workspace and licence from the session only; the CLI gets amcp invoices email [on|off] [--to | --billing-contact]. Self-hosted: 404, hidden.
helpcodeai
force-pushed
the
feat/invoice-emails
branch
from
November 9, 2026 11:12
20d2abd to
4cf47fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cloud workspace admins can have every paid invoice emailed as a PDF, to the billing contact or to another address (e.g. accounting). Stripe's own receipt emails can only be switched on for the whole account, so this is per workspace and off by default. The licence site stores the setting and sends the emails (HelpCode-ai/anythingmcp-website, companion PR); this PR is the Cloud side. Relates to #1604.
Changes
GETandPUT /api/license/invoice-email(ADMIN; Cloud only, 404 on self-hosted; PUT throttled 10/min).InvoiceEmailServiceresolves the licence key from the caller's own workspace, as the billing portal does, and calls the licence site with the service token. The site's reply is parsed field by field and the site's error wording is never passed on.InvoiceEmailDtohas no workspace or licence field: the whitelist pipe rejects them.INVOICE_EMAIL_CHANGED, which stores the recipient's domain only.amcp invoices email [on|off] [--to <address> | --billing-contact] [--yes], with completion and usage.operations.tsregenerated.docs/cloud-invoices.md, plus a section in the CLI guide (en, de, it).Cloud and self-hosted
hasBillableSubscriptionrequires Cloud).Type
Testing
packages/backendnpx tsc --noEmit -p tsconfig.jsonpackages/backendnpx eslinton the changed filespackages/backendnpx jest --maxWorkers=4 src/license src/auditpackages/frontendnpx tsc --noEmit -p tsconfig.jsonpackages/frontendnpx eslint src/components/invoice-email-card.tsxpackages/frontendnpx eslint src/app/settings/license/page.tsxloadStatuseffect, not changed herepackages/frontendnpx playwright test tests/e2e/invoice-email.spec.ts tests/e2e/billing-awareness.spec.tspackages/clinpm testnode scripts/generate-cli-operations.mjs --checkNew tests:
src/license/invoice-email.spec.ts):organizationIdandlicenseKey;tests/e2e/invoice-email.spec.ts):--to,--billing-contactkeeping the switch, off, and the refusals (no request sent).Checklist
Related Issues
Relates to #1604. Deploy after the licence-site PR; until then the endpoints answer 502 "unavailable" and the card shows its load error.