DVPaddleBillingProvider class

Paddle Billing (the v2 API) for subscriptions, with entitlements kept from webhooks.

Implemented types

Constructors

DVPaddleBillingProvider({required String apiKey, required String webhookSecret, required Map<String, String> prices, required Map<String, Set<Entitlement>> entitlements, DVBillingFetch? fetch, DateTime clock()?, Duration tolerance = const Duration(minutes: 5)})

Properties

entitlements → Map<String, Set<Entitlement>>
Paddle price id to the entitlements a subscription to it grants.
final
grants → Map<String, Set<String>>
no setter
hashCode → int
The hash code for this object.
no setterinherited
prices → Map<String, String>
Plan id to Paddle 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
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>
Replaces the subscription's items with plan's price. Paddle bills the difference now when prorate, and the full price from the next period otherwise.
override
checkout({required BillingPlan plan, required Object customer}) → Future<DVBillingCheckoutSession>
override
customerPortalUrl({required Object customer}) → Future<String>
A Paddle customer-portal link (the general overview page).
override
handleWebhook(String payload, String signatureHeader) → Future<DVBillingWebhookResult>
Verifies signatureHeader against payload and 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. signatureHeader is Paddle-Signature. Paddle's transactions are its invoices.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pauseSubscription({required Object customer}) → Future<void>
Pauses from the next billing period, as Paddle recommends, so the period already paid for is not cut short.
override
recordUsage({required Object customer, required DVUsageMeter meter, required int quantity, required String idempotencyKey, DateTime? at}) → Future<void>
Not implemented for Paddle, and loudly so.
override
resumeSubscription({required Object customer}) → Future<void>
Resumes a paused subscription straight away. A cancellation scheduled for the period end is removed by clearing the scheduled change.
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

Operators

operator ==(Object other) → bool
The equality operator.
inherited