onmetal-dev / metal

bare metal PaaS
https://www.onmetal.dev
GNU Affero General Public License v3.0
4 stars 0 forks source link

set up billing #52

Open rgarcia opened 5 months ago

rgarcia commented 5 months ago

current plan is to charge 10% of Hetzner spend. Here are some ways we could do this:

  1. Scrape the user's invoices page and generate our own invoice that is 10% of that.
    1. pros: pretty simple (I already have a scraper written)
    2. cons:
      1. requires collecting a user's username/password/otp for hetzner
      2. not sure if there's a way to separate out usage in the invoice that is Metal-related vs. not
  2. Replicate Hetzner's billing logic. E.g., set up usage based billing https://docs.stripe.com/billing/subscriptions/usage-based, copy over Hetzner's pricing rates (10% of the rate) https://docs.hetzner.cloud/#pricing, then write some kind of recurring job that uses the Hetzner API key that users give us to poll for running resources we'd like to bill
    1. pros: pretty complete. Also lets us wait until a user has a significant enough bill to actually start billing them.
    2. cons: complicated… would probably also require some kind of tagging approach so that we only bill for Hetzner resources we created. The polling mechanism would need to track state so that it only meters the amount of usage since the last time it polled. E.g. some kind of table that tracks a hetzner resource ID and the last time it was billed.
  3. Other ideas?
linear[bot] commented 5 months ago

MET-33 set up billing