@stackbe/sdk 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -565,6 +565,56 @@ interface PaymentWebhookPayload {
565
565
  status: 'succeeded' | 'failed';
566
566
  failureReason?: string;
567
567
  }
568
+ /** Payment method details */
569
+ interface PaymentMethod {
570
+ id: string;
571
+ customerId: string;
572
+ gateway: 'stripe' | 'paypal' | 'authorize_net';
573
+ type: string;
574
+ last4?: string;
575
+ brand?: string;
576
+ expiryMonth?: number;
577
+ expiryYear?: number;
578
+ isDefault: boolean;
579
+ status: 'active' | 'expired' | 'failed';
580
+ createdAt: string;
581
+ }
582
+ /** Create setup session options */
583
+ interface CreateSetupSessionOptions {
584
+ successUrl: string;
585
+ cancelUrl: string;
586
+ }
587
+ /** Setup session response */
588
+ interface SetupSessionResponse {
589
+ sessionId: string;
590
+ url: string;
591
+ clientSecret?: string;
592
+ }
593
+ /** Attach payment method options */
594
+ interface AttachPaymentMethodOptions {
595
+ gatewayPaymentMethodId: string;
596
+ setAsDefault?: boolean;
597
+ }
598
+ /** Charge subscription result */
599
+ interface ChargeResult {
600
+ chargeId: string;
601
+ success: boolean;
602
+ status: 'succeeded' | 'failed' | 'pending' | 'requires_action';
603
+ gatewayChargeId?: string;
604
+ errorCode?: string;
605
+ errorMessage?: string;
606
+ requiresAction?: boolean;
607
+ actionUrl?: string;
608
+ actionExpiresAt?: string;
609
+ }
610
+ /** Migration to StackBE-managed result */
611
+ interface MigrateToStackbeManagedResult {
612
+ subscriptionId: string;
613
+ billingMode: 'stackbe_managed';
614
+ paymentMethodId: string;
615
+ nextBillingDate: string;
616
+ message: string;
617
+ }
568
618
  type SubscriptionCreatedEvent = WebhookEvent<'subscription_created', SubscriptionWebhookPayload>;
569
619
  type SubscriptionUpdatedEvent = WebhookEvent<'subscription_updated', SubscriptionWebhookPayload>;
570
620
  type SubscriptionCancelledEvent = WebhookEvent<'subscription_cancelled', SubscriptionWebhookPayload>;
@@ -577,6 +627,70 @@ type CustomerCreatedEvent = WebhookEvent<'customer_created', CustomerWebhookPayl
577
627
  type CustomerUpdatedEvent = WebhookEvent<'customer_updated', CustomerWebhookPayload>;
578
628
  /** Union of all webhook event types */
579
629
  type AnyWebhookEvent = SubscriptionCreatedEvent | SubscriptionUpdatedEvent | SubscriptionCancelledEvent | SubscriptionRenewedEvent | TrialStartedEvent | TrialEndedEvent | PaymentSucceededEvent | PaymentFailedEvent | CustomerCreatedEvent | CustomerUpdatedEvent;
630
+ interface DealRegistration {
631
+ id: string;
632
+ affiliateId: string;
633
+ programId: string;
634
+ leadEmail: string;
635
+ leadName?: string | null;
636
+ notes?: string | null;
637
+ status: 'pending' | 'approved' | 'converted' | 'expired' | 'rejected';
638
+ expiresAt: string;
639
+ approvedAt?: string | null;
640
+ convertedAt?: string | null;
641
+ rejectedAt?: string | null;
642
+ rejectionReason?: string | null;
643
+ convertedCustomerId?: string | null;
644
+ convertedSubscriptionId?: string | null;
645
+ createdAt: string;
646
+ updatedAt: string;
647
+ }
648
+ interface PartnerDashboard {
649
+ affiliate: {
650
+ id: string;
651
+ code: string;
652
+ type: string;
653
+ status: string;
654
+ totalEarned: number;
655
+ pendingBalance: number;
656
+ paidOut: number;
657
+ totalReferrals: number;
658
+ totalConversions: number;
659
+ };
660
+ tier?: {
661
+ id: string;
662
+ name: string;
663
+ level: number;
664
+ commissionRate: number;
665
+ commissionType: string;
666
+ } | null;
667
+ earningsBySource: {
668
+ link: number;
669
+ coupon: number;
670
+ deal: number;
671
+ };
672
+ recentCommissions: Array<{
673
+ id: string;
674
+ amount: number;
675
+ currency: string;
676
+ status: string;
677
+ createdAt: string;
678
+ }>;
679
+ activeDeals: Array<{
680
+ id: string;
681
+ leadEmail: string;
682
+ status: string;
683
+ expiresAt: string;
684
+ createdAt: string;
685
+ }>;
686
+ coupons: Array<{
687
+ id: string;
688
+ code: string;
689
+ discountType: string;
690
+ discountValue: number;
691
+ timesRedeemed: number;
692
+ }>;
693
+ }
580
694
 
581
695
  declare class UsageClient {
582
696
  private http;
@@ -1348,6 +1462,160 @@ declare class SubscriptionsClient {
1348
1462
  checkAccess(subscriptionId: string): Promise<{
1349
1463
  hasAccess: boolean;
1350
1464
  }>;
1465
+ /**
1466
+ * Manually charge a StackBE-managed subscription.
1467
+ *
1468
+ * This is useful for:
1469
+ * - Testing billing in development
1470
+ * - Recovering from failed automatic charges
1471
+ * - Charging ahead of schedule
1472
+ *
1473
+ * The subscription must be in `stackbe_managed` billing mode.
1474
+ *
1475
+ * @example
1476
+ * ```typescript
1477
+ * const result = await stackbe.subscriptions.charge('sub_123');
1478
+ *
1479
+ * if (result.success) {
1480
+ * console.log('Charge successful:', result.chargeId);
1481
+ * } else if (result.requiresAction) {
1482
+ * // Redirect customer to 3DS authentication
1483
+ * window.location.href = result.actionUrl;
1484
+ * } else {
1485
+ * console.log('Charge failed:', result.errorMessage);
1486
+ * }
1487
+ * ```
1488
+ */
1489
+ charge(subscriptionId: string): Promise<ChargeResult>;
1490
+ /**
1491
+ * Migrate a subscription from gateway-managed to StackBE-managed billing.
1492
+ *
1493
+ * This will:
1494
+ * 1. Extract the payment method from the gateway subscription
1495
+ * 2. Store it in StackBE's PaymentMethod table
1496
+ * 3. Set the subscription to `stackbe_managed` billing mode
1497
+ * 4. Cancel the gateway subscription at period end
1498
+ * 5. StackBE will handle renewals going forward
1499
+ *
1500
+ * Use cases:
1501
+ * - Migrate existing Stripe subscriptions to unified StackBE billing
1502
+ * - Prepare for multi-gateway support
1503
+ * - Gain more control over billing timing and retry logic
1504
+ *
1505
+ * @example
1506
+ * ```typescript
1507
+ * const result = await stackbe.subscriptions.migrateToStackbeManaged('sub_123');
1508
+ *
1509
+ * console.log('Migration complete');
1510
+ * console.log('Payment method:', result.paymentMethodId);
1511
+ * console.log('Next billing date:', result.nextBillingDate);
1512
+ * ```
1513
+ */
1514
+ migrateToStackbeManaged(subscriptionId: string): Promise<MigrateToStackbeManagedResult>;
1515
+ }
1516
+
1517
+ declare class PaymentMethodsClient {
1518
+ private http;
1519
+ constructor(http: HttpClient);
1520
+ /**
1521
+ * Create a setup session for collecting a payment method.
1522
+ *
1523
+ * Returns a URL to redirect the customer to for secure payment method collection.
1524
+ * This is similar to Stripe Checkout but in setup mode - no charge is made.
1525
+ *
1526
+ * @example
1527
+ * ```typescript
1528
+ * const session = await stackbe.paymentMethods.createSetupSession('cust_123', {
1529
+ * successUrl: 'https://yourapp.com/payment-methods/success',
1530
+ * cancelUrl: 'https://yourapp.com/payment-methods/cancel',
1531
+ * });
1532
+ *
1533
+ * // Redirect customer to payment method collection
1534
+ * window.location.href = session.url;
1535
+ * ```
1536
+ */
1537
+ createSetupSession(customerId: string, options: CreateSetupSessionOptions): Promise<SetupSessionResponse>;
1538
+ /**
1539
+ * Attach a payment method to a customer.
1540
+ *
1541
+ * After the customer completes the setup session, call this to store
1542
+ * the payment method in StackBE for future charges.
1543
+ *
1544
+ * @example
1545
+ * ```typescript
1546
+ * // After redirect from setup session
1547
+ * const paymentMethod = await stackbe.paymentMethods.attach('cust_123', {
1548
+ * gatewayPaymentMethodId: 'pm_1234...', // From setup session completion
1549
+ * setAsDefault: true,
1550
+ * });
1551
+ *
1552
+ * console.log(`Added ${paymentMethod.brand} ending in ${paymentMethod.last4}`);
1553
+ * ```
1554
+ */
1555
+ attach(customerId: string, options: AttachPaymentMethodOptions): Promise<PaymentMethod>;
1556
+ /**
1557
+ * List all payment methods for a customer.
1558
+ *
1559
+ * @example
1560
+ * ```typescript
1561
+ * const paymentMethods = await stackbe.paymentMethods.list('cust_123');
1562
+ *
1563
+ * for (const pm of paymentMethods) {
1564
+ * console.log(`${pm.brand} **** ${pm.last4} ${pm.isDefault ? '(default)' : ''}`);
1565
+ * }
1566
+ * ```
1567
+ */
1568
+ list(customerId: string, options?: {
1569
+ status?: string;
1570
+ }): Promise<PaymentMethod[]>;
1571
+ /**
1572
+ * Get a specific payment method.
1573
+ *
1574
+ * @example
1575
+ * ```typescript
1576
+ * const pm = await stackbe.paymentMethods.get('cust_123', 'pm_123');
1577
+ * console.log(`Expires: ${pm.expiryMonth}/${pm.expiryYear}`);
1578
+ * ```
1579
+ */
1580
+ get(customerId: string, paymentMethodId: string): Promise<PaymentMethod>;
1581
+ /**
1582
+ * Set a payment method as the default for a customer.
1583
+ *
1584
+ * The default payment method is used for subscription renewals.
1585
+ *
1586
+ * @example
1587
+ * ```typescript
1588
+ * await stackbe.paymentMethods.setDefault('cust_123', 'pm_456');
1589
+ * console.log('Default payment method updated');
1590
+ * ```
1591
+ */
1592
+ setDefault(customerId: string, paymentMethodId: string): Promise<PaymentMethod>;
1593
+ /**
1594
+ * Remove a payment method.
1595
+ *
1596
+ * Cannot remove a payment method that is being used by an active subscription.
1597
+ *
1598
+ * @example
1599
+ * ```typescript
1600
+ * await stackbe.paymentMethods.remove('cust_123', 'pm_old');
1601
+ * console.log('Payment method removed');
1602
+ * ```
1603
+ */
1604
+ remove(customerId: string, paymentMethodId: string): Promise<{
1605
+ success: boolean;
1606
+ }>;
1607
+ /**
1608
+ * Get the default payment method for a customer.
1609
+ *
1610
+ * @example
1611
+ * ```typescript
1612
+ * const defaultPM = await stackbe.paymentMethods.getDefault('cust_123');
1613
+ * if (defaultPM) {
1614
+ * console.log(`Default: ${defaultPM.brand} **** ${defaultPM.last4}`);
1615
+ * }
1616
+ * ```
1617
+ */
1618
+ getDefault(customerId: string): Promise<PaymentMethod | null>;
1351
1619
  }
1352
1620
 
1353
1621
  interface AuthClientOptions {
@@ -2073,6 +2341,7 @@ interface AffiliateInfo {
2073
2341
  enrolled: boolean;
2074
2342
  id?: string;
2075
2343
  code?: string;
2344
+ type?: 'affiliate' | 'referral' | 'reseller';
2076
2345
  status?: 'active' | 'suspended' | 'pending';
2077
2346
  totalEarned?: number;
2078
2347
  pendingBalance?: number;
@@ -2084,6 +2353,7 @@ interface AffiliateInfo {
2084
2353
  interface AffiliateEnrollment {
2085
2354
  id: string;
2086
2355
  code: string;
2356
+ type: string;
2087
2357
  status: string;
2088
2358
  createdAt: string;
2089
2359
  }
@@ -2116,6 +2386,20 @@ interface EnrollOptions {
2116
2386
  code?: string;
2117
2387
  /** PayPal email for payouts */
2118
2388
  payoutEmail?: string;
2389
+ /** Partner type (default: 'affiliate') */
2390
+ type?: 'affiliate' | 'referral' | 'reseller';
2391
+ }
2392
+ interface RegisterDealOptions {
2393
+ /** Email of the lead */
2394
+ leadEmail: string;
2395
+ /** Name of the lead */
2396
+ leadName?: string;
2397
+ /** Notes about the deal */
2398
+ notes?: string;
2399
+ }
2400
+ interface DealListResponse {
2401
+ deals: DealRegistration[];
2402
+ total: number;
2119
2403
  }
2120
2404
  declare class AffiliatesClient {
2121
2405
  private http;
@@ -2123,86 +2407,66 @@ declare class AffiliatesClient {
2123
2407
  /**
2124
2408
  * Get the current customer's affiliate info.
2125
2409
  * Requires customer session token.
2126
- *
2127
- * @example
2128
- * ```typescript
2129
- * const affiliate = await stackbe.affiliates.get();
2130
- *
2131
- * if (affiliate.enrolled) {
2132
- * console.log(`Your referral code: ${affiliate.code}`);
2133
- * console.log(`Earnings: $${(affiliate.totalEarned! / 100).toFixed(2)}`);
2134
- * } else {
2135
- * console.log('Not enrolled in affiliate program');
2136
- * }
2137
- * ```
2138
2410
  */
2139
2411
  get(): Promise<AffiliateInfo>;
2140
2412
  /**
2141
- * Enroll the current customer as an affiliate.
2413
+ * Enroll the current customer as an affiliate/partner.
2142
2414
  * Requires customer session token.
2143
2415
  *
2144
2416
  * @example
2145
2417
  * ```typescript
2146
- * // Enroll with auto-generated code
2147
- * const affiliate = await stackbe.affiliates.enroll();
2418
+ * const affiliate = await stackbe.affiliates.enroll({ type: 'referral' });
2148
2419
  * console.log(`Your referral code: ${affiliate.code}`);
2149
- *
2150
- * // Enroll with custom code
2151
- * const affiliate = await stackbe.affiliates.enroll({
2152
- * code: 'MYCODE',
2153
- * payoutEmail: 'payouts@example.com',
2154
- * });
2155
2420
  * ```
2156
2421
  */
2157
2422
  enroll(options?: EnrollOptions): Promise<AffiliateEnrollment>;
2158
2423
  /**
2159
2424
  * Get affiliate statistics.
2160
2425
  * Requires customer session token.
2161
- *
2162
- * @example
2163
- * ```typescript
2164
- * const stats = await stackbe.affiliates.getStats();
2165
- *
2166
- * if (stats.enrolled) {
2167
- * console.log(`Total earned: $${(stats.totalEarned / 100).toFixed(2)}`);
2168
- * console.log(`Pending: $${(stats.pendingBalance / 100).toFixed(2)}`);
2169
- * console.log(`Referrals: ${stats.totalReferrals}`);
2170
- * console.log(`Conversions: ${stats.totalConversions}`);
2171
- * }
2172
- * ```
2173
2426
  */
2174
2427
  getStats(): Promise<AffiliateStats>;
2175
2428
  /**
2176
2429
  * Get affiliate commission history.
2177
2430
  * Requires customer session token.
2431
+ */
2432
+ getCommissions(): Promise<AffiliateCommissionsResponse>;
2433
+ /**
2434
+ * Track a referral click (store token for attribution).
2435
+ * Requires API key.
2436
+ */
2437
+ trackReferral(code: string, referralUrl?: string): Promise<TrackReferralResponse>;
2438
+ /**
2439
+ * Get the full partner dashboard with stats, earnings by source, deals, and coupons.
2440
+ * Requires customer session token.
2178
2441
  *
2179
2442
  * @example
2180
2443
  * ```typescript
2181
- * const { commissions, total } = await stackbe.affiliates.getCommissions();
2182
- *
2183
- * commissions.forEach((c) => {
2184
- * console.log(`$${(c.amount / 100).toFixed(2)} - ${c.status}`);
2185
- * });
2444
+ * const dashboard = await stackbe.affiliates.getDashboard();
2445
+ * console.log(`Link earnings: $${dashboard.earningsBySource.link}`);
2446
+ * console.log(`Coupon earnings: $${dashboard.earningsBySource.coupon}`);
2447
+ * console.log(`Deal earnings: $${dashboard.earningsBySource.deal}`);
2186
2448
  * ```
2187
2449
  */
2188
- getCommissions(): Promise<AffiliateCommissionsResponse>;
2450
+ getDashboard(): Promise<PartnerDashboard>;
2189
2451
  /**
2190
- * Track a referral click (store token for attribution).
2191
- * Call this when a user lands on your site with a referral code.
2192
- * Requires API key.
2452
+ * Register a deal (lead attribution).
2453
+ * Requires customer session token and active partner enrollment.
2193
2454
  *
2194
2455
  * @example
2195
2456
  * ```typescript
2196
- * // In your landing page handler
2197
- * const refCode = req.query.ref;
2198
- * if (refCode) {
2199
- * const { token, expiresInDays } = await stackbe.affiliates.trackReferral(refCode);
2200
- * // Store token in cookie for attribution on signup
2201
- * res.cookie('ref_token', token, { maxAge: expiresInDays * 24 * 60 * 60 * 1000 });
2202
- * }
2457
+ * const deal = await stackbe.affiliates.registerDeal({
2458
+ * leadEmail: 'prospect@company.com',
2459
+ * leadName: 'John Smith',
2460
+ * notes: 'Met at conference, interested in Pro plan',
2461
+ * });
2203
2462
  * ```
2204
2463
  */
2205
- trackReferral(code: string, referralUrl?: string): Promise<TrackReferralResponse>;
2464
+ registerDeal(options: RegisterDealOptions): Promise<DealRegistration>;
2465
+ /**
2466
+ * List the current partner's deal registrations.
2467
+ * Requires customer session token.
2468
+ */
2469
+ listDeals(): Promise<DealListResponse>;
2206
2470
  }
2207
2471
 
2208
2472
  interface EarlyAccessSignup {
@@ -2665,6 +2929,8 @@ declare class StackBE {
2665
2929
  readonly checkout: CheckoutClient;
2666
2930
  /** Subscription management */
2667
2931
  readonly subscriptions: SubscriptionsClient;
2932
+ /** Payment method management (StackBE-managed billing) */
2933
+ readonly paymentMethods: PaymentMethodsClient;
2668
2934
  /** Customer authentication (magic links) */
2669
2935
  readonly auth: AuthClient;
2670
2936
  /** Organization management (B2B multi-user) */
@@ -2783,4 +3049,4 @@ declare class StackBE {
2783
3049
  }): (req: any, res: any, next: any) => Promise<any>;
2784
3050
  }
2785
3051
 
2786
- export { type AddMemberOptions, type AffiliateCommission, type AffiliateCommissionsResponse, type AffiliateEnrollment, type AffiliateInfo, type AffiliateStats, AffiliatesClient, AnalyticsClient, type AnalyticsFilterOptions, type AnyWebhookEvent, AuthClient, type BillingPortalSession, type CancelSubscriptionOptions, type CancelSubscriptionResponse, type CheckEntitlementResponse, type CheckUsageResponse, CheckoutClient, type CheckoutSessionResponse, type Coupon, type CouponDiscountType, type CouponDuration, CouponsClient, type CreateCheckoutOptions, type CreateCouponOptions, type CreateCustomerOptions, type CreateEarlyAccessSignupOptions, type CreateFeatureRequestOptions, type CreateOrganizationOptions, type Customer, type CustomerCreatedEvent, type CustomerFeatureActivity, type CustomerInvoice, type CustomerInvoicesResponse, type CustomerPaymentMethod, type CustomerSubscriptionHistory, type CustomerSubscriptionHistoryResponse, type CustomerUpdatedEvent, type CustomerUsageResponse, type CustomerWebhookPayload, type CustomerWithSubscription, CustomersClient, type DashboardMetrics, type DunningStatus, EarlyAccessClient, type EarlyAccessSignup, type EarlyAccessSignupListResponse, type EnrollOptions, EntitlementsClient, type EntitlementsResponse, type FeatureRequest, type FeatureRequestComment, type FeatureRequestImage, type FeatureRequestListResponse, FeatureRequestsClient, type FeatureUsagePoint, type GetSubscriptionOptions, type GrowthChartPoint, type GrowthMetrics, type InterestedCustomer, type InterestedCustomersResponse, type InviteMemberOptions, type ListEarlyAccessOptions, type ListFeatureRequestsOptions, type ListPlansOptions, type ListProductsOptions, type MRRHistoryPoint, type MagicLinkOptions, type MagicLinkResponse, type Organization, type OrganizationInvite, type OrganizationMember, OrganizationsClient, type PaymentFailedEvent, type PaymentSucceededEvent, type PaymentWebhookPayload, type PerformanceMetrics, type Plan, type PlanMetrics, PlansClient, type PopularEndpoint, type Product, ProductsClient, type RequestCountPoint, type RevenueByPlan, type SessionResponse, StackBE, type StackBEConfig, StackBEError, type StackBEErrorCode, type StackBEErrorResponse, type Subscription, type SubscriptionCancelledEvent, type SubscriptionCreatedEvent, type SubscriptionPlan, type SubscriptionRenewedEvent, type SubscriptionUpdatedEvent, type SubscriptionWebhookPayload, type SubscriptionWithPlan, SubscriptionsClient, type SwitchOrganizationResponse, type TimeRangeOptions, type TrackReferralResponse, type TrackUsageOptions, type TrackUsageResponse, type TrialEndedEvent, type TrialMetrics, type TrialStartedEvent, type TrialStatus, type UpcomingInvoice, type UpdateCouponOptions, type UpdateCustomerOptions, type UpdateOrganizationOptions, type UpdateSubscriptionOptions, UsageClient, type UsageMetric, type ValidateCouponResult, type VerifyTokenResponse, type WebhookEvent, type WebhookEventType };
3052
+ export { type AddMemberOptions, type AffiliateCommission, type AffiliateCommissionsResponse, type AffiliateEnrollment, type AffiliateInfo, type AffiliateStats, AffiliatesClient, AnalyticsClient, type AnalyticsFilterOptions, type AnyWebhookEvent, type AttachPaymentMethodOptions, AuthClient, type BillingPortalSession, type CancelSubscriptionOptions, type CancelSubscriptionResponse, type ChargeResult, type CheckEntitlementResponse, type CheckUsageResponse, CheckoutClient, type CheckoutSessionResponse, type Coupon, type CouponDiscountType, type CouponDuration, CouponsClient, type CreateCheckoutOptions, type CreateCouponOptions, type CreateCustomerOptions, type CreateEarlyAccessSignupOptions, type CreateFeatureRequestOptions, type CreateOrganizationOptions, type CreateSetupSessionOptions, type Customer, type CustomerCreatedEvent, type CustomerFeatureActivity, type CustomerInvoice, type CustomerInvoicesResponse, type CustomerPaymentMethod, type CustomerSubscriptionHistory, type CustomerSubscriptionHistoryResponse, type CustomerUpdatedEvent, type CustomerUsageResponse, type CustomerWebhookPayload, type CustomerWithSubscription, CustomersClient, type DashboardMetrics, type DunningStatus, EarlyAccessClient, type EarlyAccessSignup, type EarlyAccessSignupListResponse, type EnrollOptions, EntitlementsClient, type EntitlementsResponse, type FeatureRequest, type FeatureRequestComment, type FeatureRequestImage, type FeatureRequestListResponse, FeatureRequestsClient, type FeatureUsagePoint, type GetSubscriptionOptions, type GrowthChartPoint, type GrowthMetrics, type InterestedCustomer, type InterestedCustomersResponse, type InviteMemberOptions, type ListEarlyAccessOptions, type ListFeatureRequestsOptions, type ListPlansOptions, type ListProductsOptions, type MRRHistoryPoint, type MagicLinkOptions, type MagicLinkResponse, type MigrateToStackbeManagedResult, type Organization, type OrganizationInvite, type OrganizationMember, OrganizationsClient, type PaymentFailedEvent, type PaymentMethod, PaymentMethodsClient, type PaymentSucceededEvent, type PaymentWebhookPayload, type PerformanceMetrics, type Plan, type PlanMetrics, PlansClient, type PopularEndpoint, type Product, ProductsClient, type RequestCountPoint, type RevenueByPlan, type SessionResponse, type SetupSessionResponse, StackBE, type StackBEConfig, StackBEError, type StackBEErrorCode, type StackBEErrorResponse, type Subscription, type SubscriptionCancelledEvent, type SubscriptionCreatedEvent, type SubscriptionPlan, type SubscriptionRenewedEvent, type SubscriptionUpdatedEvent, type SubscriptionWebhookPayload, type SubscriptionWithPlan, SubscriptionsClient, type SwitchOrganizationResponse, type TimeRangeOptions, type TrackReferralResponse, type TrackUsageOptions, type TrackUsageResponse, type TrialEndedEvent, type TrialMetrics, type TrialStartedEvent, type TrialStatus, type UpcomingInvoice, type UpdateCouponOptions, type UpdateCustomerOptions, type UpdateOrganizationOptions, type UpdateSubscriptionOptions, UsageClient, type UsageMetric, type ValidateCouponResult, type VerifyTokenResponse, type WebhookEvent, type WebhookEventType };