Billing
This page explains how organisations pay for Mainworthy on instances that sell subscriptions, such as hosted instances. Checkout adds any sales tax or VAT the buyer owes. The buyer receives receipts and invoices by email. Mainworthy never sees the card. Self-hosted instances sell no subscriptions and show no billing controls. See the privacy policy for who processes payments.
Subscribe an organisation #
If you hold admin across the organisation's projects, you can manage its subscription. In Settings, open
Billing to see the price. To pay for this organisation, choose Subscribe to open checkout in the same tab.
The instance's configuration sets the price. The browser cannot change it.
After you pay, checkout returns you to Billing. The organisation counts as paid once the instance receives confirmation of the payment. Until then, Billing shows that it is waiting. The status updates without a reload, usually within seconds.
| The section says | What it means |
|---|---|
| the price, and Subscribe | The organisation has no subscription. |
| Continue to checkout | A checkout started in the last day is still open. It opens the same checkout, so the organisation is not charged twice. |
| The last payment was declined | The checkout stays open for another card. |
| The payment went through and the subscription is being confirmed | Paddle took the payment. Mainworthy refuses another checkout while it waits for subscription confirmation. |
| Paid, with the next payment's date | The subscription is active. |
| Paid, but the last payment did not go through | A renewal failed. Paddle is retrying it. |
| The subscription ends on a date | The cancellation takes effect at the end of the period. |
| The last subscription has ended | It was canceled. Subscribe starts a new one. |
An organisation that has a subscription cannot start a second checkout. If you hold admin across the organisation's projects, you can read the same status with mainworthy billing, and mainworthy subscribe prints the checkout's address.
One person may pay for several organisations. Each organisation keeps its own subscription.
Set up billing on an instance #
If you run an instance, Paddle handles payments. Paddle sells the subscription as merchant of record. It takes payment, adds sales tax or VAT, sends receipts and invoices, and handles refunds and disputes. One person who pays for several organisations may appear in Paddle as one customer.
Billing stays off until you set all five MAINWORTHY_PADDLE_* variables.
Make these changes in Paddle's dashboard for the environment you configure.
- Create the product and its price. The price's id (
pri_...) isMAINWORTHY_PADDLE_PRICE. - Set the default payment link on its own host, separate from the instance's address. Paddle requires this link before it makes any transaction.
- Create a hosted checkout. Set its redirect to the instance's public address followed by
/billing/return. Its link (https://pay.paddle.io/hsc_..., orsandbox-pay.paddle.ioin the sandbox) isMAINWORTHY_PADDLE_CHECKOUT. - Create an API key with permission to write transactions and read subscriptions, prices, and notification
settings. The key is
MAINWORTHY_PADDLE_API_KEY. - Add a notification destination at the instance's public address followed by
/api/billing-event, for thesubscription.*andtransaction.*events. Its secret key isMAINWORTHY_PADDLE_WEBHOOK_SECRET.
The server checks the billing configuration at startup. The API key and hosted checkout link must match the configured environment. The webhook secret must have the format Paddle issues. The server refuses to start if any of these checks fail. Before accepting notifications, the server asks Paddle's API to confirm that the secret belongs to a notification destination on the account.
How a payment becomes a subscription #
- To open a checkout, the server creates a Paddle transaction at the configured price. The transaction's custom data contains the organisation's ID and a new checkout ID.
- Paddle signs each notification. The server accepts a notification only when the signature matches the destination's secret and Paddle signed it within five seconds. The server refuses a request whose signature header is malformed or too old before reading the body. The body must arrive within five seconds. Even if Paddle delivers an event more than once, the server applies it only once.
- For a subscription event, the server fetches and keeps the subscription details from Paddle's API. To link the subscription to an organisation, Paddle's record must name the organisation and a checkout the server made for it. The price must match the price of that checkout.
- If two checkouts are paid at once, Paddle can create a second subscription for the same organisation. The server refuses to link the second subscription to that organisation. The operator refunds it in Paddle.
- The return address from Paddle contains the buyer's email. The page removes the email from the address as it loads. Mainworthy never logs that email.
The server records the Paddle environment and notification destination for each checkout, subscription, and event. Only records for the configured account count. If you switch from sandbox to live or move to another account, each organisation starts at the offer. If you switch back, the instance uses the previous account's records again. Rotating a destination's secret in Paddle keeps the account. Replacing the destination changes it. Billing records belong to the instance's Paddle account. An archive excludes those records, and importing an archive clears them.