Functional contract
SaaS billing
Organization plan subscriptions, usage credits, platform invoices, and Stripe PaymentIntents — TaskPaws charging the clinic. Not clinic AR / patient invoices — see Billing and finance. Seller of record: Version Dos LLC, DBA TaskPaws.
Pricing and renewals
- Monthly amount =
plan.price_per_location_month× location count (USD cents via PaymentIntent). - Monthly credits = plan credits × locations when scoped per location, otherwise a pool;
nil= unlimited. Seeded: Starter 5,000, Business 15,000, Elite 50,000 credits per location/month. 1 credit = 1¢. - Billing day from first successful subscribe; renewals use the same calendar day (or the last day of the month).
- Charges are custom off-session PaymentIntents (not Stripe Billing Subscriptions). Customer and PaymentMethod live on
OrganizationSubscription. WebhookPOST /webhooks/stripe(payment_intent.*,charge.refunded,charge.dispute.created/.closed). Daily jobBilling::RenewDueSubscriptionsJob. - Stripe keys are in encrypted credentials (
stripe.<env>).
Trial and testing credits
- Date-based free trial (
trial_ends_on, default fromPlatformSetting.free_trial_days). - On provision: 500 testing credits on a
CreditAccount. - Subscribe ends the trial, wipes remaining testing credits, and grants plan credits × locations.
Credits lifecycle
| Event | Ledger reason |
|---|---|
| Signup | testing_signup (+500) |
| Subscribe | wipe_on_subscribe, then plan_cycle |
| Monthly renew | plan_cycle |
| Location change mid-cycle | proration (+/−) |
| Plan upgrade | plan_change |
| Auto-recharge / credit pack | auto_recharge / purchase |
| Usage fee (invoice / deposit issue) | usage_fee |
| Refund / dispute / dispute won | clawback_refund / clawback_dispute / restore_dispute |
| SuperUser adjustment | admin_adjustment (+/−) |
- Auto-recharge is mandatory (paused only during open disputes). When
balance ≤ threshold, charge face value to restore totarget. Range $10–$1,000 (1,000–100,000 credits), each recharge at least $10; minimum balance never below the plan warning threshold (or $10). - Credit packs (
Billing::CreditSale): $10 / $25 / $50 / $100 or custom at face value, max $1,000 per purchase. - Warning header when
0 < balance ≤ plan.credit_warning_threshold. Lock whenbalance ≤ 0(not unlimited), with a buy-credits gate.
Platform fee (usage credits)
Credits are spent when a clinic collection document is issued (invoice, deposit payment receipt), not on tender success. A later failed payment does not refund credits; retries of the same document do not spend twice.
Org mode (charge_platform_fee_to_clients) | Client-visible Platform fee | Credit rate |
|---|---|---|
| Charge clients | Line on the issued doc: 1% of the pre-fee collectable amount, taxed with the Location's platform_fee_tax_group at the rates effective at that Location | 1% of (pre-fee + fee taxes) |
| Absorb (default) | No line | 0.89% of the pre-fee amount |
credits = ceil(base_cents × rate). Unlimited accounts skip spend. Insufficient balance after auto-reload blocks issue. Settings → Hierarchy holds the org toggle and per-Location tax group (required when charging; only tax groups available at that Location — Organization, its Location group, or its own). Platform fee lines cannot be credited on credit notes; document void does not restore credits.
Plan upgrades and downgrades
Direction via Billing::PlanRank (price, then credits / position). Same plan is a no-op.
| Change | When | Behavior |
|---|---|---|
| Upgrade | Immediate | Prorated PaymentIntent (plan_change); credits adjust by the prorated delta; plan switches now; billing day and period unchanged; invoice PDF + email |
| Downgrade | Next renewal | Rejected while over target caps (locations, staff, clients). Otherwise pending_plan_id / pending_plan_scheduled_on; applied by Billing::PendingPlanApplier before the renewal charge |
POST /app/billing/plan_change— upgrade now or schedule downgradeDELETE /app/billing/plan_change— cancel pending downgradeGET /api/v1/billing— includesplan_keyand pending plan fieldsPATCH /admin/organizations/:id(plan_id) usesBilling::PlanChangewhen subscribed; entitlement-only otherwise
Other lifecycle
- Mid-cycle location proration — money and credits for the remaining fraction;
location_prorationtransaction, invoiced when money moves. - Refunds / disputes — credit clawback (restored if the dispute is won).
- Invoice PDFs — TaskPaws brand; Version Dos LLC only in the footer.
UI
- Settings → Billing (
/app/settings?tab=billing;/app/billingredirects): sections Subscription & credits, Transactions, Invoices. Subscribe & pay (Stripe Elements), card, change plan, pending banner, buy credits (POST /app/billing/credit_pack), auto-recharge sliders (PATCH /app/billing/credit_auto_recharge). Feature keysettings.billing. - Choose a plan disables plans that cannot cover current location / staff / client / legal-entity counts. Landing
?plan=pre-selects the trial plan. /admin/billing_transactions— past and upcoming charges. Admin Organizations directory: plan dropdown and a Credits column for signed SuperUser adjustments (not on unlimited accounts).
Out of scope: clinic Connect payouts, annual plans, Stripe Tax, Customer Portal. Full contract: docs/functional/saas-billing.md.