Skip to main content

BillingController

Base path/api/billing
ModuleBilling & Platform
Endpoints6
OpenAPI tagBilling
Sourcebackend/src/main/java/com/motorph/payroll/controller/BillingController.java

Endpoints​

MethodPathRequiresHandler
GET/api/billing/subscriptionsystem.admin.billing.managegetSubscription()
POST/api/billing/checkoutsystem.admin.billing.managecreateCheckout()
POST/api/billing/change-plansystem.admin.billing.managechangePlan()
DELETE/api/billing/pending-changesystem.admin.billing.managecancelPendingChange()
POST/api/billing/portal-sessionsystem.admin.billing.manageopenCustomerPortal()
POST/api/billing/seats/syncsystem.admin.billing.managesyncSeats()

Notes​

  • POST /api/billing/checkout — Returns a checkout URL only.
  • POST /api/billing/change-plan — Moves the existing subscription to another plan: an upgrade applies now (the difference is invoiced at once), a downgrade at the next renewal.
  • DELETE /api/billing/pending-change — Drops a downgrade scheduled for renewal, keeping the current plan.
  • POST /api/billing/portal-session — A short-lived link to the payment provider's portal, to update the payment method.
  • POST /api/billing/seats/sync — Brings the billed seat count in line with today's active employees, rather than waiting for the nightly sync.
note

This controller carries one @PreAuthorize on the class, which Spring applies to every handler. 6 of its 6 endpoints inherit it rather than declaring their own.

Call chain​

Dependencies​

Constructor-injected by Lombok's @RequiredArgsConstructor: BillingService, SeatSyncService.

Tables reached​

EntityTableTenant-scoped
BillingSubscriptionbilling_subscription—
BillingWebhookEventbilling_webhook_event—
EmployeeemployeeYes
Tenanttenant—
Userusers—

Generated page

This page is rebuilt from the source on every docs build by docs-site/scripts/gen-code-wiki.mjs. Editing it has no effect — change the code, or, if what you want to say is prose, write it in docs/.