Versions in this module Expand all Collapse all v0 v0.1.0 Dec 5, 2026 Changes in this version + const DefaultSubscriptionName + const EventInvoiceActionRequired + const EventInvoicePaymentFailed + const EventTrialWillEnd + const MaxWebhookBody + const MetaBillable + const MetaName + const MetaPlan + const Unlimited + var ErrAlreadySubscribed = errors.New("tally: already subscribed") + var ErrBadSignature = errors.New("tally: webhook signature invalid") + var ErrCardDeclined = errors.New("tally: payment declined") + var ErrCreditAmount = errors.New("tally: credit amount must be positive") + var ErrForbidden = errors.New("tally: forbidden") + var ErrIneligible = errors.New("tally: not eligible for plan") + var ErrInsufficientCredits = errors.New("tally: insufficient credits") + var ErrNoSubscription = errors.New("tally: no subscription") + var ErrNotFound = errors.New("tally: not found") + var ErrNotOnGracePeriod = errors.New("tally: subscription is not on its grace period") + var ErrPriceNotSynced = errors.New("tally: price not synced to the provider") + var ErrQuantity = errors.New("tally: quantity outside plan bounds") + var ErrRefundTooLarge = errors.New("tally: refund exceeds the allowed amount") + var ErrTrialUsed = errors.New("tally: trial already used") + var ErrUnknownKind = errors.New("tally: unknown billable kind") + var ErrUnknownPlan = errors.New("tally: unknown plan") + var ErrUnsupported = errors.New("tally: not supported by the provider") + var PastDueAllow = PastDuePolicy + var PastDueBlock = PastDuePolicy + func AvailableCredits(entries []CreditEntry, asOf time.Time) int64 + func PerSeat() interface + func RequireFeature(svc *Service, refFromReq RefFunc, feature string, onDeny http.Handler) func(http.Handler) http.Handler + func RequirePlan(svc *Service, refFromReq RefFunc, planKey string, onDeny http.Handler) func(http.Handler) http.Handler + func RequireSubscription(svc *Service, refFromReq RefFunc, onDeny http.Handler) func(http.Handler) http.Handler + func Version(v int) interface + type ActionRequired struct + ClientSecret string + SubscriptionID string + URL string + func (a *ActionRequired) Error() string + type ActionRequiredEvent struct + URL string + func (ActionRequiredEvent) EventName() string + type Address struct + City string + Country string + Line1 string + Line2 string + PostalCode string + State string + type Authorizer func(ctx context.Context, ref BillableRef) error + type Banner struct + ActionLabel string + ActionURL string + EndsAt time.Time + Message string + Title string + Tone BannerTone + type BannerTone string + const BannerActionRequired + const BannerGracePeriod + const BannerPastDue + const BannerTrialing + type Billable interface + BillableRef func() BillableRef + BillingEmail func() string + BillingName func() string + type BillableRef struct + ID string + Type string + func ParseBillableRef(s string) (BillableRef, error) + func Ref(typ, id string) BillableRef + func (r BillableRef) IsZero() bool + func (r BillableRef) String() string + type BillingAddresser interface + BillingAddress func() Address + type BillingLocaler interface + BillingLocale func() string + BillingTimeZone func() *time.Location + type CallOption func(*callConfig) + func Billed(i Interval) CallOption + func IdempotencyKey(k string) CallOption + func Named(name string) CallOption + func NoProrate() CallOption + func ProrateNow() CallOption + func ResetBillingCycle() CallOption + func Seats(n int64) CallOption + func SkipTrial() CallOption + func TrialUntil(t time.Time) CallOption + func WithDiscount(d Discount) CallOption + func WithMetadata(m map[string]string) CallOption + func WithPaymentMethod(token string) CallOption + type Canceled struct + AtPeriodEnd bool + EndsAt time.Time + func (Canceled) EventName() string + type Catalog struct + func BuildCatalog(plans ...*PlanDef) (*Catalog, error) + func NewCatalog(plans ...*PlanDef) *Catalog + func (c *Catalog) Plan(key string) (*PlanDef, bool) + func (c *Catalog) Plans() []*PlanDef + func (c *Catalog) Price(lookupKey string) (*PriceDef, bool) + func (c *Catalog) Prices() []*PriceDef + type CatalogSyncer interface + SyncCatalog func(ctx context.Context, c *Catalog, opts SyncOptions) (SyncPlan, error) + type CheckoutItem struct + Amount Money + CustomAmount *CustomAmount + Interval Interval + Name string + PriceID string + Quantity int64 + type CheckoutMode string + const CheckoutPayment + const CheckoutSetup + const CheckoutSubscription + type CheckoutRequest struct + AllowPromotionCodes bool + AutomaticTax bool + CancelURL string + Discounts []Discount + IdempotencyKey string + Interval Interval + Items []CheckoutItem + Locale string + Metadata map[string]string + Mode CheckoutMode + Name string + Plan string + Quantity int64 + SkipTrial bool + SuccessURL string + TaxIDCollection bool + type CheckoutResult struct + ClientReferenceID string + Customer string + ID string + Metadata map[string]string + PaymentStatus string + Status string + SubscriptionID string + type Comped struct + Until time.Time + func (Comped) EventName() string + type CreateSubscription struct + AutomaticTax bool + Customer string + Discounts []Discount + IdempotencyKey string + Metadata map[string]string + PaymentMethod string + Prices []SubscriptionPrice + TrialEnd time.Time + type CreditDebitParams struct + Amount int64 + IdempotencyKey string + Reason string + Ref string + type CreditEntry struct + BalanceAfter int64 + Billable BillableRef + CreatedAt time.Time + Delta int64 + ExpiresAt *time.Time + ID string + IdempotencyKey string + Reason string + Ref string + type CreditEvent struct + At time.Time + Entry CreditEntry + func (e CreditEvent) BillableRef() BillableRef + type CreditGrantParams struct + Amount int64 + ExpiresAt *time.Time + IdempotencyKey string + Reason string + Ref string + type CreditStore interface + CreditBalance func(ctx context.Context, ref BillableRef, asOf time.Time) (int64, error) + ListCreditEntries func(ctx context.Context, ref BillableRef, p Page) ([]CreditEntry, error) + RecordCreditDebit func(ctx context.Context, e *CreditEntry) (bool, error) + RecordCreditGrant func(ctx context.Context, e *CreditEntry) (bool, error) + type CreditsDebited struct + func (CreditsDebited) EventName() string + type CreditsGranted struct + func (CreditsGranted) EventName() string + type CreditsLowBalance struct + Balance int64 + Threshold int64 + func (CreditsLowBalance) EventName() string + type CustomAmount struct + Max Money + Min Money + Suggested Money + type Customer struct + Billable BillableRef + CreatedAt time.Time + Email string + ID string + Metadata map[string]string + Name string + Provider ProviderName + ProviderID string + TaxExempt bool + UpdatedAt time.Time + type CustomerQuery struct + Limit int + Offset int + Provider ProviderName + Search string + type DecodedEvent struct + Created time.Time + ID string + ObjectID string + ObjectType ObjectType + Type string + type Discount struct + Coupon string + PromotionCode string + func CouponCode(id string) Discount + func PromotionCode(id string) Discount + type Dispatcher func(ctx context.Context, tx any, ref EventRef) error + type DomainEvent interface + BillableRef func() BillableRef + EventName func() string + func Apply(prev *Subscription, next Subscription) []DomainEvent + func ApplyInvoice(prev *Invoice, next Invoice, at time.Time) []DomainEvent + type EligibilityFunc func(ctx context.Context, b Billable, plan *PlanDef) error + type Ended struct + func (Ended) EventName() string + type EventRef struct + EventID string + ID string + Provider ProviderName + Type string + type GenericTrial struct + Billable BillableRef + CreatedAt time.Time + Plan string + TrialEndsAt time.Time + func (g GenericTrial) Active(now time.Time) bool + type Interval string + const IntervalMonth + const IntervalYear + type Invoice struct + ActionRequired bool + AmountDue Money + AmountPaid Money + AmountRefunded Money + Billable BillableRef + CreatedAt time.Time + CustomerID string + HostedURL string + ID string + Number string + PDFURL string + PaidAt time.Time + PeriodEnd time.Time + PeriodStart time.Time + Provider ProviderName + ProviderCustomerID string + ProviderID string + ProviderSubscriptionID string + Status InvoiceStatus + SubscriptionID string + Total Money + type InvoiceEvent struct + At time.Time + Invoice Invoice + func (e InvoiceEvent) BillableRef() BillableRef + type InvoiceLine struct + Amount Money + Description string + PriceLookupKey string + Proration bool + Quantity int64 + type InvoicePaid struct + func (InvoicePaid) EventName() string + type InvoicePaymentFailed struct + func (InvoicePaymentFailed) EventName() string + type InvoicePreview struct + AmountDue Money + Lines []InvoiceLine + PeriodEnd time.Time + Subtotal Money + Total Money + type InvoiceQuery struct + Billable BillableRef + CustomerID string + Limit int + Offset int + Status InvoiceStatus + SubscriptionID string + type InvoiceStatus string + const InvoiceDraft + const InvoiceOpen + const InvoicePaidStatus + const InvoiceUncollectible + const InvoiceVoid + type Invoicer interface + Invoice func(ctx context.Context, id string) (Invoice, error) + Invoices func(ctx context.Context, customer string, p Page) ([]Invoice, error) + UpcomingInvoice func(ctx context.Context, customer, subscriptionID string) (InvoicePreview, error) + type KindDef struct + Name string + Resolver Resolver + func Kind(name string, resolver Resolver, opts ...KindOption) KindDef + type KindOption func(*KindDef) + func Authorize(fn Authorizer) KindOption + func Eligible(fn EligibilityFunc) KindOption + type Lens string + const LensActive + const LensAll + const LensComped + const LensEnded + const LensGrace + const LensPastDue + const LensTrialing + type Listener func(ctx context.Context, tx any, e DomainEvent) error + type MeterEvent struct + Customer string + EventName string + Identifier string + Quantity int64 + Timestamp time.Time + type Meterer interface + ReportUsage func(ctx context.Context, e MeterEvent) error + UsageSummary func(ctx context.Context, q UsageQuery) (UsageSummary, error) + type Metrics struct + ARR Money + Active int + Churned int + Comped int + MRR Money + OnGrace int + PastDue int + PlanMix []PlanCount + Trialing int + func (m Metrics) ChurnRateBP() int + type MetricsQuery struct + ChurnWindow time.Duration + CreatedBy time.Time + Currency string + Now time.Time + type Money struct + Amount int64 + Currency string + func EUR(cents int64) Money + func GBP(pence int64) Money + func NewMoney(amount int64, currency string) Money + func USD(cents int64) Money + func (m Money) Add(o Money) (Money, error) + func (m Money) Format() string + func (m Money) IsZero() bool + func (m Money) Mul(n int64) Money + func (m Money) String() string + type ObjectType string + const ObjectCheckoutSession + const ObjectCustomer + const ObjectInvoice + const ObjectOther + const ObjectSubscription + type Option func(*Service) + func WithCatalog(c *Catalog) Option + func WithClock(now func() time.Time) Option + func WithDispatcher(d Dispatcher) Option + func WithExemptCheck(fn func(ctx context.Context, ref BillableRef) bool) Option + func WithKinds(kinds ...KindDef) Option + func WithListener(ls ...Listener) Option + func WithLowBalanceThreshold(n int64) Option + func WithMaxRefundAmount(m Money) Option + func WithPastDuePolicy(p PastDuePolicy) Option + type Page struct + After string + Limit int + type PastDuePolicy struct + func PastDueAllowFor(d time.Duration) PastDuePolicy + func (p PastDuePolicy) Grace() time.Duration + type Pauser interface + PauseSubscription func(ctx context.Context, subscriptionID string, resumesAt time.Time) (Subscription, error) + UnpauseSubscription func(ctx context.Context, subscriptionID string) (Subscription, error) + type PaymentFailed struct + func (PaymentFailed) EventName() string + type PaymentMethod struct + Brand string + ExpMonth int + ExpYear int + Last4 string + Type string + type PaymentMethods interface + DefaultPaymentMethod func(ctx context.Context, customer string) (*PaymentMethod, error) + type PlanCount struct + Count int + Plan string + type PlanDef struct + Addon bool + Description string + Features []string + Hidden bool + Key string + Limits map[string]int64 + MaxSeats int64 + MinSeats int64 + Name string + Popular bool + Prices []*PriceDef + TrialDays int + Version int + func Addon(key, name string, opts ...PlanOption) *PlanDef + func Plan(key, name string, opts ...PlanOption) *PlanDef + func (d *PlanDef) HasFeature(feature string) bool + func (d *PlanDef) LimitValue(key string) (int64, bool) + func (d *PlanDef) MeteredPrices() []*PriceDef + func (d *PlanDef) Price(interval Interval) (*PriceDef, bool) + func (d *PlanDef) SubscribePrices(interval Interval) []*PriceDef + type PlanOption interface + func Description(s string) PlanOption + func Features(names ...string) PlanOption + func Hidden() PlanOption + func Limit(key string, v int64) PlanOption + func MaxSeats(n int64) PlanOption + func MinSeats(n int64) PlanOption + func Popular() PlanOption + func TrialDays(n int) PlanOption + type PriceDef struct + Amount Money + Interval Interval + Legacy bool + MeterEvent string + MeterKey string + Metered bool + PerSeat bool + Plan string + UnitAmount Money + Version int + func Metered(meterKey string, opts ...PriceOption) *PriceDef + func Monthly(m Money, opts ...PriceOption) *PriceDef + func Yearly(m Money, opts ...PriceOption) *PriceDef + func (p *PriceDef) Currency() string + func (p *PriceDef) LookupKey() string + type PriceMapping struct + Active bool + LookupKey string + Provider ProviderName + ProviderPriceID string + ProviderProductID string + type PriceOption interface + func Meter(name string) PriceOption + func PerUnit(m Money) PriceOption + type Proration string + const ProrationDefault + const ProrationNone + const ProrationNow + type Provider interface + Checkout func(ctx context.Context, req ProviderCheckout) (Redirect, error) + CheckoutSession func(ctx context.Context, id string) (CheckoutResult, error) + EnsureCustomer func(ctx context.Context, b Billable, existing string) (string, error) + Name func() ProviderName + Portal func(ctx context.Context, customer, returnURL string) (Redirect, error) + Subscription func(ctx context.Context, id string) (Subscription, error) + Webhook func() WebhookDecoder + type ProviderCheckout struct + AllowPromotionCodes bool + AutomaticTax bool + CancelURL string + ClientReferenceID string + Customer string + Discounts []Discount + Email string + IdempotencyKey string + Items []CheckoutItem + Locale string + Metadata map[string]string + Mode CheckoutMode + SubscriptionMetadata map[string]string + SuccessURL string + TaxIDCollection bool + TrialEnd time.Time + type ProviderName string + const ProviderFake + const ProviderPaddle + const ProviderPolar + const ProviderStripe + type QuantityChanged struct + From int64 + To int64 + func (QuantityChanged) EventName() string + type ReconcileReport struct + Checked int + Created int + Events int + type Redirect struct + ID string + URL string + type RefFunc func(r *http.Request) (ref BillableRef, ok bool) + type Refund struct + Amount Money + ID string + Invoice string + Status string + type RefundRequest struct + Amount Money + IdempotencyKey string + Invoice string + Reason string + type Refunded struct + Actor string + Amount Money + Reason string + func (Refunded) EventName() string + type Refunder interface + Refund func(ctx context.Context, req RefundRequest) (Refund, error) + type Resolver func(ctx context.Context, ref BillableRef) (Billable, error) + type Resumed struct + func (Resumed) EventName() string + type Service struct + func New(provider Provider, store Store, opts ...Option) *Service + func (s *Service) ActiveSubscriptions(ctx context.Context, ref BillableRef) ([]Subscription, error) + func (s *Service) Authorize(ctx context.Context, ref BillableRef) error + func (s *Service) Banner(ctx context.Context, ref BillableRef) (*Banner, error) + func (s *Service) Can(ctx context.Context, ref BillableRef, feature string) (bool, error) + func (s *Service) Cancel(ctx context.Context, ref BillableRef, opts ...CallOption) (Subscription, error) + func (s *Service) CancelNow(ctx context.Context, ref BillableRef, opts ...CallOption) (Subscription, error) + func (s *Service) Catalog() *Catalog + func (s *Service) CheckEligible(ctx context.Context, b Billable, plan *PlanDef) error + func (s *Service) Checkout(ctx context.Context, ref BillableRef, req CheckoutRequest) (Redirect, error) + func (s *Service) CreditBalance(ctx context.Context, ref BillableRef) (int64, error) + func (s *Service) CreditLedger(ctx context.Context, ref BillableRef, p Page) ([]CreditEntry, error) + func (s *Service) Current(ctx context.Context, ref BillableRef, name string) (Subscription, error) + func (s *Service) DebitCredits(ctx context.Context, ref BillableRef, p CreditDebitParams) (CreditEntry, error) + func (s *Service) DecrementQuantity(ctx context.Context, ref BillableRef, n int64, opts ...CallOption) (Subscription, error) + func (s *Service) DefaultPaymentMethod(ctx context.Context, ref BillableRef) (*PaymentMethod, error) + func (s *Service) DrainUsage(ctx context.Context, limit int) (int, error) + func (s *Service) ExtendTrial(ctx context.Context, ref BillableRef, until time.Time, opts ...CallOption) (Subscription, error) + func (s *Service) GrantComp(ctx context.Context, ref BillableRef, plan string, until time.Time, ...) (Subscription, error) + func (s *Service) GrantCredits(ctx context.Context, ref BillableRef, p CreditGrantParams) (CreditEntry, error) + func (s *Service) IncrementQuantity(ctx context.Context, ref BillableRef, n int64, opts ...CallOption) (Subscription, error) + func (s *Service) Invoices(ctx context.Context, ref BillableRef, limit, offset int) ([]Invoice, int, error) + func (s *Service) Kinds() []KindDef + func (s *Service) Limit(ctx context.Context, ref BillableRef, key string) (int64, error) + func (s *Service) Now() time.Time + func (s *Service) OnPlan(ctx context.Context, ref BillableRef, plan string) (bool, error) + func (s *Service) PastDuePolicy() PastDuePolicy + func (s *Service) Pause(ctx context.Context, ref BillableRef, resumesAt time.Time, opts ...CallOption) (Subscription, error) + func (s *Service) Portal(ctx context.Context, ref BillableRef, returnURL string) (Redirect, error) + func (s *Service) PreviewSwap(ctx context.Context, ref BillableRef, plan string, opts ...CallOption) (InvoicePreview, error) + func (s *Service) ProcessWebhookEvent(ctx context.Context, id string) error + func (s *Service) Provider() Provider + func (s *Service) Reconcile(ctx context.Context, since time.Time) (ReconcileReport, error) + func (s *Service) Refund(ctx context.Context, invoiceID string, amount Money, reason, actor string, ...) (Refund, error) + func (s *Service) ReplayWebhookEvent(ctx context.Context, id, actor string) error + func (s *Service) ReportUsage(ctx context.Context, ref BillableRef, meter string, quantity int64, ...) error + func (s *Service) Resolve(ctx context.Context, ref BillableRef) (Billable, error) + func (s *Service) Resume(ctx context.Context, ref BillableRef, opts ...CallOption) (Subscription, error) + func (s *Service) StartGenericTrial(ctx context.Context, ref BillableRef, plan string, days int) (GenericTrial, error) + func (s *Service) Store() Store + func (s *Service) Subscribe(ctx context.Context, ref BillableRef, plan string, opts ...CallOption) (Subscription, error) + func (s *Service) Subscribed(ctx context.Context, ref BillableRef) (bool, error) + func (s *Service) Subscriptions(ctx context.Context, ref BillableRef) ([]Subscription, error) + func (s *Service) Swap(ctx context.Context, ref BillableRef, plan string, opts ...CallOption) (Subscription, error) + func (s *Service) SyncCatalog(ctx context.Context, dryRun bool) (SyncPlan, error) + func (s *Service) SyncCheckout(ctx context.Context, sessionID string) (Subscription, error) + func (s *Service) SyncSubscription(ctx context.Context, id string) (Subscription, error) + func (s *Service) Unpause(ctx context.Context, ref BillableRef, opts ...CallOption) (Subscription, error) + func (s *Service) UpdateQuantity(ctx context.Context, ref BillableRef, qty int64, opts ...CallOption) (Subscription, error) + func (s *Service) UsageSummary(ctx context.Context, ref BillableRef, meter string, start, end time.Time) (UsageSummary, error) + func (s *Service) WebhookHandler() http.Handler + type Status string + const StatusActive + const StatusCanceled + const StatusIncomplete + const StatusIncompleteExpired + const StatusPastDue + const StatusPaused + const StatusTrialing + const StatusUnpaid + func (s Status) Ended() bool + type Store interface + Customer func(ctx context.Context, id string) (Customer, error) + CustomerByBillable func(ctx context.Context, ref BillableRef, provider ProviderName) (Customer, error) + CustomerByProviderID func(ctx context.Context, provider ProviderName, providerID string) (Customer, error) + GenericTrial func(ctx context.Context, ref BillableRef) (GenericTrial, error) + InTx func(ctx context.Context, fn func(ctx context.Context, tx any) error) error + InsertUsage func(ctx context.Context, u *UsageRecord) (bool, error) + InsertWebhookEvent func(ctx context.Context, e *WebhookEvent) (bool, error) + Invoice func(ctx context.Context, id string) (Invoice, error) + InvoiceByProviderID func(ctx context.Context, provider ProviderName, providerID string) (Invoice, error) + ListCustomers func(ctx context.Context, q CustomerQuery) ([]Customer, int, error) + ListInvoices func(ctx context.Context, q InvoiceQuery) ([]Invoice, int, error) + ListSubscriptions func(ctx context.Context, q SubscriptionQuery) ([]Subscription, int, error) + ListWebhookEvents func(ctx context.Context, q WebhookEventQuery) ([]WebhookEvent, int, error) + Metrics func(ctx context.Context, q MetricsQuery) (Metrics, error) + PendingUsage func(ctx context.Context, limit int) ([]UsageRecord, error) + PriceMappings func(ctx context.Context, provider ProviderName) ([]PriceMapping, error) + SaveCustomer func(ctx context.Context, c *Customer) error + SaveGenericTrial func(ctx context.Context, g GenericTrial) error + SaveInvoice func(ctx context.Context, inv *Invoice) error + SavePriceMapping func(ctx context.Context, m PriceMapping) error + SaveSubscription func(ctx context.Context, s *Subscription) error + Subscription func(ctx context.Context, id string) (Subscription, error) + SubscriptionByProviderID func(ctx context.Context, provider ProviderName, providerID string) (Subscription, error) + SubscriptionsFor func(ctx context.Context, ref BillableRef) ([]Subscription, error) + UpdateUsage func(ctx context.Context, u UsageRecord) error + UpdateWebhookEvent func(ctx context.Context, e WebhookEvent) error + WebhookEvent func(ctx context.Context, id string) (WebhookEvent, error) + type Subscription struct + Billable BillableRef + BillingMode string + CancelAtPeriodEnd bool + CanceledAt time.Time + CompedUntil time.Time + CreatedAt time.Time + CurrentPeriodEnd time.Time + CurrentPeriodStart time.Time + CustomerID string + EndsAt time.Time + ID string + Items []SubscriptionItem + Metadata map[string]string + Name string + PastDueSince time.Time + Plan string + Provider ProviderName + ProviderCustomerID string + ProviderID string + Quantity int64 + Status Status + TrialEndsAt time.Time + UpdatedAt time.Time + func (s *Subscription) Comped(now time.Time) bool + func (s *Subscription) Ended(now time.Time) bool + func (s *Subscription) Incomplete() bool + func (s *Subscription) OnGracePeriod(now time.Time) bool + func (s *Subscription) OnTrial(now time.Time) bool + func (s *Subscription) PastDue() bool + func (s *Subscription) Recurring(now time.Time) bool + func (s *Subscription) Valid(now time.Time, policy PastDuePolicy) bool + func (s Subscription) Clone() Subscription + type SubscriptionEvent struct + At time.Time + Subscription Subscription + func (e SubscriptionEvent) BillableRef() BillableRef + type SubscriptionItem struct + ID string + Interval Interval + Metered bool + PriceLookupKey string + ProviderItemID string + ProviderPriceID string + Quantity int64 + UnitAmount Money + type SubscriptionLister interface + ListSubscriptionsSince func(ctx context.Context, since time.Time, fn func(Subscription) error) error + type SubscriptionManager interface + CancelSubscription func(ctx context.Context, subscriptionID string, atPeriodEnd bool) (Subscription, error) + CreateSubscription func(ctx context.Context, req CreateSubscription) (Subscription, error) + ExtendTrial func(ctx context.Context, subscriptionID string, until time.Time) (Subscription, error) + PreviewSwap func(ctx context.Context, req SwapRequest) (InvoicePreview, error) + ResumeSubscription func(ctx context.Context, subscriptionID string) (Subscription, error) + SwapSubscription func(ctx context.Context, req SwapRequest) (Subscription, error) + UpdateQuantity func(ctx context.Context, subscriptionID string, quantity int64, p Proration, ...) (Subscription, error) + type SubscriptionPrice struct + Metered bool + PriceID string + Quantity int64 + type SubscriptionQuery struct + Billable BillableRef + Lens Lens + Limit int + Now time.Time + Offset int + Plan string + Search string + Status []Status + type SubscriptionStarted struct + func (SubscriptionStarted) EventName() string + type SwapRequest struct + IdempotencyKey string + Metadata map[string]string + Prices []SubscriptionPrice + Proration Proration + ResetBillingCycle bool + SubscriptionID string + type Swapped struct + From string + To string + func (Swapped) EventName() string + type SyncAction struct + Kind SyncActionKind + LookupKey string + ProviderPriceID string + type SyncActionKind string + const SyncArchive + const SyncCreate + const SyncKeep + type SyncOptions struct + DryRun bool + Existing []PriceMapping + type SyncPlan struct + Actions []SyncAction + Mappings []PriceMapping + type TrialWillEnd struct + TrialEndsAt time.Time + func (TrialWillEnd) EventName() string + type UsageQuery struct + Customer string + End time.Time + EventName string + Start time.Time + type UsageRecord struct + Attempts int + Billable BillableRef + CustomerID string + ID string + IdempotencyKey string + LastError string + Meter string + OccurredAt time.Time + Quantity int64 + ReportedAt time.Time + type UsageSummary struct + End time.Time + Meter string + Quantity int64 + Start time.Time + type WebhookDecoder interface + Decode func(header http.Header, body []byte) (DecodedEvent, error) + type WebhookEvent struct + Attempts int + EventID string + ID string + LastError string + ObjectID string + ObjectType ObjectType + Payload []byte + ProcessedAt time.Time + Provider ProviderName + ReceivedAt time.Time + ReplayedBy string + Type string + type WebhookEventQuery struct + Failed bool + Limit int + Offset int + Provider ProviderName + Type string + Unprocessed bool