IBeam.Billing
2.9.45
dotnet add package IBeam.Billing --version 2.9.45
NuGet\Install-Package IBeam.Billing -Version 2.9.45
<PackageReference Include="IBeam.Billing" Version="2.9.45" />
<PackageVersion Include="IBeam.Billing" Version="2.9.45" />
<PackageReference Include="IBeam.Billing" />
paket add IBeam.Billing --version 2.9.45
#r "nuget: IBeam.Billing, 2.9.45"
#:package IBeam.Billing@2.9.45
#addin nuget:?package=IBeam.Billing&version=2.9.45
#tool nuget:?package=IBeam.Billing&version=2.9.45
IBeam.Billing
IBeam.Billing contains provider-neutral billing contracts and commercial-state models for IBeam-backed applications.
Install this package when shared code needs to describe checkout offers, total-seat pricing, customers, subscriptions, invoices, prices, payment method references, and billing-provider events without taking a dependency on a payment provider or licensing service.
dotnet add package IBeam.Billing
Billing Versus Licensing
Billing answers commercial questions:
- Who is the billing customer?
- What subscription, invoice, contract, marketplace purchase, or support-managed arrangement exists?
- Which provider customer, price, payment method, invoice, or event does this record map to?
- What happened commercially, and what should a reconciler do next?
Licensing answers runtime grant questions:
- Which tenant has the durable product grant?
- Which entitlements are available?
- Which seats are assigned?
- Is the grant currently eligible for runtime use?
Billing should not directly authorize runtime API calls. A reconciler can translate billing events into licensing grants, renewals, suspensions, revocations, seat quantities, and credit grants. Runtime services should continue to enforce access through Licensing and Credits.
Billing Modes
Use BillingModes to represent the commercial model without hard-coding a provider:
| Mode | Meaning |
|---|---|
self-service-monthly |
A user or tenant buys and renews through a checkout/customer portal flow. |
annual-contract |
A contracted tenant account with annual or custom terms. |
manual-invoice |
A tenant is invoiced manually or through an accounting process. |
marketplace |
Billing is managed by an external marketplace. |
support-managed |
Support or operations manually controls the commercial record. |
Core Models
| Area | Type(s) | Purpose |
|---|---|---|
| Checkout offers | BillingOfferInfo, BillingOfferSeatPolicyInfo, BillingOfferPricingInfo |
Provider-neutral product/plan offers with one-license total-seat rules and flat or graduated pricing. |
| Checkout gateways | IBillingCheckoutGateway, IBillingCheckoutGatewayResolver |
Provider-neutral hosted checkout, status, customer portal, and webhook-verification contracts. |
| Provider bindings | BillingProviderBindingInfo |
Opaque provider references that can be replaced without becoming IBeam billing or license identity. |
| Pending purchases | BillingPurchaseInfo, CreatePendingBillingPurchaseRequest, IBillingPurchaseService |
Records a public purchase before an Identity user or tenant exists. |
| Customers | BillingCustomerInfo, CreateBillingCustomerRequest |
Tenant-owned billing profile with optional buying user and provider customer reference. |
| Subscriptions | BillingSubscriptionInfo, CreateBillingSubscriptionRequest |
Commercial subscription or contract state, optional plan key, seats, provider subscription, and price reference. |
| Invoices | BillingInvoiceInfo, CreateBillingInvoiceRequest |
Invoice state, amounts, due/paid dates, hosted invoice reference, and provider invoice reference. |
| Payment methods | BillingPaymentMethodReferenceInfo |
Safe payment method pointer such as provider id, card brand, and last four digits. |
| Prices | BillingPriceReferenceInfo |
Provider price reference with product/plan keys but no dependency on Licensing. |
| Provider events | BillingProviderEventInfo, RecordBillingProviderEventRequest |
Provider webhook or marketplace event metadata with a provider/id based idempotency key. |
| Contracts | IBillingCustomerService, IBillingSubscriptionService, IBillingInvoiceService, IBillingProviderEventService, IBillingStore |
Service and persistence boundaries for future implementations. |
Offers And Total Seats
An offer quote always represents one license. TotalSeats is the complete seat limit for that license, not an add-on quantity.
var teamOffer = BillingOfferInfo.Create(
key: "hubbsly-pro-monthly",
productKey: "hubbsly",
planKey: "hubbsly-pro",
displayName: "Hubbsly Pro",
description: null,
billingPeriod: "monthly",
currency: "USD",
seatPolicy: BillingOfferSeatPolicyInfo.Create(
defaultTotalSeats: 3,
minimumTotalSeats: 3),
pricing: BillingOfferPricingInfo.Create(perSeatAmount: 25m));
var quote = teamOffer.Quote(requestedTotalSeats: 3);
// LicenseQuantity = 1, TotalSeats = 3, TotalAmount = 75
An individual offer uses a default and minimum of one. It can still expand later by quoting a higher total-seat quantity.
Checkout Provider Boundary
Provider adapters implement IBillingCheckoutGateway. The core request carries the IBeam correlation id, offer key, total seats, and return URLs; the adapter returns opaque provider references and hosted URLs.
var gateway = gatewayResolver.Resolve("stripe");
var session = await gateway.CreateCheckoutSessionAsync(
CreateBillingCheckoutSessionRequest.Create(
correlationId: purchaseId,
offerKey: "hubbsly-pro-monthly",
totalSeats: 3,
successUrl: new Uri("https://app.example.com/purchase/success"),
cancelUrl: new Uri("https://app.example.com/plans")));
The same contracts can be implemented by Stripe, PayPal, a marketplace, or an application-owned processor. VerifyWebhookAsync must only return a BillingVerifiedWebhookInfo after the adapter verifies the provider signature. Normalizing verified events and mutating Billing/Licensing state belong to later orchestration layers.
Purchases Before Identity
BillingPurchaseInfo can represent checkout and payment before the buyer has an IBeam user or tenant. TenantId, UserId, and LicenseKey remain empty until later fulfillment and claiming workflows link them.
Purchase creation is idempotent by CorrelationId. Provider updates are idempotent by provider name plus provider event id, so replayed events resolve to the original purchase rather than creating another purchase or future license grant.
Buyer email is normalized for matching but should be retained only as long as the host's onboarding, tax, support, and legal policies require. Call RedactBuyerEmailAsync after the applicable retention window; it removes the email while preserving financial and audit state. Do not place addresses, payment details, raw provider payloads, claim secrets, or access tokens in Metadata.
Tenant And User Ownership
Every durable billing record is tenant-scoped. Records may also carry an optional UserId for single-user purchases, buyer attribution, or account owner display. Enterprise and marketplace flows can leave UserId empty while still linking records to the tenant.
Provider Boundaries
Provider-specific payloads should not live in these public models. Store raw webhook bodies in an app-controlled blob/table and put the safe pointer in PayloadReference. Keep provider secrets and signing keys outside the repository and outside billing records.
Package Relationships
| Package | Role |
|---|---|
IBeam.Billing |
Core commercial contracts and models. |
IBeam.Billing.Services |
Future service-layer orchestration and in-memory store. |
IBeam.Billing.Api |
Future optional ASP.NET Core endpoints. |
IBeam.Licensing |
Runtime license grants and entitlements, independent of Billing. |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on IBeam.Billing:
| Package | Downloads |
|---|---|
|
IBeam.Commerce.Repositories.AzureTable
Azure Table Storage providers for IBeam licensing, billing, and credit stores. |
|
|
IBeam.Billing.Licensing
Provider-agnostic reconciliation from IBeam billing state into IBeam license grants. |
|
|
IBeam.Billing.Services
Billing services, provider-event ingestion, and in-memory store for IBeam-backed applications. |
|
|
IBeam.Billing.Stripe
Optional Stripe checkout and verified webhook adapter for IBeam Billing. |
GitHub repositories
This package is not used by any popular GitHub repositories.