Legal Payment Links
CaseSolo legal payment links use Stripe Connect Checkout Sessions for invoice payments. This is separate from CaseSolo SaaS subscription billing.
Scope
- Provider: Stripe Connect.
- Entry points:
POST /api/billing/legal-payment-linksandPOST /api/dashboard/invoice-generatorwithaction: "create_payment_link". - Settlement target: the firm-configured connected Stripe account via Checkout
payment_intent_data.transfer_data.destination. - Reconciliation:
checkout.session.completedwebhooks withmetadata.type = "legal_invoice_payment"updateInvoice, createPayment, and writeActivity.
Firm Settings
Legal payment settings live under Firm.settings.legalPayments:
{
"provider": "stripe_connect",
"enabled": true,
"stripeConnectedAccountId": "acct_...",
"allowedDestinations": ["operating"],
"trustPaymentsEnabled": false,
"requireTrustManualReview": true,
"complianceDisclaimer": "Online legal payments are subject to firm review."
}
STRIPE_SECRET_KEY must be configured and stripeConnectedAccountId must be present before links can be created.
Compliance Guardrails
- Only
SENT,VIEWED,PARTIALLY_PAID, andOVERDUEinvoices are payable online. PAID,VOID,WRITTEN_OFF, and draft invoices are rejected.- Trust-destination links require
allowedDestinationsto includetrust,trustPaymentsEnabled: true, andrequireTrustManualReview: true. - Trust-destination payments are recorded with
complianceReviewRequired: true; they do not create automatic trust ledger deposits. - Webhook processing is idempotent by
firmId + stripePaymentId.
Verification
- Service tests:
src/__tests__/lib/legal-payment-links.test.ts. - API tests:
src/__tests__/api/legal-payment-links.test.ts. - Webhook regression:
src/__tests__/api/stripe-webhook-legal-payments.test.ts.