Atelier: Stripe Connect for agency client payments (replace pasted keys) + live card test
Imported from GitHub issue El-SaMa/oma#136 by @El-SaMa.
Why
Agencies (Atelier resellers) take card payments from their own clients into their own Stripe account, so the card statement shows the agency, not Lanetti. Today they paste a secret key and a webhook signing secret into Settings (oma.reseller.manage_payments). That works but is clumsy and puts API keys in agencies' hands. It has also never been tested end to end with real (test-mode) keys.
Do not switch to Lanetti collecting and paying out (merchant of record): the descriptor would read Lanetti, which breaks white label, and collecting on someone else's behalf can count as a regulated payment service in the EU. Kustom/Klarna is not an option for agency clients (each agency would need its own merchant agreement).
What
- Enable Stripe Connect on Lanetti's Stripe account (operator task; needs a Lanetti Stripe account).
- Replace the paste-keys form with "Connect Stripe" (Standard connected accounts, OAuth or Account Links). Store the connected account id, not secret keys.
- Create Checkout Sessions on the connected account (
Stripe-Accountheader) so the descriptor and payout stay the agency's. Optionalapplication_fee_amountas a platform fee (decide with the operator). - One platform webhook endpoint for connected accounts (
checkout.session.completed); keep the existing guards: exact amount and currency match, idempotent mark-paid, emitsreseller.invoice.paid. - Migration path: agencies that pasted keys keep working until they reconnect; then clear the stored ciphertexts.
- End to end test in Stripe test mode: QA agency, QA client invoice, pay by card, invoice marked paid, webhook delivered.
Where
services/core-api/src/reseller/stripe.ts, tooloma.reseller.manage_payments(registry, MCP schema, confirm)apps/web/lib/reseller/client-pay.ts,apps/web/app/api/webhooks/agency-stripe/[resellerOrgId]/route.tsapps/web/components/reseller/payments-panel.tsx,pay-invoice-button.tsx- Handbook
apps/web/content/admin-docs/products/reseller.md(card payments section); terms/legal/resellersection 5 already covers it.
Done when
Connect onboarding works from the agency console, a test-mode card payment marks an agency invoice paid, the statement descriptor is the agency's, no secret keys are stored, tests and handbook updated.