Versions in this module Expand all Collapse all v0 v0.0.14 Jan 4, 2026 v0.0.13 Jan 3, 2026 v0.0.12 Jan 3, 2026 v0.0.11 Jan 3, 2026 v0.0.10 Jan 3, 2026 v0.0.9 Jan 3, 2026 v0.0.8 Dec 31, 2025 v0.0.7 Dec 29, 2025 v0.0.6 Dec 17, 2025 v0.0.5 Dec 12, 2025 Changes in this version + type CurrentUsage struct + CurrentUsage int64 + FeatureID xid.ID + FeatureName string + FeatureType string + Limit int64 + OrganizationID xid.ID + OrganizationName string + PercentUsed float64 + Unit string type Feature + LastSyncedAt *time.Time + ProviderFeatureID string + type GrowthPoint struct + ActiveSubs int + ChurnedSubs int + Date time.Time + NetGrowth int + NewSubs int + type OrgRevenue struct + ARR int64 + MRR int64 + OrgID xid.ID + OrgName string + PlanID xid.ID + PlanName string + Status string + type OrgUsageStats struct + FeatureID xid.ID + FeatureName string + FeatureType FeatureType + Limit int64 + OrgID xid.ID + OrgName string + PercentUsed float64 + Unit string + Usage int64 + type UsageStats struct + AverageUsage float64 + TotalOrgs int + TotalUsage int64 + type UsageTrend struct + Action string + Date time.Time + Usage int64 v0.0.4 Dec 8, 2025 v0.0.3 Dec 8, 2025 Changes in this version + const CurrencyAUD + const CurrencyBRL + const CurrencyCAD + const CurrencyCHF + const CurrencyCNY + const CurrencyEUR + const CurrencyGBP + const CurrencyINR + const CurrencyJPY + const CurrencyUSD + const DefaultCurrency + const FeatureKeyAdvancedAnalytics + const FeatureKeyAuditLogs + const FeatureKeyCustomDomain + const FeatureKeyMaxAPICallsMonth + const FeatureKeyMaxMembers + const FeatureKeyMaxProjects + const FeatureKeyMaxStorage + const FeatureKeyMaxTeams + const FeatureKeyPrioritySupport + const FeatureKeySSO + const UsageMetricAPICalls + const UsageMetricActiveUsers + const UsageMetricBandwidthGB + const UsageMetricCompute + const UsageMetricMessages + const UsageMetricStorageGB + var ErrCouponAlreadyUsed = &CouponError + var ErrCouponCodeExists = &CouponError + var ErrCouponExpired = &CouponError + var ErrCouponFirstPurchase = &CouponError + var ErrCouponMaxRedemptions = &CouponError + var ErrCouponMinPurchase = &CouponError + var ErrCouponNotApplicable = &CouponError + var ErrCouponNotFound = &CouponError + var ErrCouponNotYetValid = &CouponError + func CalculateARPU(totalMRR int64, totalCustomers int) int64 + func CalculateARR(mrr int64) int64 + func CalculateChurnRate(customersChurned, customersAtStart int) float64 + func CalculateLTV(arpu int64, churnRate float64) int64 + func CalculateMRR(subscription *Subscription, plan *Plan) int64 + func CalculateNetRevenueRetention(mrrAtStart, newMRR, expansionMRR, contractionMRR, churnedMRR int64) float64 + func FormatAmount(amount int64, currency string) string + type AcknowledgeAlertRequest struct + AcknowledgedBy string + AlertID xid.ID + type AddOn struct + AppID xid.ID + BillingInterval BillingInterval + BillingPattern BillingPattern + CreatedAt time.Time + Currency string + Description string + DisplayOrder int + ExcludesPlanIDs []xid.ID + Features []PlanFeature + ID xid.ID + IsActive bool + IsPublic bool + MaxQuantity int + Metadata map[string]any + Name string + Price int64 + PriceTiers []PriceTier + ProviderPriceID string + RequiresPlanIDs []xid.ID + Slug string + TierMode TierMode + UpdatedAt time.Time + func NewAddOn(appID xid.ID, name, slug string) *AddOn + func (a *AddOn) CalculatePrice(quantity int) int64 + func (a *AddOn) GetFeature(key string) *PlanFeature + func (a *AddOn) IsAvailableForPlan(planID xid.ID) bool + type AddPaymentMethodRequest struct + BillingAddress *BillingAddress + BillingEmail string + BillingName string + BillingPhone string + OrganizationID xid.ID + SetAsDefault bool + Type PaymentMethodType + type Alert struct + AcknowledgedAt *time.Time + AcknowledgedBy string + AppID xid.ID + Channels []AlertChannel + ConfigID *xid.ID + CreatedAt time.Time + CurrentValue float64 + DeliveryStatus map[string]string + ID xid.ID + InvoiceID *xid.ID + LimitValue float64 + Message string + Metadata map[string]interface{} + MetricKey string + OrganizationID xid.ID + Resolution string + ResolvedAt *time.Time + SentAt *time.Time + Severity AlertSeverity + Status AlertStatus + SubscriptionID *xid.ID + ThresholdValue float64 + Title string + Type AlertType + UpdatedAt time.Time + type AlertChannel string + const AlertChannelEmail + const AlertChannelInApp + const AlertChannelSMS + const AlertChannelSlack + const AlertChannelWebhook + type AlertConfig struct + AlertType AlertType + AppID xid.ID + Channels []AlertChannel + CreatedAt time.Time + DaysBeforeEnd int + ID xid.ID + IsEnabled bool + MaxAlertsPerDay int + MetricKey string + MinInterval int + OrganizationID xid.ID + Recipients []string + SlackChannel string + SnoozedUntil *time.Time + ThresholdPercent float64 + UpdatedAt time.Time + WebhookURL string + func DefaultAlertConfigs(appID, orgID xid.ID) []AlertConfig + type AlertSeverity string + const AlertSeverityCritical + const AlertSeverityInfo + const AlertSeverityWarning + type AlertStatus string + const AlertStatusAcknowledged + const AlertStatusPending + const AlertStatusResolved + const AlertStatusSent + const AlertStatusSnoozed + type AlertSummary struct + AcknowledgedAlerts int + BySeverity map[AlertSeverity]int + ByType map[AlertType]int + PendingAlerts int + RecentAlerts []Alert + SentAlerts int + TotalAlerts int + type AlertTemplate struct + AlertType AlertType + AppID xid.ID + BodyTemplate string + Channel AlertChannel + CreatedAt time.Time + ID xid.ID + IsDefault bool + Subject string + TitleTemplate string + UpdatedAt time.Time + func DefaultAlertTemplates(appID xid.ID) []AlertTemplate + type AlertType string + const AlertTypeInvoicePastDue + const AlertTypePaymentFailed + const AlertTypeSeatLimitApproaching + const AlertTypeSubscriptionExpiring + const AlertTypeTrialEnding + const AlertTypeUsageLimit + const AlertTypeUsageThreshold + type AppliedDiscount struct + CouponCode string + CouponID xid.ID + Description string + DiscountAmount int64 + FinalAmount int64 + OriginalAmount int64 + Type CouponType + type AttachAddOnRequest struct + AddOnID xid.ID + Quantity int + SubscriptionID xid.ID + type BillingAddress struct + City string + Country string + Line1 string + Line2 string + PostalCode string + State string + type BillingInterval string + const BillingIntervalMonthly + const BillingIntervalOneTime + const BillingIntervalYearly + func (b BillingInterval) IsValid() bool + func (b BillingInterval) String() string + type BillingMetric struct + AppID xid.ID + CreatedAt time.Time + Currency string + Date time.Time + ID xid.ID + Period MetricPeriod + Type MetricType + Value float64 + type BillingPattern string + const BillingPatternFlat + const BillingPatternHybrid + const BillingPatternPerSeat + const BillingPatternTiered + const BillingPatternUsage + func (b BillingPattern) IsValid() bool + func (b BillingPattern) String() string + type CalculateTaxRequest struct + Amount int64 + BillingAddress *BillingAddress + Currency string + OrganizationID *xid.ID + ProductType string + type CancelSubscriptionRequest struct + Immediate bool + Reason string + type ChurnAnalysis struct + ChurnByPlan map[string]int + ChurnByReason map[string]int + Currency string + CustomerChurnRate float64 + CustomersAtEnd int + CustomersAtStart int + CustomersChurned int + EndDate time.Time + MRRAtEnd int64 + MRRAtStart int64 + MRRChurned int64 + NetRevenueRetention float64 + Period MetricPeriod + RevenueChurnRate float64 + StartDate time.Time + type CohortAnalysis struct + CohortMonth time.Time + Currency string + Retention []float64 + Revenue []int64 + TotalCustomers int + type CohortAnalysisResponse struct + Cohorts []CohortAnalysis + Currency string + type Config struct + AutoSyncPlans bool + AutoSyncSeats bool + DefaultTrialDays int + Enabled bool + GracePeriodDays int + Provider string + RequireSubscription bool + StripeConfig StripeConfig + TrialAllowedPlans []string + UsageReportBatchSize int + UsageReportInterval int + WebhookTolerance int + func DefaultConfig() Config + func (c *Config) GetWebhookSecret() string + func (c *Config) IsStripeConfigured() bool + func (c *Config) Validate() error + type ConsumeFeatureRequest struct + FeatureKey string + IdempotencyKey string + Metadata map[string]any + OrganizationID xid.ID + Quantity int64 + Reason string + type ConvertCurrencyRequest struct + Amount int64 + FromCurrency string + ToCurrency string + type ConvertCurrencyResponse struct + ConvertedAmount int64 + ConvertedAt time.Time + ConvertedCurrency string + ExchangeRate float64 + OriginalAmount int64 + OriginalCurrency string + type Coupon struct + AmountOff int64 + AppID xid.ID + ApplicableAddOns []string + ApplicablePlans []string + Code string + CreatedAt time.Time + Currency string + Description string + Duration CouponDuration + DurationMonths int + FirstPurchaseOnly bool + FreeMonths int + ID xid.ID + MaxRedemptions int + MaxRedemptionsPerOrg int + Metadata map[string]interface{} + MinPurchaseAmount int64 + Name string + PercentOff float64 + ProviderCouponID string + Status CouponStatus + TimesRedeemed int + TrialDays int + Type CouponType + UpdatedAt time.Time + ValidFrom time.Time + ValidUntil *time.Time + func (c *Coupon) CalculateDiscount(originalAmount int64) int64 + func (c *Coupon) CanRedeem() bool + func (c *Coupon) IsValid() bool + type CouponDuration string + const CouponDurationForever + const CouponDurationOnce + const CouponDurationRepeating + type CouponError struct + Code string + Message string + func (e *CouponError) Error() string + type CouponRedemption struct + AppID xid.ID + CouponID xid.ID + Currency string + DiscountAmount int64 + DiscountType CouponType + ExpiresAt *time.Time + ID xid.ID + OrganizationID xid.ID + RedeemedAt time.Time + SubscriptionID xid.ID + type CouponStatus string + const CouponStatusActive + const CouponStatusArchived + const CouponStatusExpired + type CouponType string + const CouponTypeFixedAmount + const CouponTypeFreeMonths + const CouponTypePercentage + const CouponTypeTrialExtension + type CreateAddOnRequest struct + BillingInterval BillingInterval + BillingPattern BillingPattern + Currency string + Description string + DisplayOrder int + ExcludesPlanIDs []xid.ID + Features []PlanFeature + IsActive bool + IsPublic bool + MaxQuantity int + Metadata map[string]any + Name string + Price int64 + PriceTiers []PriceTier + RequiresPlanIDs []xid.ID + Slug string + TierMode TierMode + type CreateAlertConfigRequest struct + AlertType AlertType + Channels []AlertChannel + DaysBeforeEnd int + MaxAlertsPerDay int + MetricKey string + MinInterval int + OrganizationID xid.ID + Recipients []string + SlackChannel string + ThresholdPercent float64 + WebhookURL string + type CreateCouponRequest struct + AmountOff int64 + ApplicableAddOns []string + ApplicablePlans []string + Code string + Currency string + Description string + Duration CouponDuration + DurationMonths int + FirstPurchaseOnly bool + FreeMonths int + MaxRedemptions int + MaxRedemptionsPerOrg int + Metadata map[string]interface{} + MinPurchaseAmount int64 + Name string + PercentOff float64 + TrialDays int + Type CouponType + ValidFrom time.Time + ValidUntil *time.Time + type CreateCustomerRequest struct + BillingAddress *BillingAddress + Email string + Metadata map[string]any + Name string + OrganizationID xid.ID + Phone string + TaxExempt bool + TaxID string + type CreateExchangeRateRequest struct + FromCurrency string + Rate float64 + Source string + ToCurrency string + ValidFrom time.Time + type CreateFeatureRequest struct + Description string + DisplayOrder int + Icon string + IsPublic bool + Key string + Metadata map[string]any + Name string + ResetPeriod ResetPeriod + Tiers []FeatureTier + Type FeatureType + Unit string + type CreatePlanRequest struct + BasePrice int64 + BillingInterval BillingInterval + BillingPattern BillingPattern + Currency string + Description string + DisplayOrder int + Features []PlanFeature + IsActive bool + IsPublic bool + Metadata map[string]any + Name string + PriceTiers []PriceTier + Slug string + TierMode TierMode + TrialDays int + type CreatePromotionCodeRequest struct + Code string + CouponID xid.ID + FirstTimeOnly bool + MaxRedemptions int + RestrictToOrgs []string + ValidFrom time.Time + ValidUntil *time.Time + type CreateSubscriptionRequest struct + Metadata map[string]any + OrganizationID xid.ID + PlanID xid.ID + Quantity int + StartTrial bool + TrialDays int + type CreateTaxExemptionRequest struct + Certificate string + Country string + ExpiresAt *time.Time + OrganizationID xid.ID + State string + Type string + type CreateTaxIDRequest struct + Country string + OrganizationID xid.ID + Type TaxIDType + Value string + type CreateTaxRateRequest struct + Behavior TaxBehavior + City string + Country string + Description string + IsDefault bool + Name string + Percentage float64 + PostalCode string + State string + Type TaxType + ValidFrom time.Time + type CurrencyAmount struct + Amount int64 + Currency string + DisplayValue string + type Customer struct + Balance int64 + BillingAddress *BillingAddress + CreatedAt time.Time + Currency string + DefaultPaymentID *xid.ID + Email string + ID xid.ID + Metadata map[string]any + Name string + OrganizationID xid.ID + Phone string + ProviderCustomerID string + TaxExempt bool + TaxID string + UpdatedAt time.Time + func NewCustomer(orgID xid.ID, email, name string) *Customer + type CustomerTaxID struct + AppID xid.ID + Country string + CreatedAt time.Time + ID xid.ID + IsValid bool + OrganizationID xid.ID + Type TaxIDType + UpdatedAt time.Time + Value string + VerifiedAt *time.Time + type DashboardMetrics struct + ActiveSubscriptions int + AsOf time.Time + ChurnRate float64 + ChurnedMRR int64 + Currency string + ExpansionMRR int64 + MRRGrowth float64 + NetRevenueRetention float64 + NewMRR int64 + SubscriptionGrowth float64 + TotalARR int64 + TotalMRR int64 + TrialConversionRate float64 + TrialingSubscriptions int + type EventType string + const EventInvoiceCreated + const EventInvoicePaid + const EventPaymentFailed + const EventPaymentSucceeded + const EventSubscriptionCanceled + const EventSubscriptionCreated + const EventSubscriptionPaused + const EventSubscriptionResumed + const EventSubscriptionTrialEnding + const EventSubscriptionUpdated + const EventUsageRecorded + func (e EventType) String() string + type ExchangeRate struct + AppID xid.ID + CreatedAt time.Time + FromCurrency string + ID xid.ID + Rate float64 + Source string + ToCurrency string + UpdatedAt time.Time + ValidFrom time.Time + ValidUntil *time.Time + type ExportMetricsRequest struct + EndDate time.Time + Format string + MetricTypes []MetricType + Period MetricPeriod + StartDate time.Time + type Feature struct + AppID xid.ID + CreatedAt time.Time + Description string + DisplayOrder int + ID xid.ID + Icon string + IsPublic bool + Key string + Metadata map[string]any + Name string + ResetPeriod ResetPeriod + Tiers []FeatureTier + Type FeatureType + Unit string + UpdatedAt time.Time + func NewFeature(appID xid.ID, key, name string, featureType FeatureType) *Feature + type FeatureAccess struct + CurrentUsage int64 + Feature *Feature + GrantedExtra int64 + HasAccess bool + IsBlocked bool + Limit int64 + PlanValue string + Remaining int64 + type FeatureGrant struct + CreatedAt time.Time + ExpiresAt *time.Time + FeatureID xid.ID + FeatureKey string + GrantType FeatureGrantType + ID xid.ID + IsActive bool + Metadata map[string]any + OrganizationID xid.ID + Reason string + SourceID *xid.ID + SourceType string + UpdatedAt time.Time + Value int64 + type FeatureGrantType string + const FeatureGrantTypeAddon + const FeatureGrantTypeManual + const FeatureGrantTypeOverride + const FeatureGrantTypePromotion + const FeatureGrantTypeTrial + func (f FeatureGrantType) IsValid() bool + func (f FeatureGrantType) String() string + type FeatureTier struct + FeatureID xid.ID + ID xid.ID + Label string + TierOrder int + UpTo int64 + Value string + type FeatureType string + const FeatureTypeBoolean + const FeatureTypeLimit + const FeatureTypeMetered + const FeatureTypeTiered + const FeatureTypeUnlimited + func (f FeatureType) IsConsumable() bool + func (f FeatureType) IsValid() bool + func (f FeatureType) String() string + type FeatureUsageAction string + const FeatureUsageActionAdjust + const FeatureUsageActionConsume + const FeatureUsageActionGrant + const FeatureUsageActionReset + func (f FeatureUsageAction) IsValid() bool + func (f FeatureUsageAction) String() string + type FeatureUsageLog struct + Action string + ActorID *xid.ID + CreatedAt time.Time + FeatureID xid.ID + FeatureKey string + ID xid.ID + IdempotencyKey string + Metadata map[string]any + NewUsage int64 + OrganizationID xid.ID + PreviousUsage int64 + Quantity int64 + Reason string + type FeatureUsageResponse struct + CurrentUsage int64 + FeatureKey string + FeatureName string + FeatureType string + GrantedExtra int64 + Limit int64 + PeriodEnd time.Time + PeriodStart time.Time + Remaining int64 + type GetCohortAnalysisRequest struct + Currency string + NumMonths int + StartMonth time.Time + type GetMetricsRequest struct + Currency string + EndDate time.Time + GroupBy string + MetricTypes []MetricType + Period MetricPeriod + StartDate time.Time + type GetUsageSummaryRequest struct + MetricKey string + PeriodEnd time.Time + PeriodStart time.Time + SubscriptionID xid.ID + type GrantFeatureRequest struct + ExpiresAt *time.Time + FeatureKey string + GrantType FeatureGrantType + Metadata map[string]any + OrganizationID xid.ID + Reason string + SourceID *xid.ID + SourceType string + Value int64 + type Invoice struct + AmountDue int64 + AmountPaid int64 + CreatedAt time.Time + Currency string + Description string + DueDate time.Time + HostedInvoiceURL string + ID xid.ID + Items []InvoiceItem + Metadata map[string]any + Number string + OrganizationID xid.ID + PaidAt *time.Time + PeriodEnd time.Time + PeriodStart time.Time + ProviderInvoiceID string + ProviderPDFURL string + Status InvoiceStatus + SubscriptionID xid.ID + Subtotal int64 + Tax int64 + Total int64 + UpdatedAt time.Time + VoidedAt *time.Time + func NewInvoice(subID, orgID xid.ID) *Invoice + func (i *Invoice) AddItem(description string, quantity, unitAmount int64) *InvoiceItem + func (i *Invoice) Finalize() + func (i *Invoice) IsDraft() bool + func (i *Invoice) IsOpen() bool + func (i *Invoice) IsOverdue() bool + func (i *Invoice) IsPaid() bool + func (i *Invoice) MarkPaid() + func (i *Invoice) Void() + type InvoiceItem struct + AddOnID *xid.ID + Amount int64 + CreatedAt time.Time + Description string + ID xid.ID + InvoiceID xid.ID + Metadata map[string]any + PeriodEnd time.Time + PeriodStart time.Time + PlanID *xid.ID + Proration bool + ProviderItemID string + Quantity int64 + UnitAmount int64 + type InvoiceMetrics struct + AverageTimeToPayment float64 + CollectionRate float64 + Currency string + Period MetricPeriod + TotalCollected int64 + TotalInvoiced int64 + TotalOutstanding int64 + TotalOverdue int64 + type InvoiceStatus string + const InvoiceStatusDraft + const InvoiceStatusOpen + const InvoiceStatusPaid + const InvoiceStatusUncollectible + const InvoiceStatusVoid + func (i InvoiceStatus) IsValid() bool + func (i InvoiceStatus) String() string + type LinkFeatureRequest struct + FeatureID xid.ID + IsBlocked bool + IsHighlighted bool + OverrideSettings map[string]any + Value string + type ListInvoicesFilter struct + FromDate *time.Time + OrganizationID *xid.ID + Page int + PageSize int + Status InvoiceStatus + SubscriptionID *xid.ID + ToDate *time.Time + type ListUsageRecordsFilter struct + FromDate *time.Time + MetricKey string + OrganizationID *xid.ID + Page int + PageSize int + Reported *bool + SubscriptionID *xid.ID + ToDate *time.Time + type MRRBreakdown struct + ChurnedMRR int64 + ContractionMRR int64 + Currency string + Date time.Time + ExpansionMRR int64 + NetNewMRR int64 + NewMRR int64 + ReactivationMRR int64 + TotalMRR int64 + type MetricPeriod string + const MetricPeriodDaily + const MetricPeriodMonthly + const MetricPeriodWeekly + const MetricPeriodYearly + type MetricType string + const MetricTypeARPU + const MetricTypeARR + const MetricTypeCAC + const MetricTypeChurnRate + const MetricTypeContractionMRR + const MetricTypeExpansionMRR + const MetricTypeLTV + const MetricTypeMRR + const MetricTypeNetRevenue + const MetricTypeNewMRR + const MetricTypeRevenueChurn + const MetricTypeTrialConversion + type MetricsResponse struct + Churn *ChurnAnalysis + Currency string + Dashboard *DashboardMetrics + EndDate time.Time + MRRHistory []MRRBreakdown + Metrics []BillingMetric + StartDate time.Time + type MultiCurrencyPrice struct + BaseAmount int64 + BaseCurrency string + Prices map[string]CurrencyAmount + type OrganizationFeatureUsage struct + CurrentUsage int64 + FeatureID xid.ID + FeatureKey string + ID xid.ID + LastReset time.Time + Metadata map[string]any + OrganizationID xid.ID + PeriodEnd time.Time + PeriodStart time.Time + type PauseSubscriptionRequest struct + Reason string + ResumeAt *time.Time + type PaymentMethod struct + BankAccountType string + BankLast4 string + BankName string + BankRoutingNumber string + BillingAddressLine1 string + BillingAddressLine2 string + BillingCity string + BillingCountry string + BillingEmail string + BillingName string + BillingPhone string + BillingPostalCode string + BillingState string + CardBrand string + CardExpMonth int + CardExpYear int + CardFunding string + CardLast4 string + CreatedAt time.Time + ID xid.ID + IsDefault bool + Metadata map[string]any + OrganizationID xid.ID + ProviderCustomerID string + ProviderMethodID string + Type PaymentMethodType + UpdatedAt time.Time + func NewPaymentMethod(orgID xid.ID, methodType PaymentMethodType) *PaymentMethod + func (pm *PaymentMethod) DisplayName() string + func (pm *PaymentMethod) IsBankAccount() bool + func (pm *PaymentMethod) IsCard() bool + func (pm *PaymentMethod) IsExpired() bool + func (pm *PaymentMethod) WillExpireSoon(days int) bool + type PaymentMethodType string + const PaymentMethodBankAccount + const PaymentMethodCard + const PaymentMethodSepaDebit + func (p PaymentMethodType) IsValid() bool + func (p PaymentMethodType) String() string + type Plan struct + AppID xid.ID + Archived bool + BasePrice int64 + BillingInterval BillingInterval + BillingPattern BillingPattern + CreatedAt time.Time + Currency string + Description string + DisplayOrder int + Features []PlanFeature + ID xid.ID + IsActive bool + IsPublic bool + Metadata map[string]any + Name string + PriceTiers []PriceTier + ProviderPlanID string + ProviderPriceID string + Slug string + TierMode TierMode + TrialDays int + UpdatedAt time.Time + func NewPlan(appID xid.ID, name, slug string) *Plan + func (p *Plan) AddPriceTier(upTo, unitAmount, flatAmount int64) + func (p *Plan) CalculateTieredPrice(quantity int64) int64 + func (p *Plan) GetFeature(key string) *PlanFeature + func (p *Plan) GetFeatureLimit(key string) int64 + func (p *Plan) HasFeature(key string) bool + func (p *Plan) SetFeature(key, name string, featureType FeatureType, value any) + type PlanFeature struct + Description string + IsHighlighted bool + Key string + Name string + Type FeatureType + Unit string + Value any + type PlanFeatureLink struct + Feature *Feature + FeatureID xid.ID + ID xid.ID + IsBlocked bool + IsHighlighted bool + OverrideSettings map[string]any + PlanID xid.ID + Value string + type PriceTier struct + FlatAmount int64 + UnitAmount int64 + UpTo int64 + type PromotionCode struct + AppID xid.ID + Code string + Coupon *Coupon + CouponID xid.ID + CreatedAt time.Time + FirstTimeOnly bool + ID xid.ID + IsActive bool + MaxRedemptions int + ProviderPromoID string + RestrictToOrgs []string + TimesRedeemed int + UpdatedAt time.Time + ValidFrom time.Time + ValidUntil *time.Time + type PublicFeature struct + Description string + DisplayOrder int + Icon string + Key string + Name string + Type string + Unit string + type PublicPlanFeature struct + Description string + DisplayOrder int + IsBlocked bool + IsHighlighted bool + Key string + Name string + Type string + Unit string + Value any + type RecordUsageRequest struct + Action UsageAction + IdempotencyKey string + Metadata map[string]any + MetricKey string + Quantity int64 + SubscriptionID xid.ID + Timestamp *time.Time + type RedeemCouponRequest struct + Code string + OrganizationID xid.ID + SubscriptionID xid.ID + type ResetPeriod string + const ResetPeriodBillingCycle + const ResetPeriodDaily + const ResetPeriodMonthly + const ResetPeriodNone + const ResetPeriodWeekly + const ResetPeriodYearly + func (r ResetPeriod) IsValid() bool + func (r ResetPeriod) String() string + type ResolveAlertRequest struct + AlertID xid.ID + Resolution string + type RevenueByPlan struct + ARR int64 + ActiveSubscribers int + Currency string + MRR int64 + PercentOfTotal float64 + PlanID xid.ID + PlanName string + PlanSlug string + type RevenueBySegment struct + ARPU int64 + ChurnRate float64 + Currency string + LTV int64 + MRR int64 + Segment string + Subscribers int + type SetupIntentResult struct + ClientSecret string + PublishableKey string + SetupIntentID string + type SnoozeAlertRequest struct + AlertID xid.ID + SnoozeUntil time.Time + type StripeConfig struct + APIVersion string + ConnectAccount string + PublishableKey string + SecretKey string + WebhookSecret string + type Subscription struct + AddOns []SubscriptionAddOn + CancelAt *time.Time + CanceledAt *time.Time + CreatedAt time.Time + CurrentPeriodEnd time.Time + CurrentPeriodStart time.Time + EndedAt *time.Time + ID xid.ID + Metadata map[string]any + OrganizationID xid.ID + PausedAt *time.Time + Plan *Plan + PlanID xid.ID + ProviderCustomerID string + ProviderSubID string + Quantity int + ResumeAt *time.Time + Status SubscriptionStatus + TrialEnd *time.Time + TrialStart *time.Time + UpdatedAt time.Time + func NewSubscription(orgID, planID xid.ID) *Subscription + func (s *Subscription) ActivateFromTrial() + func (s *Subscription) Cancel(immediate bool) + func (s *Subscription) DaysUntilRenewal() int + func (s *Subscription) DaysUntilTrialEnd() int + func (s *Subscription) IsActive() bool + func (s *Subscription) IsCanceled() bool + func (s *Subscription) IsPastDue() bool + func (s *Subscription) IsPaused() bool + func (s *Subscription) IsTrialing() bool + func (s *Subscription) Pause(resumeAt *time.Time) + func (s *Subscription) Resume() + func (s *Subscription) StartTrial(days int) + func (s *Subscription) WillCancel() bool + type SubscriptionAddOn struct + AddOn *AddOn + AddOnID xid.ID + CreatedAt time.Time + ID xid.ID + ProviderSubItemID string + Quantity int + SubscriptionID xid.ID + type SubscriptionMovement struct + AppID xid.ID + CreatedAt time.Time + Currency string + ID xid.ID + MRRChange int64 + MovementType string + NewMRR int64 + NewPlanID *xid.ID + Notes string + OccurredAt time.Time + OrganizationID xid.ID + PreviousMRR int64 + PreviousPlanID *xid.ID + Reason string + SubscriptionID xid.ID + type SubscriptionStatus string + const StatusActive + const StatusCanceled + const StatusIncomplete + const StatusPastDue + const StatusPaused + const StatusTrialing + const StatusUnpaid + func (s SubscriptionStatus) IsActiveOrTrialing() bool + func (s SubscriptionStatus) IsValid() bool + func (s SubscriptionStatus) String() string + type SupportedCurrency struct + Code string + CreatedAt time.Time + DecimalPlaces int + ID xid.ID + IsActive bool + IsDefault bool + Name string + Symbol string + UpdatedAt time.Time + func DefaultCurrencies() []SupportedCurrency + type TaxBehavior string + const TaxBehaviorExclusive + const TaxBehaviorInclusive + type TaxBillingAddress = BillingAddress + type TaxCalculation struct + Currency string + ExemptionID *xid.ID + IsExempt bool + Percentage float64 + TaxAmount int64 + TaxRateID xid.ID + TaxRateName string + TaxType TaxType + TaxableAmount int64 + TotalAmount int64 + type TaxExemption struct + AppID xid.ID + Certificate string + Country string + CreatedAt time.Time + ExpiresAt *time.Time + ID xid.ID + IsActive bool + OrganizationID xid.ID + State string + Type string + UpdatedAt time.Time + VerifiedAt *time.Time + type TaxIDType string + const TaxIDTypeABN + const TaxIDTypeBN + const TaxIDTypeCNPJ + const TaxIDTypeCPF + const TaxIDTypeCustom + const TaxIDTypeEIN + const TaxIDTypeGSTIN + const TaxIDTypeGST_CA + const TaxIDTypeGST_NZ + const TaxIDTypeVAT + type TaxRate struct + AppID xid.ID + Behavior TaxBehavior + City string + Country string + CreatedAt time.Time + Description string + ID xid.ID + IsActive bool + IsDefault bool + Name string + Percentage float64 + PostalCode string + ProviderTaxRateID string + State string + Type TaxType + UpdatedAt time.Time + ValidFrom time.Time + ValidUntil *time.Time + type TaxSummary struct + Calculations []TaxCalculation + Currency string + TotalTax int64 + type TaxType string + const TaxTypeConsumption + const TaxTypeCustom + const TaxTypeGST + const TaxTypeHST + const TaxTypePST + const TaxTypeSalesTax + const TaxTypeVAT + type TierMode string + const TierModeGraduated + const TierModeVolume + func (t TierMode) IsValid() bool + func (t TierMode) String() string + type TrialMetrics struct + AverageTrialLength float64 + ConversionByPlan map[string]float64 + ConversionRate float64 + Period MetricPeriod + TrialsActive int + TrialsConverted int + TrialsExpired int + TrialsStarted int + type TriggerAlertRequest struct + Message string + Metadata map[string]interface{} + OrganizationID xid.ID + Severity AlertSeverity + Title string + Type AlertType + type UpdateAddOnRequest struct + Description *string + DisplayOrder *int + ExcludesPlanIDs []xid.ID + Features []PlanFeature + IsActive *bool + IsPublic *bool + MaxQuantity *int + Metadata map[string]any + Name *string + Price *int64 + PriceTiers []PriceTier + RequiresPlanIDs []xid.ID + TierMode *TierMode + type UpdateAlertConfigRequest struct + Channels []AlertChannel + DaysBeforeEnd *int + IsEnabled *bool + MaxAlertsPerDay *int + MinInterval *int + Recipients []string + SlackChannel *string + ThresholdPercent *float64 + WebhookURL *string + type UpdateCouponRequest struct + ApplicableAddOns []string + ApplicablePlans []string + Description *string + MaxRedemptions *int + MaxRedemptionsPerOrg *int + Metadata map[string]interface{} + Name *string + Status *CouponStatus + ValidUntil *time.Time + type UpdateCustomerRequest struct + BillingAddress *BillingAddress + Email *string + Metadata map[string]any + Name *string + Phone *string + TaxExempt *bool + TaxID *string + type UpdateExchangeRateRequest struct + Rate *float64 + ValidUntil *time.Time + type UpdateFeatureRequest struct + Description *string + DisplayOrder *int + Icon *string + IsPublic *bool + Metadata map[string]any + Name *string + ResetPeriod *ResetPeriod + Tiers []FeatureTier + Unit *string + type UpdateLinkRequest struct + IsBlocked *bool + IsHighlighted *bool + OverrideSettings map[string]any + Value *string + type UpdatePlanRequest struct + BasePrice *int64 + Description *string + DisplayOrder *int + Features []PlanFeature + IsActive *bool + IsPublic *bool + Metadata map[string]any + Name *string + PriceTiers []PriceTier + TierMode *TierMode + TrialDays *int + type UpdateSubscriptionRequest struct + Metadata map[string]any + PlanID *xid.ID + Quantity *int + type UpdateTaxRateRequest struct + Behavior *TaxBehavior + Description *string + IsActive *bool + IsDefault *bool + Name *string + Percentage *float64 + ValidUntil *time.Time + type UsageAction string + const UsageActionDecrement + const UsageActionIncrement + const UsageActionSet + func (u UsageAction) IsValid() bool + func (u UsageAction) String() string + type UsageLimit struct + CurrentUsage int64 + IsExceeded bool + Limit int64 + MetricKey string + PercentUsed float64 + RemainingUsage int64 + func NewUsageLimit(metricKey string, current, limit int64) *UsageLimit + type UsageMetric struct + AggregateType string + Description string + Key string + Name string + Unit string + type UsageRecord struct + Action UsageAction + CreatedAt time.Time + ID xid.ID + IdempotencyKey string + Metadata map[string]any + MetricKey string + OrganizationID xid.ID + ProviderRecordID string + Quantity int64 + Reported bool + ReportedAt *time.Time + SubscriptionID xid.ID + Timestamp time.Time + func NewUsageRecord(subID, orgID xid.ID, metricKey string, quantity int64, action UsageAction) *UsageRecord + type UsageSnapshot struct + CurrentValue int64 + Limit int64 + MetricKey string + PercentUsed float64 + Timestamp time.Time + type UsageSummary struct + FirstRecordAt time.Time + LastRecordAt time.Time + MetricKey string + PeriodEnd time.Time + PeriodStart time.Time + RecordCount int64 + TotalQuantity int64 + type VATValidationResult struct + Address string + CountryCode string + Message string + Name string + VATNumber string + Valid bool + type ValidateCouponRequest struct + AddOnSlug string + Code string + OrganizationID xid.ID + PlanSlug string + PurchaseAmount int64 + type ValidateCouponResponse struct + Coupon *Coupon + DiscountAmount int64 + DiscountPercent float64 + Errors []string + Message string + Valid bool