Namespace VpnHood.AppLib.Abstractions.Billing
Classes
- AppBilling
The in-app purchase capability of an account provider. Purchasing always needs both sides: the store that collects the payment and the backend that reconciles the order and delivers access. Which products the store is asked to price is the backend's answer too — GetProductIds(CancellationToken).
- BillingException
A store billing failure in store-agnostic vocabulary. Every IBillingProvider translates its store's own errors into a BillingErrorCode here, so nothing above the provider — the app, the client API, the UI — ever learns which store failed or how that store spells its errors. Data carries the code and the store's own message across the client API (the UI reads Data["BillingErrorCode"] / Data["StoreMessage"]).
- PurchaseAttribution
What the store must be told before it takes a payment, so the order comes back tied to its buyer — and so a store token stolen from one device cannot be redeemed into another account.
A type rather than a bare string because it is what IOrderProcessor answers and what IBillingProvider is then handed: on neither side is there a parameter or property name to say which of a purchase's several ids is meant, so the type says it.
- PurchaseParams
What the buyer chose. Everything the app attaches on the buyer's behalf travels beside it, in PurchaseAttribution, so this carries nothing the caller is not entitled to set.
- PurchaseProof
The store's own evidence that a purchase happened — a Play purchase token, an App Store signed transaction (JWS). A pointer, not a claim: the backend presents it back to the store's API and believes the store's answer, never this string.
A type rather than a bare string because it is what IBillingProvider answers, and a return value has no parameter name to say which of a purchase's several strings is meant. The order id is the tempting wrong one, and it fails at the backend rather than here.
- StoreIds
Well-known store ids — the billing counterpart of AuthProviders, and the same kind of contract: a free-form lowercase STRING self-declared by the app's IBillingProvider, deliberately not an enum, so a third-party store can introduce its own id without a change to this library.
The id is consumed verbatim by the account backend: it selects which app row a purchase belongs to, which store API re-verifies the proof, and which subscriptions this device may manage. Changing one is a breaking change on the wire.
- SubscriptionPlan
Represents a subscription's plan as the store prices it, in the currency the store quotes.
Interfaces
- IBillingProvider
The calls that take the window get null where none is open, as in the desktop service: a store whose sheet needs one fails then, and the web store, whose checkout the UI opens, needs none.
- IOrderProcessor
Backend-specific purchase reconciliation. The billing provider talks to the platform store; the order processor talks to the account backend before and after the store purchase.
Enums
- BillingErrorCode
The store-agnostic vocabulary for billing failures. Providers translate their store's own error codes into these; the UI branches on nothing finer. Anything a store can say that has no user-meaningful bucket here is Unknown — the store's own message still travels with the exception for display and logs, it just never becomes a branch.
- PurchaseState
Specifies where the store's payment flow stands.