DVBachsBillingProvider class
Bachs Billing for checkouts and subscriptions, with entitlements kept from webhooks.
- Implemented types
Constructors
-
DVBachsBillingProvider({required String secretKey, required String webhookSecret, required Map<
String, String> products, required Map<String, Set< entitlements, required Uri successUrl, required Uri cancelUrl, DVBillingFetch? fetch, DateTime clock()?, Duration tolerance = const Duration(minutes: 5)})Entitlement> >
Properties
- cancelUrl → Uri
-
Where Bachs sends a customer who abandons the checkout.
final
-
entitlements
→ Map<
String, Set< Entitlement> > -
Bachs product id to the entitlements buying or subscribing to it grants.
final
-
grants
→ Map<
String, Set< String> > -
Who holds what, for an entitlements view.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
products
→ Map<
String, String> -
Plan id to Bachs product id (
prod_...).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signatureHeaderName → String
-
The HTTP header this provider signs under, such as
Stripe-Signature.no setteroverride - successUrl → Uri
-
Where Bachs sends the customer after paying. Bachs appends
?checkout_id=<id>, which verifyCheckout takes.final - tolerance → Duration
-
final
Methods
-
cancelSubscription(
{required Object customer, bool atPeriodEnd = false}) → Future< void> -
Cancels now, or at the end of the paid period when
atPeriodEnd.override -
changeSubscriptionPlan(
{required Object customer, required BillingPlan plan, bool prorate = true}) → Future< void> -
Moves the subscription to
plan's product. Bachs invoices the difference now whenprorate, and bills the new price from the next cycle otherwise.override -
checkout(
{required BillingPlan plan, required Object customer}) → Future< DVBillingCheckoutSession> -
override
-
customerPortalUrl(
{required Object customer}) → Future< String> -
A fresh Bachs customer-portal session. The URL carries the session
credential, so it is handed to the customer and not logged.
override
-
handleWebhook(
String payload, String signatureHeader) → Future< DVBillingWebhookResult> -
Verifies
signatureHeaderagainstpayloadand applies the event.override -
hasEntitlement(
Object customer, Entitlement entitlement) → Future< bool> -
override
-
invoices(
Object customer, {int limit = 20}) → Future< List< DVInvoice> > -
Not supported by Bachs, and refused rather than guessed.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pauseSubscription(
{required Object customer}) → Future< void> -
Not offered by the Bachs API: a subscription can be paused only from
the Bachs dashboard.
override
-
recordUsage(
{required Object customer, required DVUsageMeter meter, required int quantity, required String idempotencyKey, DateTime? at}) → Future< void> -
Not supported by Bachs, and refused rather than dropped.
override
-
resumeSubscription(
{required Object customer}) → Future< void> -
Not offered by the Bachs API, which can cancel a subscription but not
resume one or undo a scheduled cancellation.
override
-
subscriptionStatus(
{required Object customer}) → Future< DVSubscriptionStatus> -
The subscription status for
customer, including whether it is deferred for cancellation at period end.override -
toString(
) → String -
A string representation of this object.
inherited
-
verifyCheckout(
String checkoutId) → Future< DVBachsCheckout> - Reads a checkout session back from Bachs.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited