Stripe reference implementation of the payment provider pattern for the
milo-os/billing PaymentMethod and
PaymentMethodClass CRDs.
The billing service intentionally knows nothing about Stripe; it only owns
the generic PaymentMethod resource and the cluster-scoped
PaymentMethodClass registry. This service watches PaymentMethod
resources that name a PaymentMethodClass belonging to it, drives the
Stripe SetupIntent lifecycle through a provider-owned StripePaymentMethod
CRD, and projects normalized outcome state back onto PaymentMethod
status once the instrument is confirmed.
See docs/enhancements/payment-methods.md
in the billing repo for the full design.
| Resource | Scope | Purpose |
|---|---|---|
StripeProviderConfig |
Cluster | Operator-configured Stripe SDK settings (publishable key) referenced by a PaymentMethodClass.spec.parametersRef. |
StripePaymentMethod |
Namespace | Provider-owned state for a single PaymentMethod. Child of the parent PaymentMethod via ownerReference. |
StripeCustomer |
Namespace | The Stripe Customer for a BillingAccount, named after it and owned by it. status.stripeCustomerId is what invoicing providers bill, so an account with payment terms can be invoiced without a card. |
StripeProduct |
Namespace | The Stripe Product for one SKU of the catalog (or one list ServicePricing without a SKU), named and taxed as its newest list pricing. Invoice lines name it. See docs/architecture/invoicing.md. |
StripeInvoice |
Namespace | An invoice for Stripe to work out, as lines with a Product, quantity, unit price, service period and tax. It previews (Stripe's preview with nothing created, or a draft for staff to open in the dashboard, deleted after a day) or writes a real invoice: a draft kept in step with its lines, finalized on request, its payment state read from Stripe. See docs/architecture/invoicing.md. |
stripe-provider is taking over writing invoices to Stripe from OpenMeter's
Stripe app, with a Product, quantity, unit price, service period and tax
settings on every line. See
docs/architecture/invoicing.md.
- PaymentMethod watcher — watches billing
PaymentMethodresources; creates aStripePaymentMethodchild when the resource's class points at a StripePaymentMethodClass. - StripePaymentMethod controller — ensures a Stripe
Customerfor the billing account, creates aSetupIntent, writesclientSecretontoStripePaymentMethod.status.setupIntent, then projects normalized details ontoPaymentMethod.statusonce confirmation arrives. - BillingAccount controller — keeps the account's Stripe
Customerin sync with theBillingAccount, and creates it, with itsStripeCustomer, once the account has a payment method or billing reports it is billed by invoice (status.paymentArrangement). Both controllers create customers through one shared, per-account lock, so an account never gets two. While the account is on payment terms, the terms' PO number and agreement reference are printed on every invoice (invoice_settings.custom_fields). - Product controllers — give every
ServicePricingaStripeProduct, one per SKU, and keep its StripeProduct's name, tax code and active flag in step with the newest list pricing. - StripeInvoice controller — has Stripe preview a
StripeInvoice, or make it a draft for the dashboard, and deletes it, with its draft, once it expires. For a real invoice (purpose: Invoice) it keeps a Stripe draft in step with the lines, finalizes it whenspec.finalizeis set, and reads its state from Stripe until it's paid or void. - Webhook server — receives Stripe
setup_intent.*andinvoice.sentevents onPOST /webhooks/stripe. Signature-verified via the per-class webhook secret stored in theSecretreferenced byStripeProviderConfig.invoice.sentrecords anInvoiceSentEvent on the billing account's activity timeline each time Stripe emails an invoice.invoice.finalized,invoice.paid,invoice.payment_failed,invoice.payment_succeeded,invoice.voided,invoice.marked_uncollectible,invoice.deletedandinvoice.updatedhave a real invoice'sStripeInvoiceread again. The endpoint has to be subscribed to each of them in Stripe.
task install-tools
task generate
task manifests
task build
task test
task lint