Skip to content

feat: credit-based billing with monthly usage caps - #101

Merged
addidotlol merged 8 commits into
mainfrom
addison/credit-billing
Sep 1, 2026
Merged

feat: credit-based billing with monthly usage caps#101
addidotlol merged 8 commits into
mainfrom
addison/credit-billing

Conversation

@addidotlol

@addidotlol addidotlol commented Aug 14, 2026

Copy link
Copy Markdown
Member

Review in cubic

# Conflicts:
#	apps/dashboard/drizzle/meta/0029_snapshot.json
#	apps/dashboard/drizzle/meta/_journal.json
- purchaseProjectCredits passed currentQuantity + credits to billing.update, double-counting credits the customer already had; now passes the purchased amount directly
- add getProjectInvoices using the Autumn customer invoices expand
- include invoices in the billing overview response
- render invoice list with date, status, amount, and hosted invoice link
- Prevent reversing usage outside the current billing period
- Calculate monthly billing cycles using calendar months
@addidotlol
addidotlol marked this pull request as ready for review September 1, 2026 08:21
@TheHeroBrine422

Copy link
Copy Markdown
Contributor

There are still two sources of truth for billing. There is the rate/cap data that is in the vm_types table and the pricing on the autumn credit system. That is data that can get desynced and seems like a pain for maintenance.

@addidotlol

Copy link
Copy Markdown
Member Author

There are still two sources of truth for billing. There is the rate/cap data that is in the vm_types table and the pricing on the autumn credit system. That is data that can get desynced and seems like a pain for maintenance.

this is unfixable as far as I'm aware due to how autumn works unless we want to hit their (very slow) api to show pricing data. we have to handle the usage and caps ourselves which means we need to have the rates & caps to calculate it

- Lock billing meters during usage recording
- Avoid rounding exact credit-pack amounts up
Comment thread .gitignore

# local wireguard config
dev/fyra-wg.conf
core.*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnpm crash dumps, sometimes workerd will crash randomly

Comment thread dev/compose.yaml
postgres:
image: docker.io/library/postgres:17
container_name: fyra-postgres
mem_limit: 512m

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably good to have, but curious why you added them

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i oom'd lol

@addidotlol
addidotlol merged commit 3f1ab29 into main Sep 1, 2026
4 checks passed
@addidotlol
addidotlol deleted the addison/credit-billing branch September 1, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants