DVStripeBillingProvider class
Stripe Checkout for subscriptions, with entitlements kept from webhooks.
- Implemented types
Constructors
-
DVStripeBillingProvider({required String secretKey, required String webhookSecret, required Map<
String, String> prices, required Map<String, Set< entitlements, required Uri successUrl, required Uri cancelUrl, Map<Entitlement> >String, String> meters = const <String, String>{}, DVBillingFetch? fetch, DateTime clock()?, Duration tolerance = const Duration(minutes: 5)})
Properties
- cancelUrl → Uri
-
final
-
entitlements
→ Map<
String, Set< Entitlement> > -
Stripe price id to the entitlements a subscription 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
-
meters
→ Map<
String, String> -
Meter id to the Stripe billing meter's
event_name.final -
prices
→ Map<
String, String> -
Plan id to Stripe price id.
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
-
final
- tolerance → Duration
-
How old a webhook signature may be. Stripe's own libraries use five
minutes; older is a replay.
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 price, prorated unlessprorateis false. The existing item is replaced rather than a second one added.override -
checkout(
{required BillingPlan plan, required Object customer}) → Future< DVBillingCheckoutSession> -
override
-
customerPortalUrl(
{required Object customer}) → Future< String> -
A Stripe Billing customer-portal link, coming back to successUrl.
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> > -
Verifies and applies a webhook.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pauseSubscription(
{required Object customer}) → Future< void> -
Pauses payment collection. Stripe keeps the subscription and its
access rules; invoices it would have charged are voided until resumed.
override
-
recordUsage(
{required Object customer, required DVUsageMeter meter, required int quantity, required String idempotencyKey, DateTime? at}) → Future< void> -
Records
quantityagainstmeterforcustomer.override -
resumeSubscription(
{required Object customer}) → Future< void> -
Undoes a pause and a pending cancellation: billing carries on as before.
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
-
verifyEvent(
String payload, String signatureHeader) → Map< String, Object?> -
Verifies
signatureHeaderagainstpayloadand returns the event it carries, without applying it.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited