better-auth-streampay 2.1.0 → 2.2.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.
@@ -40,6 +40,8 @@ declare const $ERROR_CODES: {
40
40
  SUBSCRIPTION_EXPIRED: ErrorCodeEntry<"SUBSCRIPTION_EXPIRED">;
41
41
  SUBSCRIPTION_ALREADY_SCHEDULED_CANCEL: ErrorCodeEntry<"SUBSCRIPTION_ALREADY_SCHEDULED_CANCEL">;
42
42
  SUBSCRIPTION_ALREADY_ON_PLAN: ErrorCodeEntry<"SUBSCRIPTION_ALREADY_ON_PLAN">;
43
+ SUBSCRIPTION_SEAT_COUNT_INVALID: ErrorCodeEntry<"SUBSCRIPTION_SEAT_COUNT_INVALID">;
44
+ SUBSCRIPTION_SEAT_CHANGE_ALREADY_SCHEDULED: ErrorCodeEntry<"SUBSCRIPTION_SEAT_CHANGE_ALREADY_SCHEDULED">;
43
45
  SUBSCRIPTION_IMMEDIATE_CANCEL_UNSUPPORTED: ErrorCodeEntry<"SUBSCRIPTION_IMMEDIATE_CANCEL_UNSUPPORTED">;
44
46
  SUBSCRIPTION_PERIOD_END_CANCEL_UNSUPPORTED: ErrorCodeEntry<"SUBSCRIPTION_PERIOD_END_CANCEL_UNSUPPORTED">;
45
47
  SUBSCRIPTION_PLAN_GROUP_MISMATCH: ErrorCodeEntry<"SUBSCRIPTION_PLAN_GROUP_MISMATCH">;
@@ -155,10 +157,22 @@ type StreamPayWebhookPayload<TEvent extends StreamPayEventType = StreamPayEventT
155
157
  type SubscriptionRecurringInterval = NonNullable<SubscriptionDetailed["recurring_interval"]>;
156
158
  type SubscriptionBillingStatus = "current" | "past_due";
157
159
  type SubscriptionReferenceType = "user" | "organization" | "custom";
160
+ /** Controls per-seat checkout without conflating billed seats with entitlement limits. */
161
+ interface StreamPaySeatBilling {
162
+ /** Initial quantity when an upgrade request omits `seats`. Defaults to `minimum`, then 1. */
163
+ default?: number;
164
+ /** Smallest allowed seat count. Defaults to 1. */
165
+ minimum?: number;
166
+ /** Largest allowed seat count. Omit for no application-level maximum. */
167
+ maximum?: number;
168
+ /** Lets the customer edit quantity on StreamPay's hosted checkout. Defaults to false. */
169
+ customerEditable?: boolean;
170
+ }
158
171
  /** `productId` must reference a recurring StreamPay product matching `billingInterval`. */
159
172
  interface StreamPayPlan<Limits extends Record<string, unknown> = Record<string, unknown>> {
160
173
  name: string;
161
174
  productId: string;
175
+ /** Price for one seat/item in the currency's smallest unit. */
162
176
  priceInSmallestUnit: number;
163
177
  currency?: CreatePaymentLinkDto["currency"];
164
178
  version?: string;
@@ -166,6 +180,7 @@ interface StreamPayPlan<Limits extends Record<string, unknown> = Record<string,
166
180
  billingIntervalCount?: number;
167
181
  trialPeriodDays?: number;
168
182
  group?: string;
183
+ seatBilling?: StreamPaySeatBilling;
169
184
  limits?: Limits;
170
185
  }
171
186
  type StreamPayPlanLike = StreamPayPlan<Record<string, unknown>>;
@@ -182,6 +197,8 @@ interface Subscription {
182
197
  planVersion: string | null;
183
198
  productId: string | null;
184
199
  group: string | null;
200
+ /** Authoritative quantity for the configured plan product. Legacy rows default to 1. */
201
+ seats: number;
185
202
  amountInSmallestUnit: number | null;
186
203
  originalAmountInSmallestUnit: number | null;
187
204
  currency: CurrencyCode | null;
@@ -202,6 +219,9 @@ interface Subscription {
202
219
  pendingPlan: string | null;
203
220
  pendingProductId: string | null;
204
221
  pendingPlanEffectiveAt: Date | null;
222
+ /** Seat count that StreamPay will apply with the pending change, if any. */
223
+ pendingSeats: number | null;
224
+ pendingSeatsEffectiveAt: Date | null;
205
225
  endedAt: Date | null;
206
226
  frozenAt: Date | null;
207
227
  freezeEndAt: Date | null;
@@ -239,7 +259,7 @@ interface AuthorizeReferenceContext {
239
259
  user: StreamPaySessionUser;
240
260
  referenceId: string;
241
261
  referenceType: SubscriptionReferenceType;
242
- action: "upgrade" | "cancel" | "uncancel" | "freeze" | "unfreeze" | "cancel-freeze" | "read" | "change-plan" | "cancel-plan-change";
262
+ action: "upgrade" | "cancel" | "uncancel" | "freeze" | "unfreeze" | "cancel-freeze" | "read" | "change-plan" | "update-seats" | "cancel-plan-change";
243
263
  }
244
264
  interface TrialEligibilityContext {
245
265
  user: StreamPaySessionUser;
@@ -398,6 +418,7 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
398
418
  method: "POST";
399
419
  body: zod.ZodObject<{
400
420
  plan: zod.ZodString;
421
+ seats: zod.ZodOptional<zod.ZodNumber>;
401
422
  referenceId: zod.ZodOptional<zod.ZodString>;
402
423
  referenceType: zod.ZodOptional<zod.ZodEnum<{
403
424
  custom: "custom";
@@ -406,7 +427,7 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
406
427
  }>>;
407
428
  successUrl: zod.ZodOptional<zod.ZodString>;
408
429
  failureUrl: zod.ZodOptional<zod.ZodString>;
409
- }, zod_v4_core.$strip>;
430
+ }, zod_v4_core.$strict>;
410
431
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
411
432
  session: {
412
433
  session: Record<string, any> & {
@@ -437,6 +458,7 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
437
458
  reused: boolean;
438
459
  status: string;
439
460
  plan: string;
461
+ seats: number;
440
462
  }>;
441
463
  subscriptionSuccess: better_auth.StrictEndpoint<"/subscription/success", {
442
464
  method: "GET";
@@ -722,6 +744,7 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
722
744
  body: zod.ZodObject<{
723
745
  subscriptionId: zod.ZodString;
724
746
  plan: zod.ZodString;
747
+ seats: zod.ZodOptional<zod.ZodNumber>;
725
748
  }, zod_v4_core.$strict>;
726
749
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
727
750
  session: {
@@ -750,6 +773,7 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
750
773
  mode: string;
751
774
  subscriptionId: string;
752
775
  plan: string;
776
+ seats: number;
753
777
  effectiveAt: string | null;
754
778
  pendingChange: {
755
779
  id?: string;
@@ -793,6 +817,7 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
793
817
  mode: string;
794
818
  subscriptionId: string;
795
819
  plan: string;
820
+ seats: number;
796
821
  effectiveAt: string | null;
797
822
  pendingChange: {
798
823
  id?: string;
@@ -1050,11 +1075,12 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1050
1075
  };
1051
1076
  reused: boolean;
1052
1077
  }>;
1053
- cancelSubscriptionPlanChange: better_auth.StrictEndpoint<"/subscription/change-plan/cancel", {
1078
+ updateSubscriptionSeats: better_auth.StrictEndpoint<"/subscription/update-seats", {
1054
1079
  method: "POST";
1055
1080
  body: zod.ZodObject<{
1056
1081
  subscriptionId: zod.ZodString;
1057
- }, zod_v4_core.$strip>;
1082
+ seats: zod.ZodNumber;
1083
+ }, zod_v4_core.$strict>;
1058
1084
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1059
1085
  session: {
1060
1086
  session: Record<string, any> & {
@@ -1079,7 +1105,97 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1079
1105
  };
1080
1106
  }>)[];
1081
1107
  }, {
1082
- canceled: boolean;
1108
+ mode: string;
1109
+ subscriptionId: string;
1110
+ seats: number;
1111
+ effectiveAt: string | null;
1112
+ pendingChange: {
1113
+ id?: string;
1114
+ effective_at?: string;
1115
+ invoice_was_reissued?: boolean;
1116
+ target_items?: {
1117
+ product_id?: string;
1118
+ product_name?: string;
1119
+ quantity?: number;
1120
+ original_amount?: string;
1121
+ discounted_amount?: string;
1122
+ }[];
1123
+ target_subscription_coupon_ids?: string[];
1124
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
1125
+ target_recurring_interval_count?: number;
1126
+ target_amount?: string;
1127
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1128
+ current_amount?: string;
1129
+ delta_amount?: string;
1130
+ delta_amount_per_month?: string | null;
1131
+ changes?: {
1132
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
1133
+ label?: string;
1134
+ product_id?: string | null;
1135
+ from_value?: string | null;
1136
+ to_value?: string | null;
1137
+ }[];
1138
+ next_invoice_preview?: {
1139
+ period_start?: string;
1140
+ period_end?: string;
1141
+ issue_at?: string;
1142
+ due_at?: string;
1143
+ subtotal?: string;
1144
+ discount_total?: string;
1145
+ total_amount?: string;
1146
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1147
+ };
1148
+ };
1149
+ reused: boolean;
1150
+ } | {
1151
+ mode: string;
1152
+ subscriptionId: string;
1153
+ seats: number;
1154
+ effectiveAt: null;
1155
+ pendingChange: null;
1156
+ reused: boolean;
1157
+ } | {
1158
+ mode: string;
1159
+ subscriptionId: string;
1160
+ seats: number;
1161
+ effectiveAt: string | null;
1162
+ pendingChange: {
1163
+ id?: string;
1164
+ effective_at?: string;
1165
+ invoice_was_reissued?: boolean;
1166
+ target_items?: {
1167
+ product_id?: string;
1168
+ product_name?: string;
1169
+ quantity?: number;
1170
+ original_amount?: string;
1171
+ discounted_amount?: string;
1172
+ }[];
1173
+ target_subscription_coupon_ids?: string[];
1174
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
1175
+ target_recurring_interval_count?: number;
1176
+ target_amount?: string;
1177
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1178
+ current_amount?: string;
1179
+ delta_amount?: string;
1180
+ delta_amount_per_month?: string | null;
1181
+ changes?: {
1182
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
1183
+ label?: string;
1184
+ product_id?: string | null;
1185
+ from_value?: string | null;
1186
+ to_value?: string | null;
1187
+ }[];
1188
+ next_invoice_preview?: {
1189
+ period_start?: string;
1190
+ period_end?: string;
1191
+ issue_at?: string;
1192
+ due_at?: string;
1193
+ subtotal?: string;
1194
+ discount_total?: string;
1195
+ total_amount?: string;
1196
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1197
+ };
1198
+ } | null;
1083
1199
  subscription: {
1084
1200
  created_at?: string;
1085
1201
  updated_at?: string | null;
@@ -1297,8 +1413,9 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1297
1413
  readonly amount_in_smallest_unit?: number;
1298
1414
  readonly original_amount_in_smallest_unit?: number;
1299
1415
  };
1416
+ reused: boolean;
1300
1417
  }>;
1301
- uncancelSubscription: better_auth.StrictEndpoint<"/subscription/uncancel", {
1418
+ cancelSubscriptionPlanChange: better_auth.StrictEndpoint<"/subscription/change-plan/cancel", {
1302
1419
  method: "POST";
1303
1420
  body: zod.ZodObject<{
1304
1421
  subscriptionId: zod.ZodString;
@@ -1327,7 +1444,8 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1327
1444
  };
1328
1445
  }>)[];
1329
1446
  }, {
1330
- uncanceled: boolean;
1447
+ canceled: boolean;
1448
+ reused: boolean;
1331
1449
  subscription: {
1332
1450
  created_at?: string;
1333
1451
  updated_at?: string | null;
@@ -1546,84 +1664,10 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1546
1664
  readonly original_amount_in_smallest_unit?: number;
1547
1665
  };
1548
1666
  }>;
1549
- freezeSubscription: better_auth.StrictEndpoint<"/subscription/freeze", {
1550
- method: "POST";
1551
- body: zod.ZodObject<{
1552
- subscriptionId: zod.ZodString;
1553
- freezeStartDatetime: zod.ZodString;
1554
- freezeEndDatetime: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
1555
- notes: zod.ZodOptional<zod.ZodString>;
1556
- }, zod_v4_core.$strip>;
1557
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1558
- session: {
1559
- session: Record<string, any> & {
1560
- id: string;
1561
- createdAt: Date;
1562
- updatedAt: Date;
1563
- userId: string;
1564
- expiresAt: Date;
1565
- token: string;
1566
- ipAddress?: string | null | undefined;
1567
- userAgent?: string | null | undefined;
1568
- };
1569
- user: Record<string, any> & {
1570
- id: string;
1571
- createdAt: Date;
1572
- updatedAt: Date;
1573
- email: string;
1574
- emailVerified: boolean;
1575
- name: string;
1576
- image?: string | null | undefined;
1577
- };
1578
- };
1579
- }>)[];
1580
- }, {
1581
- created_at?: string;
1582
- updated_at?: string | null;
1583
- id?: string;
1584
- freeze_start_datetime?: string;
1585
- freeze_end_datetime?: string | null;
1586
- notes?: string | null;
1587
- subscription_id?: string;
1588
- invoice_id?: string;
1589
- duration?: number | null;
1590
- }>;
1591
- unfreezeSubscription: better_auth.StrictEndpoint<"/subscription/unfreeze", {
1592
- method: "POST";
1593
- body: zod.ZodObject<{
1594
- subscriptionId: zod.ZodString;
1595
- }, zod_v4_core.$strip>;
1596
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1597
- session: {
1598
- session: Record<string, any> & {
1599
- id: string;
1600
- createdAt: Date;
1601
- updatedAt: Date;
1602
- userId: string;
1603
- expiresAt: Date;
1604
- token: string;
1605
- ipAddress?: string | null | undefined;
1606
- userAgent?: string | null | undefined;
1607
- };
1608
- user: Record<string, any> & {
1609
- id: string;
1610
- createdAt: Date;
1611
- updatedAt: Date;
1612
- email: string;
1613
- emailVerified: boolean;
1614
- name: string;
1615
- image?: string | null | undefined;
1616
- };
1617
- };
1618
- }>)[];
1619
- }, {
1620
- unfrozen: boolean;
1621
- }>;
1622
- cancelSubscriptionFreeze: better_auth.StrictEndpoint<"/subscription/freeze/cancel", {
1667
+ cancelSubscriptionPendingChange: better_auth.StrictEndpoint<"/subscription/pending-change/cancel", {
1623
1668
  method: "POST";
1624
1669
  body: zod.ZodObject<{
1625
1670
  subscriptionId: zod.ZodString;
1626
- freezeId: zod.ZodString;
1627
1671
  }, zod_v4_core.$strip>;
1628
1672
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1629
1673
  session: {
@@ -1650,74 +1694,648 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1650
1694
  }>)[];
1651
1695
  }, {
1652
1696
  canceled: boolean;
1653
- freezeId: string;
1654
1697
  reused: boolean;
1655
- }>;
1656
- listSubscriptions: better_auth.StrictEndpoint<"/subscription/list", {
1657
- method: "GET";
1658
- query: zod.ZodOptional<zod.ZodObject<{
1659
- referenceId: zod.ZodOptional<zod.ZodString>;
1660
- referenceType: zod.ZodOptional<zod.ZodEnum<{
1661
- custom: "custom";
1662
- user: "user";
1663
- organization: "organization";
1664
- }>>;
1665
- }, zod_v4_core.$strip>>;
1666
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1667
- session: {
1668
- session: Record<string, any> & {
1669
- id: string;
1670
- createdAt: Date;
1671
- updatedAt: Date;
1672
- userId: string;
1673
- expiresAt: Date;
1674
- token: string;
1675
- ipAddress?: string | null | undefined;
1676
- userAgent?: string | null | undefined;
1677
- };
1678
- user: Record<string, any> & {
1679
- id: string;
1680
- createdAt: Date;
1681
- updatedAt: Date;
1682
- email: string;
1683
- emailVerified: boolean;
1684
- name: string;
1685
- image?: string | null | undefined;
1686
- };
1698
+ subscription: {
1699
+ created_at?: string;
1700
+ updated_at?: string | null;
1701
+ id?: string;
1702
+ description?: string | null;
1703
+ amount?: string;
1704
+ original_amount?: string;
1705
+ item_level_discounted_amount?: string;
1706
+ coupon_calculation_metadata?: {
1707
+ coupons?: {
1708
+ coupon_id?: string;
1709
+ name?: string;
1710
+ is_percentage?: boolean;
1711
+ discount_value?: string;
1712
+ currency?: string | null;
1713
+ order?: number;
1714
+ amount_before_discount?: string;
1715
+ discount_amount?: string;
1716
+ amount_after_discount?: string;
1717
+ }[];
1687
1718
  };
1688
- }>)[];
1689
- }, {
1690
- plan: StreamPayPlanLike | null;
1691
- id: string;
1692
- referenceId: string;
1693
- referenceType: SubscriptionReferenceType;
1694
- activeSlotKey: string | null;
1695
- streampaySubscriptionId: string | null;
1696
- streampayConsumerId: string | null;
1697
- streampayPaymentLinkId: string | null;
1698
- planVersion: string | null;
1699
- productId: string | null;
1700
- group: string | null;
1701
- amountInSmallestUnit: number | null;
1702
- originalAmountInSmallestUnit: number | null;
1703
- currency: _streamsdk_typescript.CurrencyCode | null;
1704
- billingInterval: SubscriptionRecurringInterval | null;
1705
- billingIntervalCount: number | null;
1706
- status: SubscriptionStatus;
1707
- providerStatus: StreamPaySubscriptionStatus | null;
1708
- billingStatus: SubscriptionBillingStatus;
1709
- periodStart: Date | null;
1710
- periodEnd: Date | null;
1711
- currentCycleNumber: number | null;
1712
- trialStart: Date | null;
1713
- trialEnd: Date | null;
1714
- cancelAtPeriodEnd: boolean;
1715
- cancelAt: Date | null;
1716
- cancelScheduledAt: Date | null;
1719
+ remaining_days?: number;
1720
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1721
+ home_currency_amount?: string | null;
1722
+ exchange_rate_at_creation?: string | null;
1723
+ recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
1724
+ recurring_interval_count?: number;
1725
+ status?: "INACTIVE" | "ACTIVE" | "EXPIRED" | "CANCELED" | "FROZEN" | "TRIALING" | "TRIAL_PENDING";
1726
+ current_period_start?: string;
1727
+ current_period_end?: string;
1728
+ current_cycle_number?: number;
1729
+ cancel_at_period_end?: boolean;
1730
+ cancel_at_cycle_number?: number | null;
1731
+ started_at?: string | null;
1732
+ ended_at?: string | null;
1733
+ user_id?: string;
1734
+ organization_consumer_id?: string;
1735
+ latest_invoice_id?: string | null;
1736
+ trial_period_days?: number | null;
1737
+ trial_end?: string | null;
1738
+ organization_consumer?: {
1739
+ id?: string;
1740
+ name?: string;
1741
+ alias?: string | null;
1742
+ email?: string | null;
1743
+ phone_number?: string | null;
1744
+ preferred_language?: "AR" | "EN";
1745
+ consumer_type: "INDIVIDUAL" | "BUSINESS";
1746
+ address?: {
1747
+ address_line_1?: string;
1748
+ address_line_2?: string | null;
1749
+ city?: string;
1750
+ postal_code?: string | null;
1751
+ country?: string;
1752
+ };
1753
+ vat_number?: string | null;
1754
+ commercial_registration?: string | null;
1755
+ };
1756
+ items?: {
1757
+ created_at?: string;
1758
+ updated_at?: string | null;
1759
+ id?: string;
1760
+ product_id?: string;
1761
+ subscription_id?: string;
1762
+ quantity?: number;
1763
+ original_amount?: string;
1764
+ discounted_amount?: string;
1765
+ coupon_calculation_metadata?: {
1766
+ coupons?: {
1767
+ coupon_id?: string;
1768
+ name?: string;
1769
+ is_percentage?: boolean;
1770
+ discount_value?: string;
1771
+ currency?: string | null;
1772
+ order?: number;
1773
+ amount_before_discount?: string;
1774
+ discount_amount?: string;
1775
+ amount_after_discount?: string;
1776
+ }[];
1777
+ };
1778
+ product?: {
1779
+ created_at?: string;
1780
+ updated_at?: string | null;
1781
+ id?: string;
1782
+ name?: string;
1783
+ description?: string | null;
1784
+ type?: "RECURRING" | "ONE_OFF";
1785
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
1786
+ recurring_interval_count?: number;
1787
+ price?: string;
1788
+ currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VED" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "XSU" | "XUA" | "YER" | "ZAR" | "ZMW" | "ZWL";
1789
+ is_price_exempt_from_vat?: boolean;
1790
+ is_price_inclusive_of_vat?: boolean;
1791
+ price_excluding_vat?: string;
1792
+ vat_amount?: string;
1793
+ prices?: {
1794
+ id?: string;
1795
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1796
+ amount?: string;
1797
+ is_active?: boolean;
1798
+ is_price_inclusive_of_vat?: boolean;
1799
+ is_price_exempt_from_vat?: boolean;
1800
+ price_excluding_vat?: string;
1801
+ vat_amount?: string;
1802
+ }[];
1803
+ is_active?: boolean;
1804
+ is_one_time?: boolean;
1805
+ is_used_in_finalized_invoice: boolean;
1806
+ };
1807
+ }[] | null;
1808
+ latest_invoice?: {
1809
+ created_at?: string;
1810
+ updated_at?: string | null;
1811
+ id?: string;
1812
+ payment_link_id?: string | null;
1813
+ user_id?: string;
1814
+ organization_id?: string;
1815
+ organization_consumer_id?: string;
1816
+ account_id?: string;
1817
+ branch_id?: string;
1818
+ org_invoice_number?: number;
1819
+ description?: string | null;
1820
+ total_amount?: string;
1821
+ original_amount?: string;
1822
+ item_level_discounted_amount?: string;
1823
+ total_vat_amount?: string | null;
1824
+ total_price_excluding_vat?: string | null;
1825
+ coupon_calculation_metadata?: {
1826
+ coupons?: {
1827
+ coupon_id?: string;
1828
+ name?: string;
1829
+ is_percentage?: boolean;
1830
+ discount_value?: string;
1831
+ currency?: string | null;
1832
+ order?: number;
1833
+ amount_before_discount?: string;
1834
+ discount_amount?: string;
1835
+ amount_after_discount?: string;
1836
+ }[];
1837
+ };
1838
+ currency: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1839
+ home_currency_amount?: string | null;
1840
+ home_currency_amount_actual?: string | null;
1841
+ exchange_rate_at_creation?: string | null;
1842
+ consumer_message?: string | null;
1843
+ status?: "CREATED" | "ACCEPTED" | "EXPIRED" | "CANCELED" | "DRAFT" | "SENT" | "REJECTED" | "COMPLETED";
1844
+ payment_method?: "OPENBANKING" | "PAYMENTGATEWAY";
1845
+ allowed_payment_flow?: "ALL" | "AUTO" | "MANUAL";
1846
+ current_payment_flow?: "ALL" | "AUTO" | "MANUAL";
1847
+ period_start?: string | null;
1848
+ period_end?: string | null;
1849
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
1850
+ recurring_interval_count?: number | null;
1851
+ type?: "RECURRING" | "ONE_OFF" | "ONE_OFF_FUTURE" | "INSTALLMENTS" | "PRORATION";
1852
+ readonly total_amount_in_smallest_unit?: number;
1853
+ readonly original_amount_in_smallest_unit?: number;
1854
+ };
1855
+ latest_freeze?: {
1856
+ created_at?: string;
1857
+ updated_at?: string | null;
1858
+ id?: string;
1859
+ freeze_start_datetime?: string;
1860
+ freeze_end_datetime?: string | null;
1861
+ notes?: string | null;
1862
+ subscription_id?: string;
1863
+ invoice_id?: string;
1864
+ duration?: number | null;
1865
+ };
1866
+ override_payment_methods?: {
1867
+ visa?: boolean | null;
1868
+ mastercard?: boolean | null;
1869
+ amex?: boolean | null;
1870
+ bank_transfer?: boolean | null;
1871
+ installment?: boolean | null;
1872
+ qurrah?: boolean | null;
1873
+ subscription_auto_renewal?: boolean | null;
1874
+ };
1875
+ pending_change?: {
1876
+ id?: string;
1877
+ effective_at?: string;
1878
+ invoice_was_reissued?: boolean;
1879
+ target_items?: {
1880
+ product_id?: string;
1881
+ product_name?: string;
1882
+ quantity?: number;
1883
+ original_amount?: string;
1884
+ discounted_amount?: string;
1885
+ }[];
1886
+ target_subscription_coupon_ids?: string[];
1887
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
1888
+ target_recurring_interval_count?: number;
1889
+ target_amount?: string;
1890
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1891
+ current_amount?: string;
1892
+ delta_amount?: string;
1893
+ delta_amount_per_month?: string | null;
1894
+ changes?: {
1895
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
1896
+ label?: string;
1897
+ product_id?: string | null;
1898
+ from_value?: string | null;
1899
+ to_value?: string | null;
1900
+ }[];
1901
+ next_invoice_preview?: {
1902
+ period_start?: string;
1903
+ period_end?: string;
1904
+ issue_at?: string;
1905
+ due_at?: string;
1906
+ subtotal?: string;
1907
+ discount_total?: string;
1908
+ total_amount?: string;
1909
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1910
+ };
1911
+ };
1912
+ readonly amount_in_smallest_unit?: number;
1913
+ readonly original_amount_in_smallest_unit?: number;
1914
+ };
1915
+ }>;
1916
+ uncancelSubscription: better_auth.StrictEndpoint<"/subscription/uncancel", {
1917
+ method: "POST";
1918
+ body: zod.ZodObject<{
1919
+ subscriptionId: zod.ZodString;
1920
+ }, zod_v4_core.$strip>;
1921
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1922
+ session: {
1923
+ session: Record<string, any> & {
1924
+ id: string;
1925
+ createdAt: Date;
1926
+ updatedAt: Date;
1927
+ userId: string;
1928
+ expiresAt: Date;
1929
+ token: string;
1930
+ ipAddress?: string | null | undefined;
1931
+ userAgent?: string | null | undefined;
1932
+ };
1933
+ user: Record<string, any> & {
1934
+ id: string;
1935
+ createdAt: Date;
1936
+ updatedAt: Date;
1937
+ email: string;
1938
+ emailVerified: boolean;
1939
+ name: string;
1940
+ image?: string | null | undefined;
1941
+ };
1942
+ };
1943
+ }>)[];
1944
+ }, {
1945
+ uncanceled: boolean;
1946
+ subscription: {
1947
+ created_at?: string;
1948
+ updated_at?: string | null;
1949
+ id?: string;
1950
+ description?: string | null;
1951
+ amount?: string;
1952
+ original_amount?: string;
1953
+ item_level_discounted_amount?: string;
1954
+ coupon_calculation_metadata?: {
1955
+ coupons?: {
1956
+ coupon_id?: string;
1957
+ name?: string;
1958
+ is_percentage?: boolean;
1959
+ discount_value?: string;
1960
+ currency?: string | null;
1961
+ order?: number;
1962
+ amount_before_discount?: string;
1963
+ discount_amount?: string;
1964
+ amount_after_discount?: string;
1965
+ }[];
1966
+ };
1967
+ remaining_days?: number;
1968
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
1969
+ home_currency_amount?: string | null;
1970
+ exchange_rate_at_creation?: string | null;
1971
+ recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
1972
+ recurring_interval_count?: number;
1973
+ status?: "INACTIVE" | "ACTIVE" | "EXPIRED" | "CANCELED" | "FROZEN" | "TRIALING" | "TRIAL_PENDING";
1974
+ current_period_start?: string;
1975
+ current_period_end?: string;
1976
+ current_cycle_number?: number;
1977
+ cancel_at_period_end?: boolean;
1978
+ cancel_at_cycle_number?: number | null;
1979
+ started_at?: string | null;
1980
+ ended_at?: string | null;
1981
+ user_id?: string;
1982
+ organization_consumer_id?: string;
1983
+ latest_invoice_id?: string | null;
1984
+ trial_period_days?: number | null;
1985
+ trial_end?: string | null;
1986
+ organization_consumer?: {
1987
+ id?: string;
1988
+ name?: string;
1989
+ alias?: string | null;
1990
+ email?: string | null;
1991
+ phone_number?: string | null;
1992
+ preferred_language?: "AR" | "EN";
1993
+ consumer_type: "INDIVIDUAL" | "BUSINESS";
1994
+ address?: {
1995
+ address_line_1?: string;
1996
+ address_line_2?: string | null;
1997
+ city?: string;
1998
+ postal_code?: string | null;
1999
+ country?: string;
2000
+ };
2001
+ vat_number?: string | null;
2002
+ commercial_registration?: string | null;
2003
+ };
2004
+ items?: {
2005
+ created_at?: string;
2006
+ updated_at?: string | null;
2007
+ id?: string;
2008
+ product_id?: string;
2009
+ subscription_id?: string;
2010
+ quantity?: number;
2011
+ original_amount?: string;
2012
+ discounted_amount?: string;
2013
+ coupon_calculation_metadata?: {
2014
+ coupons?: {
2015
+ coupon_id?: string;
2016
+ name?: string;
2017
+ is_percentage?: boolean;
2018
+ discount_value?: string;
2019
+ currency?: string | null;
2020
+ order?: number;
2021
+ amount_before_discount?: string;
2022
+ discount_amount?: string;
2023
+ amount_after_discount?: string;
2024
+ }[];
2025
+ };
2026
+ product?: {
2027
+ created_at?: string;
2028
+ updated_at?: string | null;
2029
+ id?: string;
2030
+ name?: string;
2031
+ description?: string | null;
2032
+ type?: "RECURRING" | "ONE_OFF";
2033
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
2034
+ recurring_interval_count?: number;
2035
+ price?: string;
2036
+ currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VED" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "XSU" | "XUA" | "YER" | "ZAR" | "ZMW" | "ZWL";
2037
+ is_price_exempt_from_vat?: boolean;
2038
+ is_price_inclusive_of_vat?: boolean;
2039
+ price_excluding_vat?: string;
2040
+ vat_amount?: string;
2041
+ prices?: {
2042
+ id?: string;
2043
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
2044
+ amount?: string;
2045
+ is_active?: boolean;
2046
+ is_price_inclusive_of_vat?: boolean;
2047
+ is_price_exempt_from_vat?: boolean;
2048
+ price_excluding_vat?: string;
2049
+ vat_amount?: string;
2050
+ }[];
2051
+ is_active?: boolean;
2052
+ is_one_time?: boolean;
2053
+ is_used_in_finalized_invoice: boolean;
2054
+ };
2055
+ }[] | null;
2056
+ latest_invoice?: {
2057
+ created_at?: string;
2058
+ updated_at?: string | null;
2059
+ id?: string;
2060
+ payment_link_id?: string | null;
2061
+ user_id?: string;
2062
+ organization_id?: string;
2063
+ organization_consumer_id?: string;
2064
+ account_id?: string;
2065
+ branch_id?: string;
2066
+ org_invoice_number?: number;
2067
+ description?: string | null;
2068
+ total_amount?: string;
2069
+ original_amount?: string;
2070
+ item_level_discounted_amount?: string;
2071
+ total_vat_amount?: string | null;
2072
+ total_price_excluding_vat?: string | null;
2073
+ coupon_calculation_metadata?: {
2074
+ coupons?: {
2075
+ coupon_id?: string;
2076
+ name?: string;
2077
+ is_percentage?: boolean;
2078
+ discount_value?: string;
2079
+ currency?: string | null;
2080
+ order?: number;
2081
+ amount_before_discount?: string;
2082
+ discount_amount?: string;
2083
+ amount_after_discount?: string;
2084
+ }[];
2085
+ };
2086
+ currency: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
2087
+ home_currency_amount?: string | null;
2088
+ home_currency_amount_actual?: string | null;
2089
+ exchange_rate_at_creation?: string | null;
2090
+ consumer_message?: string | null;
2091
+ status?: "CREATED" | "ACCEPTED" | "EXPIRED" | "CANCELED" | "DRAFT" | "SENT" | "REJECTED" | "COMPLETED";
2092
+ payment_method?: "OPENBANKING" | "PAYMENTGATEWAY";
2093
+ allowed_payment_flow?: "ALL" | "AUTO" | "MANUAL";
2094
+ current_payment_flow?: "ALL" | "AUTO" | "MANUAL";
2095
+ period_start?: string | null;
2096
+ period_end?: string | null;
2097
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
2098
+ recurring_interval_count?: number | null;
2099
+ type?: "RECURRING" | "ONE_OFF" | "ONE_OFF_FUTURE" | "INSTALLMENTS" | "PRORATION";
2100
+ readonly total_amount_in_smallest_unit?: number;
2101
+ readonly original_amount_in_smallest_unit?: number;
2102
+ };
2103
+ latest_freeze?: {
2104
+ created_at?: string;
2105
+ updated_at?: string | null;
2106
+ id?: string;
2107
+ freeze_start_datetime?: string;
2108
+ freeze_end_datetime?: string | null;
2109
+ notes?: string | null;
2110
+ subscription_id?: string;
2111
+ invoice_id?: string;
2112
+ duration?: number | null;
2113
+ };
2114
+ override_payment_methods?: {
2115
+ visa?: boolean | null;
2116
+ mastercard?: boolean | null;
2117
+ amex?: boolean | null;
2118
+ bank_transfer?: boolean | null;
2119
+ installment?: boolean | null;
2120
+ qurrah?: boolean | null;
2121
+ subscription_auto_renewal?: boolean | null;
2122
+ };
2123
+ pending_change?: {
2124
+ id?: string;
2125
+ effective_at?: string;
2126
+ invoice_was_reissued?: boolean;
2127
+ target_items?: {
2128
+ product_id?: string;
2129
+ product_name?: string;
2130
+ quantity?: number;
2131
+ original_amount?: string;
2132
+ discounted_amount?: string;
2133
+ }[];
2134
+ target_subscription_coupon_ids?: string[];
2135
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
2136
+ target_recurring_interval_count?: number;
2137
+ target_amount?: string;
2138
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
2139
+ current_amount?: string;
2140
+ delta_amount?: string;
2141
+ delta_amount_per_month?: string | null;
2142
+ changes?: {
2143
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
2144
+ label?: string;
2145
+ product_id?: string | null;
2146
+ from_value?: string | null;
2147
+ to_value?: string | null;
2148
+ }[];
2149
+ next_invoice_preview?: {
2150
+ period_start?: string;
2151
+ period_end?: string;
2152
+ issue_at?: string;
2153
+ due_at?: string;
2154
+ subtotal?: string;
2155
+ discount_total?: string;
2156
+ total_amount?: string;
2157
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
2158
+ };
2159
+ };
2160
+ readonly amount_in_smallest_unit?: number;
2161
+ readonly original_amount_in_smallest_unit?: number;
2162
+ };
2163
+ }>;
2164
+ freezeSubscription: better_auth.StrictEndpoint<"/subscription/freeze", {
2165
+ method: "POST";
2166
+ body: zod.ZodObject<{
2167
+ subscriptionId: zod.ZodString;
2168
+ freezeStartDatetime: zod.ZodString;
2169
+ freezeEndDatetime: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
2170
+ notes: zod.ZodOptional<zod.ZodString>;
2171
+ }, zod_v4_core.$strip>;
2172
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2173
+ session: {
2174
+ session: Record<string, any> & {
2175
+ id: string;
2176
+ createdAt: Date;
2177
+ updatedAt: Date;
2178
+ userId: string;
2179
+ expiresAt: Date;
2180
+ token: string;
2181
+ ipAddress?: string | null | undefined;
2182
+ userAgent?: string | null | undefined;
2183
+ };
2184
+ user: Record<string, any> & {
2185
+ id: string;
2186
+ createdAt: Date;
2187
+ updatedAt: Date;
2188
+ email: string;
2189
+ emailVerified: boolean;
2190
+ name: string;
2191
+ image?: string | null | undefined;
2192
+ };
2193
+ };
2194
+ }>)[];
2195
+ }, {
2196
+ created_at?: string;
2197
+ updated_at?: string | null;
2198
+ id?: string;
2199
+ freeze_start_datetime?: string;
2200
+ freeze_end_datetime?: string | null;
2201
+ notes?: string | null;
2202
+ subscription_id?: string;
2203
+ invoice_id?: string;
2204
+ duration?: number | null;
2205
+ }>;
2206
+ unfreezeSubscription: better_auth.StrictEndpoint<"/subscription/unfreeze", {
2207
+ method: "POST";
2208
+ body: zod.ZodObject<{
2209
+ subscriptionId: zod.ZodString;
2210
+ }, zod_v4_core.$strip>;
2211
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2212
+ session: {
2213
+ session: Record<string, any> & {
2214
+ id: string;
2215
+ createdAt: Date;
2216
+ updatedAt: Date;
2217
+ userId: string;
2218
+ expiresAt: Date;
2219
+ token: string;
2220
+ ipAddress?: string | null | undefined;
2221
+ userAgent?: string | null | undefined;
2222
+ };
2223
+ user: Record<string, any> & {
2224
+ id: string;
2225
+ createdAt: Date;
2226
+ updatedAt: Date;
2227
+ email: string;
2228
+ emailVerified: boolean;
2229
+ name: string;
2230
+ image?: string | null | undefined;
2231
+ };
2232
+ };
2233
+ }>)[];
2234
+ }, {
2235
+ unfrozen: boolean;
2236
+ }>;
2237
+ cancelSubscriptionFreeze: better_auth.StrictEndpoint<"/subscription/freeze/cancel", {
2238
+ method: "POST";
2239
+ body: zod.ZodObject<{
2240
+ subscriptionId: zod.ZodString;
2241
+ freezeId: zod.ZodString;
2242
+ }, zod_v4_core.$strip>;
2243
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2244
+ session: {
2245
+ session: Record<string, any> & {
2246
+ id: string;
2247
+ createdAt: Date;
2248
+ updatedAt: Date;
2249
+ userId: string;
2250
+ expiresAt: Date;
2251
+ token: string;
2252
+ ipAddress?: string | null | undefined;
2253
+ userAgent?: string | null | undefined;
2254
+ };
2255
+ user: Record<string, any> & {
2256
+ id: string;
2257
+ createdAt: Date;
2258
+ updatedAt: Date;
2259
+ email: string;
2260
+ emailVerified: boolean;
2261
+ name: string;
2262
+ image?: string | null | undefined;
2263
+ };
2264
+ };
2265
+ }>)[];
2266
+ }, {
2267
+ canceled: boolean;
2268
+ freezeId: string;
2269
+ reused: boolean;
2270
+ }>;
2271
+ listSubscriptions: better_auth.StrictEndpoint<"/subscription/list", {
2272
+ method: "GET";
2273
+ query: zod.ZodOptional<zod.ZodObject<{
2274
+ referenceId: zod.ZodOptional<zod.ZodString>;
2275
+ referenceType: zod.ZodOptional<zod.ZodEnum<{
2276
+ custom: "custom";
2277
+ user: "user";
2278
+ organization: "organization";
2279
+ }>>;
2280
+ }, zod_v4_core.$strip>>;
2281
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2282
+ session: {
2283
+ session: Record<string, any> & {
2284
+ id: string;
2285
+ createdAt: Date;
2286
+ updatedAt: Date;
2287
+ userId: string;
2288
+ expiresAt: Date;
2289
+ token: string;
2290
+ ipAddress?: string | null | undefined;
2291
+ userAgent?: string | null | undefined;
2292
+ };
2293
+ user: Record<string, any> & {
2294
+ id: string;
2295
+ createdAt: Date;
2296
+ updatedAt: Date;
2297
+ email: string;
2298
+ emailVerified: boolean;
2299
+ name: string;
2300
+ image?: string | null | undefined;
2301
+ };
2302
+ };
2303
+ }>)[];
2304
+ }, {
2305
+ seats: number;
2306
+ plan: StreamPayPlanLike | null;
2307
+ id: string;
2308
+ referenceId: string;
2309
+ referenceType: SubscriptionReferenceType;
2310
+ activeSlotKey: string | null;
2311
+ streampaySubscriptionId: string | null;
2312
+ streampayConsumerId: string | null;
2313
+ streampayPaymentLinkId: string | null;
2314
+ planVersion: string | null;
2315
+ productId: string | null;
2316
+ group: string | null;
2317
+ amountInSmallestUnit: number | null;
2318
+ originalAmountInSmallestUnit: number | null;
2319
+ currency: _streamsdk_typescript.CurrencyCode | null;
2320
+ billingInterval: SubscriptionRecurringInterval | null;
2321
+ billingIntervalCount: number | null;
2322
+ status: SubscriptionStatus;
2323
+ providerStatus: StreamPaySubscriptionStatus | null;
2324
+ billingStatus: SubscriptionBillingStatus;
2325
+ periodStart: Date | null;
2326
+ periodEnd: Date | null;
2327
+ currentCycleNumber: number | null;
2328
+ trialStart: Date | null;
2329
+ trialEnd: Date | null;
2330
+ cancelAtPeriodEnd: boolean;
2331
+ cancelAt: Date | null;
2332
+ cancelScheduledAt: Date | null;
1717
2333
  canceledAt: Date | null;
1718
2334
  pendingPlan: string | null;
1719
2335
  pendingProductId: string | null;
1720
2336
  pendingPlanEffectiveAt: Date | null;
2337
+ pendingSeats: number | null;
2338
+ pendingSeatsEffectiveAt: Date | null;
1721
2339
  endedAt: Date | null;
1722
2340
  frozenAt: Date | null;
1723
2341
  freezeEndAt: Date | null;
@@ -1761,6 +2379,7 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1761
2379
  };
1762
2380
  }>)[];
1763
2381
  }, {
2382
+ seats: number;
1764
2383
  plan: StreamPayPlanLike | null;
1765
2384
  id: string;
1766
2385
  referenceId: string;
@@ -1792,6 +2411,8 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
1792
2411
  pendingPlan: string | null;
1793
2412
  pendingProductId: string | null;
1794
2413
  pendingPlanEffectiveAt: Date | null;
2414
+ pendingSeats: number | null;
2415
+ pendingSeatsEffectiveAt: Date | null;
1795
2416
  endedAt: Date | null;
1796
2417
  frozenAt: Date | null;
1797
2418
  freezeEndAt: Date | null;
@@ -2012,6 +2633,11 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
2012
2633
  readonly required: false;
2013
2634
  readonly index: true;
2014
2635
  };
2636
+ readonly seats: {
2637
+ readonly type: "number";
2638
+ readonly required: false;
2639
+ readonly defaultValue: 1;
2640
+ };
2015
2641
  readonly amountInSmallestUnit: {
2016
2642
  readonly type: "number";
2017
2643
  readonly required: false;
@@ -2100,6 +2726,14 @@ declare function subscriptions(subsOptions: SubscriptionsOptions): (options: Str
2100
2726
  readonly type: "date";
2101
2727
  readonly required: false;
2102
2728
  };
2729
+ readonly pendingSeats: {
2730
+ readonly type: "number";
2731
+ readonly required: false;
2732
+ };
2733
+ readonly pendingSeatsEffectiveAt: {
2734
+ readonly type: "date";
2735
+ readonly required: false;
2736
+ };
2103
2737
  readonly endedAt: {
2104
2738
  readonly type: "date";
2105
2739
  readonly required: false;
@@ -10242,6 +10876,7 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
10242
10876
  method: "POST";
10243
10877
  body: zod.ZodObject<{
10244
10878
  plan: zod.ZodString;
10879
+ seats: zod.ZodOptional<zod.ZodNumber>;
10245
10880
  referenceId: zod.ZodOptional<zod.ZodString>;
10246
10881
  referenceType: zod.ZodOptional<zod.ZodEnum<{
10247
10882
  custom: "custom";
@@ -10250,7 +10885,7 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
10250
10885
  }>>;
10251
10886
  successUrl: zod.ZodOptional<zod.ZodString>;
10252
10887
  failureUrl: zod.ZodOptional<zod.ZodString>;
10253
- }, zod_v4_core.$strip>;
10888
+ }, zod_v4_core.$strict>;
10254
10889
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
10255
10890
  session: {
10256
10891
  session: Record<string, any> & {
@@ -10281,6 +10916,7 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
10281
10916
  reused: boolean;
10282
10917
  status: string;
10283
10918
  plan: string;
10919
+ seats: number;
10284
10920
  }>;
10285
10921
  subscriptionSuccess: better_auth.StrictEndpoint<"/subscription/success", {
10286
10922
  method: "GET";
@@ -10558,14 +11194,350 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
10558
11194
  currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
10559
11195
  };
10560
11196
  };
10561
- readonly amount_in_smallest_unit?: number;
10562
- readonly original_amount_in_smallest_unit?: number;
11197
+ readonly amount_in_smallest_unit?: number;
11198
+ readonly original_amount_in_smallest_unit?: number;
11199
+ }>;
11200
+ changeSubscriptionPlan: better_auth.StrictEndpoint<"/subscription/change-plan", {
11201
+ method: "POST";
11202
+ body: zod.ZodObject<{
11203
+ subscriptionId: zod.ZodString;
11204
+ plan: zod.ZodString;
11205
+ seats: zod.ZodOptional<zod.ZodNumber>;
11206
+ }, zod_v4_core.$strict>;
11207
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
11208
+ session: {
11209
+ session: Record<string, any> & {
11210
+ id: string;
11211
+ createdAt: Date;
11212
+ updatedAt: Date;
11213
+ userId: string;
11214
+ expiresAt: Date;
11215
+ token: string;
11216
+ ipAddress?: string | null | undefined;
11217
+ userAgent?: string | null | undefined;
11218
+ };
11219
+ user: Record<string, any> & {
11220
+ id: string;
11221
+ createdAt: Date;
11222
+ updatedAt: Date;
11223
+ email: string;
11224
+ emailVerified: boolean;
11225
+ name: string;
11226
+ image?: string | null | undefined;
11227
+ };
11228
+ };
11229
+ }>)[];
11230
+ }, {
11231
+ mode: string;
11232
+ subscriptionId: string;
11233
+ plan: string;
11234
+ seats: number;
11235
+ effectiveAt: string | null;
11236
+ pendingChange: {
11237
+ id?: string;
11238
+ effective_at?: string;
11239
+ invoice_was_reissued?: boolean;
11240
+ target_items?: {
11241
+ product_id?: string;
11242
+ product_name?: string;
11243
+ quantity?: number;
11244
+ original_amount?: string;
11245
+ discounted_amount?: string;
11246
+ }[];
11247
+ target_subscription_coupon_ids?: string[];
11248
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
11249
+ target_recurring_interval_count?: number;
11250
+ target_amount?: string;
11251
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11252
+ current_amount?: string;
11253
+ delta_amount?: string;
11254
+ delta_amount_per_month?: string | null;
11255
+ changes?: {
11256
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
11257
+ label?: string;
11258
+ product_id?: string | null;
11259
+ from_value?: string | null;
11260
+ to_value?: string | null;
11261
+ }[];
11262
+ next_invoice_preview?: {
11263
+ period_start?: string;
11264
+ period_end?: string;
11265
+ issue_at?: string;
11266
+ due_at?: string;
11267
+ subtotal?: string;
11268
+ discount_total?: string;
11269
+ total_amount?: string;
11270
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11271
+ };
11272
+ } | undefined;
11273
+ reused: boolean;
11274
+ } | {
11275
+ mode: string;
11276
+ subscriptionId: string;
11277
+ plan: string;
11278
+ seats: number;
11279
+ effectiveAt: string | null;
11280
+ pendingChange: {
11281
+ id?: string;
11282
+ effective_at?: string;
11283
+ invoice_was_reissued?: boolean;
11284
+ target_items?: {
11285
+ product_id?: string;
11286
+ product_name?: string;
11287
+ quantity?: number;
11288
+ original_amount?: string;
11289
+ discounted_amount?: string;
11290
+ }[];
11291
+ target_subscription_coupon_ids?: string[];
11292
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
11293
+ target_recurring_interval_count?: number;
11294
+ target_amount?: string;
11295
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11296
+ current_amount?: string;
11297
+ delta_amount?: string;
11298
+ delta_amount_per_month?: string | null;
11299
+ changes?: {
11300
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
11301
+ label?: string;
11302
+ product_id?: string | null;
11303
+ from_value?: string | null;
11304
+ to_value?: string | null;
11305
+ }[];
11306
+ next_invoice_preview?: {
11307
+ period_start?: string;
11308
+ period_end?: string;
11309
+ issue_at?: string;
11310
+ due_at?: string;
11311
+ subtotal?: string;
11312
+ discount_total?: string;
11313
+ total_amount?: string;
11314
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11315
+ };
11316
+ } | null;
11317
+ subscription: {
11318
+ created_at?: string;
11319
+ updated_at?: string | null;
11320
+ id?: string;
11321
+ description?: string | null;
11322
+ amount?: string;
11323
+ original_amount?: string;
11324
+ item_level_discounted_amount?: string;
11325
+ coupon_calculation_metadata?: {
11326
+ coupons?: {
11327
+ coupon_id?: string;
11328
+ name?: string;
11329
+ is_percentage?: boolean;
11330
+ discount_value?: string;
11331
+ currency?: string | null;
11332
+ order?: number;
11333
+ amount_before_discount?: string;
11334
+ discount_amount?: string;
11335
+ amount_after_discount?: string;
11336
+ }[];
11337
+ };
11338
+ remaining_days?: number;
11339
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11340
+ home_currency_amount?: string | null;
11341
+ exchange_rate_at_creation?: string | null;
11342
+ recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
11343
+ recurring_interval_count?: number;
11344
+ status?: "INACTIVE" | "ACTIVE" | "EXPIRED" | "CANCELED" | "FROZEN" | "TRIALING" | "TRIAL_PENDING";
11345
+ current_period_start?: string;
11346
+ current_period_end?: string;
11347
+ current_cycle_number?: number;
11348
+ cancel_at_period_end?: boolean;
11349
+ cancel_at_cycle_number?: number | null;
11350
+ started_at?: string | null;
11351
+ ended_at?: string | null;
11352
+ user_id?: string;
11353
+ organization_consumer_id?: string;
11354
+ latest_invoice_id?: string | null;
11355
+ trial_period_days?: number | null;
11356
+ trial_end?: string | null;
11357
+ organization_consumer?: {
11358
+ id?: string;
11359
+ name?: string;
11360
+ alias?: string | null;
11361
+ email?: string | null;
11362
+ phone_number?: string | null;
11363
+ preferred_language?: "AR" | "EN";
11364
+ consumer_type: "INDIVIDUAL" | "BUSINESS";
11365
+ address?: {
11366
+ address_line_1?: string;
11367
+ address_line_2?: string | null;
11368
+ city?: string;
11369
+ postal_code?: string | null;
11370
+ country?: string;
11371
+ };
11372
+ vat_number?: string | null;
11373
+ commercial_registration?: string | null;
11374
+ };
11375
+ items?: {
11376
+ created_at?: string;
11377
+ updated_at?: string | null;
11378
+ id?: string;
11379
+ product_id?: string;
11380
+ subscription_id?: string;
11381
+ quantity?: number;
11382
+ original_amount?: string;
11383
+ discounted_amount?: string;
11384
+ coupon_calculation_metadata?: {
11385
+ coupons?: {
11386
+ coupon_id?: string;
11387
+ name?: string;
11388
+ is_percentage?: boolean;
11389
+ discount_value?: string;
11390
+ currency?: string | null;
11391
+ order?: number;
11392
+ amount_before_discount?: string;
11393
+ discount_amount?: string;
11394
+ amount_after_discount?: string;
11395
+ }[];
11396
+ };
11397
+ product?: {
11398
+ created_at?: string;
11399
+ updated_at?: string | null;
11400
+ id?: string;
11401
+ name?: string;
11402
+ description?: string | null;
11403
+ type?: "RECURRING" | "ONE_OFF";
11404
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
11405
+ recurring_interval_count?: number;
11406
+ price?: string;
11407
+ currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VED" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "XSU" | "XUA" | "YER" | "ZAR" | "ZMW" | "ZWL";
11408
+ is_price_exempt_from_vat?: boolean;
11409
+ is_price_inclusive_of_vat?: boolean;
11410
+ price_excluding_vat?: string;
11411
+ vat_amount?: string;
11412
+ prices?: {
11413
+ id?: string;
11414
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11415
+ amount?: string;
11416
+ is_active?: boolean;
11417
+ is_price_inclusive_of_vat?: boolean;
11418
+ is_price_exempt_from_vat?: boolean;
11419
+ price_excluding_vat?: string;
11420
+ vat_amount?: string;
11421
+ }[];
11422
+ is_active?: boolean;
11423
+ is_one_time?: boolean;
11424
+ is_used_in_finalized_invoice: boolean;
11425
+ };
11426
+ }[] | null;
11427
+ latest_invoice?: {
11428
+ created_at?: string;
11429
+ updated_at?: string | null;
11430
+ id?: string;
11431
+ payment_link_id?: string | null;
11432
+ user_id?: string;
11433
+ organization_id?: string;
11434
+ organization_consumer_id?: string;
11435
+ account_id?: string;
11436
+ branch_id?: string;
11437
+ org_invoice_number?: number;
11438
+ description?: string | null;
11439
+ total_amount?: string;
11440
+ original_amount?: string;
11441
+ item_level_discounted_amount?: string;
11442
+ total_vat_amount?: string | null;
11443
+ total_price_excluding_vat?: string | null;
11444
+ coupon_calculation_metadata?: {
11445
+ coupons?: {
11446
+ coupon_id?: string;
11447
+ name?: string;
11448
+ is_percentage?: boolean;
11449
+ discount_value?: string;
11450
+ currency?: string | null;
11451
+ order?: number;
11452
+ amount_before_discount?: string;
11453
+ discount_amount?: string;
11454
+ amount_after_discount?: string;
11455
+ }[];
11456
+ };
11457
+ currency: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11458
+ home_currency_amount?: string | null;
11459
+ home_currency_amount_actual?: string | null;
11460
+ exchange_rate_at_creation?: string | null;
11461
+ consumer_message?: string | null;
11462
+ status?: "CREATED" | "ACCEPTED" | "EXPIRED" | "CANCELED" | "DRAFT" | "SENT" | "REJECTED" | "COMPLETED";
11463
+ payment_method?: "OPENBANKING" | "PAYMENTGATEWAY";
11464
+ allowed_payment_flow?: "ALL" | "AUTO" | "MANUAL";
11465
+ current_payment_flow?: "ALL" | "AUTO" | "MANUAL";
11466
+ period_start?: string | null;
11467
+ period_end?: string | null;
11468
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
11469
+ recurring_interval_count?: number | null;
11470
+ type?: "RECURRING" | "ONE_OFF" | "ONE_OFF_FUTURE" | "INSTALLMENTS" | "PRORATION";
11471
+ readonly total_amount_in_smallest_unit?: number;
11472
+ readonly original_amount_in_smallest_unit?: number;
11473
+ };
11474
+ latest_freeze?: {
11475
+ created_at?: string;
11476
+ updated_at?: string | null;
11477
+ id?: string;
11478
+ freeze_start_datetime?: string;
11479
+ freeze_end_datetime?: string | null;
11480
+ notes?: string | null;
11481
+ subscription_id?: string;
11482
+ invoice_id?: string;
11483
+ duration?: number | null;
11484
+ };
11485
+ override_payment_methods?: {
11486
+ visa?: boolean | null;
11487
+ mastercard?: boolean | null;
11488
+ amex?: boolean | null;
11489
+ bank_transfer?: boolean | null;
11490
+ installment?: boolean | null;
11491
+ qurrah?: boolean | null;
11492
+ subscription_auto_renewal?: boolean | null;
11493
+ };
11494
+ pending_change?: {
11495
+ id?: string;
11496
+ effective_at?: string;
11497
+ invoice_was_reissued?: boolean;
11498
+ target_items?: {
11499
+ product_id?: string;
11500
+ product_name?: string;
11501
+ quantity?: number;
11502
+ original_amount?: string;
11503
+ discounted_amount?: string;
11504
+ }[];
11505
+ target_subscription_coupon_ids?: string[];
11506
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
11507
+ target_recurring_interval_count?: number;
11508
+ target_amount?: string;
11509
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11510
+ current_amount?: string;
11511
+ delta_amount?: string;
11512
+ delta_amount_per_month?: string | null;
11513
+ changes?: {
11514
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
11515
+ label?: string;
11516
+ product_id?: string | null;
11517
+ from_value?: string | null;
11518
+ to_value?: string | null;
11519
+ }[];
11520
+ next_invoice_preview?: {
11521
+ period_start?: string;
11522
+ period_end?: string;
11523
+ issue_at?: string;
11524
+ due_at?: string;
11525
+ subtotal?: string;
11526
+ discount_total?: string;
11527
+ total_amount?: string;
11528
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11529
+ };
11530
+ };
11531
+ readonly amount_in_smallest_unit?: number;
11532
+ readonly original_amount_in_smallest_unit?: number;
11533
+ };
11534
+ reused: boolean;
10563
11535
  }>;
10564
- changeSubscriptionPlan: better_auth.StrictEndpoint<"/subscription/change-plan", {
11536
+ updateSubscriptionSeats: better_auth.StrictEndpoint<"/subscription/update-seats", {
10565
11537
  method: "POST";
10566
11538
  body: zod.ZodObject<{
10567
11539
  subscriptionId: zod.ZodString;
10568
- plan: zod.ZodString;
11540
+ seats: zod.ZodNumber;
10569
11541
  }, zod_v4_core.$strict>;
10570
11542
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
10571
11543
  session: {
@@ -10593,7 +11565,7 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
10593
11565
  }, {
10594
11566
  mode: string;
10595
11567
  subscriptionId: string;
10596
- plan: string;
11568
+ seats: number;
10597
11569
  effectiveAt: string | null;
10598
11570
  pendingChange: {
10599
11571
  id?: string;
@@ -10631,12 +11603,19 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
10631
11603
  total_amount?: string;
10632
11604
  currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
10633
11605
  };
10634
- } | undefined;
11606
+ };
10635
11607
  reused: boolean;
10636
11608
  } | {
10637
11609
  mode: string;
10638
11610
  subscriptionId: string;
10639
- plan: string;
11611
+ seats: number;
11612
+ effectiveAt: null;
11613
+ pendingChange: null;
11614
+ reused: boolean;
11615
+ } | {
11616
+ mode: string;
11617
+ subscriptionId: string;
11618
+ seats: number;
10640
11619
  effectiveAt: string | null;
10641
11620
  pendingChange: {
10642
11621
  id?: string;
@@ -10924,6 +11903,256 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
10924
11903
  }>)[];
10925
11904
  }, {
10926
11905
  canceled: boolean;
11906
+ reused: boolean;
11907
+ subscription: {
11908
+ created_at?: string;
11909
+ updated_at?: string | null;
11910
+ id?: string;
11911
+ description?: string | null;
11912
+ amount?: string;
11913
+ original_amount?: string;
11914
+ item_level_discounted_amount?: string;
11915
+ coupon_calculation_metadata?: {
11916
+ coupons?: {
11917
+ coupon_id?: string;
11918
+ name?: string;
11919
+ is_percentage?: boolean;
11920
+ discount_value?: string;
11921
+ currency?: string | null;
11922
+ order?: number;
11923
+ amount_before_discount?: string;
11924
+ discount_amount?: string;
11925
+ amount_after_discount?: string;
11926
+ }[];
11927
+ };
11928
+ remaining_days?: number;
11929
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
11930
+ home_currency_amount?: string | null;
11931
+ exchange_rate_at_creation?: string | null;
11932
+ recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
11933
+ recurring_interval_count?: number;
11934
+ status?: "INACTIVE" | "ACTIVE" | "EXPIRED" | "CANCELED" | "FROZEN" | "TRIALING" | "TRIAL_PENDING";
11935
+ current_period_start?: string;
11936
+ current_period_end?: string;
11937
+ current_cycle_number?: number;
11938
+ cancel_at_period_end?: boolean;
11939
+ cancel_at_cycle_number?: number | null;
11940
+ started_at?: string | null;
11941
+ ended_at?: string | null;
11942
+ user_id?: string;
11943
+ organization_consumer_id?: string;
11944
+ latest_invoice_id?: string | null;
11945
+ trial_period_days?: number | null;
11946
+ trial_end?: string | null;
11947
+ organization_consumer?: {
11948
+ id?: string;
11949
+ name?: string;
11950
+ alias?: string | null;
11951
+ email?: string | null;
11952
+ phone_number?: string | null;
11953
+ preferred_language?: "AR" | "EN";
11954
+ consumer_type: "INDIVIDUAL" | "BUSINESS";
11955
+ address?: {
11956
+ address_line_1?: string;
11957
+ address_line_2?: string | null;
11958
+ city?: string;
11959
+ postal_code?: string | null;
11960
+ country?: string;
11961
+ };
11962
+ vat_number?: string | null;
11963
+ commercial_registration?: string | null;
11964
+ };
11965
+ items?: {
11966
+ created_at?: string;
11967
+ updated_at?: string | null;
11968
+ id?: string;
11969
+ product_id?: string;
11970
+ subscription_id?: string;
11971
+ quantity?: number;
11972
+ original_amount?: string;
11973
+ discounted_amount?: string;
11974
+ coupon_calculation_metadata?: {
11975
+ coupons?: {
11976
+ coupon_id?: string;
11977
+ name?: string;
11978
+ is_percentage?: boolean;
11979
+ discount_value?: string;
11980
+ currency?: string | null;
11981
+ order?: number;
11982
+ amount_before_discount?: string;
11983
+ discount_amount?: string;
11984
+ amount_after_discount?: string;
11985
+ }[];
11986
+ };
11987
+ product?: {
11988
+ created_at?: string;
11989
+ updated_at?: string | null;
11990
+ id?: string;
11991
+ name?: string;
11992
+ description?: string | null;
11993
+ type?: "RECURRING" | "ONE_OFF";
11994
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
11995
+ recurring_interval_count?: number;
11996
+ price?: string;
11997
+ currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VED" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "XSU" | "XUA" | "YER" | "ZAR" | "ZMW" | "ZWL";
11998
+ is_price_exempt_from_vat?: boolean;
11999
+ is_price_inclusive_of_vat?: boolean;
12000
+ price_excluding_vat?: string;
12001
+ vat_amount?: string;
12002
+ prices?: {
12003
+ id?: string;
12004
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
12005
+ amount?: string;
12006
+ is_active?: boolean;
12007
+ is_price_inclusive_of_vat?: boolean;
12008
+ is_price_exempt_from_vat?: boolean;
12009
+ price_excluding_vat?: string;
12010
+ vat_amount?: string;
12011
+ }[];
12012
+ is_active?: boolean;
12013
+ is_one_time?: boolean;
12014
+ is_used_in_finalized_invoice: boolean;
12015
+ };
12016
+ }[] | null;
12017
+ latest_invoice?: {
12018
+ created_at?: string;
12019
+ updated_at?: string | null;
12020
+ id?: string;
12021
+ payment_link_id?: string | null;
12022
+ user_id?: string;
12023
+ organization_id?: string;
12024
+ organization_consumer_id?: string;
12025
+ account_id?: string;
12026
+ branch_id?: string;
12027
+ org_invoice_number?: number;
12028
+ description?: string | null;
12029
+ total_amount?: string;
12030
+ original_amount?: string;
12031
+ item_level_discounted_amount?: string;
12032
+ total_vat_amount?: string | null;
12033
+ total_price_excluding_vat?: string | null;
12034
+ coupon_calculation_metadata?: {
12035
+ coupons?: {
12036
+ coupon_id?: string;
12037
+ name?: string;
12038
+ is_percentage?: boolean;
12039
+ discount_value?: string;
12040
+ currency?: string | null;
12041
+ order?: number;
12042
+ amount_before_discount?: string;
12043
+ discount_amount?: string;
12044
+ amount_after_discount?: string;
12045
+ }[];
12046
+ };
12047
+ currency: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
12048
+ home_currency_amount?: string | null;
12049
+ home_currency_amount_actual?: string | null;
12050
+ exchange_rate_at_creation?: string | null;
12051
+ consumer_message?: string | null;
12052
+ status?: "CREATED" | "ACCEPTED" | "EXPIRED" | "CANCELED" | "DRAFT" | "SENT" | "REJECTED" | "COMPLETED";
12053
+ payment_method?: "OPENBANKING" | "PAYMENTGATEWAY";
12054
+ allowed_payment_flow?: "ALL" | "AUTO" | "MANUAL";
12055
+ current_payment_flow?: "ALL" | "AUTO" | "MANUAL";
12056
+ period_start?: string | null;
12057
+ period_end?: string | null;
12058
+ recurring_interval?: "WEEK" | "MONTH" | "YEAR" | "SEMESTER";
12059
+ recurring_interval_count?: number | null;
12060
+ type?: "RECURRING" | "ONE_OFF" | "ONE_OFF_FUTURE" | "INSTALLMENTS" | "PRORATION";
12061
+ readonly total_amount_in_smallest_unit?: number;
12062
+ readonly original_amount_in_smallest_unit?: number;
12063
+ };
12064
+ latest_freeze?: {
12065
+ created_at?: string;
12066
+ updated_at?: string | null;
12067
+ id?: string;
12068
+ freeze_start_datetime?: string;
12069
+ freeze_end_datetime?: string | null;
12070
+ notes?: string | null;
12071
+ subscription_id?: string;
12072
+ invoice_id?: string;
12073
+ duration?: number | null;
12074
+ };
12075
+ override_payment_methods?: {
12076
+ visa?: boolean | null;
12077
+ mastercard?: boolean | null;
12078
+ amex?: boolean | null;
12079
+ bank_transfer?: boolean | null;
12080
+ installment?: boolean | null;
12081
+ qurrah?: boolean | null;
12082
+ subscription_auto_renewal?: boolean | null;
12083
+ };
12084
+ pending_change?: {
12085
+ id?: string;
12086
+ effective_at?: string;
12087
+ invoice_was_reissued?: boolean;
12088
+ target_items?: {
12089
+ product_id?: string;
12090
+ product_name?: string;
12091
+ quantity?: number;
12092
+ original_amount?: string;
12093
+ discounted_amount?: string;
12094
+ }[];
12095
+ target_subscription_coupon_ids?: string[];
12096
+ target_recurring_interval?: "WEEK" | "MONTH" | "QUARTER" | "YEAR";
12097
+ target_recurring_interval_count?: number;
12098
+ target_amount?: string;
12099
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
12100
+ current_amount?: string;
12101
+ delta_amount?: string;
12102
+ delta_amount_per_month?: string | null;
12103
+ changes?: {
12104
+ kind?: "PRODUCT_ADDED" | "PRODUCT_REMOVED" | "PRODUCT_REPLACED" | "QUANTITY_DECREASED" | "QUANTITY_INCREASED" | "COUPON_ADDED" | "COUPON_REMOVED" | "INTERVAL_CHANGED";
12105
+ label?: string;
12106
+ product_id?: string | null;
12107
+ from_value?: string | null;
12108
+ to_value?: string | null;
12109
+ }[];
12110
+ next_invoice_preview?: {
12111
+ period_start?: string;
12112
+ period_end?: string;
12113
+ issue_at?: string;
12114
+ due_at?: string;
12115
+ subtotal?: string;
12116
+ discount_total?: string;
12117
+ total_amount?: string;
12118
+ currency?: "SAR" | "USD" | "EUR" | "GBP" | "AED" | "BHD" | "KWD" | "OMR" | "QAR";
12119
+ };
12120
+ };
12121
+ readonly amount_in_smallest_unit?: number;
12122
+ readonly original_amount_in_smallest_unit?: number;
12123
+ };
12124
+ }>;
12125
+ cancelSubscriptionPendingChange: better_auth.StrictEndpoint<"/subscription/pending-change/cancel", {
12126
+ method: "POST";
12127
+ body: zod.ZodObject<{
12128
+ subscriptionId: zod.ZodString;
12129
+ }, zod_v4_core.$strip>;
12130
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
12131
+ session: {
12132
+ session: Record<string, any> & {
12133
+ id: string;
12134
+ createdAt: Date;
12135
+ updatedAt: Date;
12136
+ userId: string;
12137
+ expiresAt: Date;
12138
+ token: string;
12139
+ ipAddress?: string | null | undefined;
12140
+ userAgent?: string | null | undefined;
12141
+ };
12142
+ user: Record<string, any> & {
12143
+ id: string;
12144
+ createdAt: Date;
12145
+ updatedAt: Date;
12146
+ email: string;
12147
+ emailVerified: boolean;
12148
+ name: string;
12149
+ image?: string | null | undefined;
12150
+ };
12151
+ };
12152
+ }>)[];
12153
+ }, {
12154
+ canceled: boolean;
12155
+ reused: boolean;
10927
12156
  subscription: {
10928
12157
  created_at?: string;
10929
12158
  updated_at?: string | null;
@@ -11531,6 +12760,7 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
11531
12760
  };
11532
12761
  }>)[];
11533
12762
  }, {
12763
+ seats: number;
11534
12764
  plan: StreamPayPlanLike | null;
11535
12765
  id: string;
11536
12766
  referenceId: string;
@@ -11562,6 +12792,8 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
11562
12792
  pendingPlan: string | null;
11563
12793
  pendingProductId: string | null;
11564
12794
  pendingPlanEffectiveAt: Date | null;
12795
+ pendingSeats: number | null;
12796
+ pendingSeatsEffectiveAt: Date | null;
11565
12797
  endedAt: Date | null;
11566
12798
  frozenAt: Date | null;
11567
12799
  freezeEndAt: Date | null;
@@ -11605,6 +12837,7 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
11605
12837
  };
11606
12838
  }>)[];
11607
12839
  }, {
12840
+ seats: number;
11608
12841
  plan: StreamPayPlanLike | null;
11609
12842
  id: string;
11610
12843
  referenceId: string;
@@ -11636,6 +12869,8 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
11636
12869
  pendingPlan: string | null;
11637
12870
  pendingProductId: string | null;
11638
12871
  pendingPlanEffectiveAt: Date | null;
12872
+ pendingSeats: number | null;
12873
+ pendingSeatsEffectiveAt: Date | null;
11639
12874
  endedAt: Date | null;
11640
12875
  frozenAt: Date | null;
11641
12876
  freezeEndAt: Date | null;
@@ -11770,4 +13005,4 @@ declare const streampay: <O extends StreamPayOptions>(options: O) => {
11770
13005
  };
11771
13006
  };
11772
13007
 
11773
- export { $ERROR_CODES as $, type AdminOptions as A, type StreamPayHookContext as B, CheckoutBody as C, DEFAULT_ACCESS_STATUSES as D, type ErrorCodeEntry as E, type FeatureKey as F, type StreamPayInvoiceEventType as G, type StreamPayOptions as H, type StreamPayPaymentEventType as I, type StreamPayPaymentLinkEventType as J, type StreamPayPlan as K, type LimitCheckResult as L, type StreamPayPlanLike as M, type StreamPayPlugin as N, type StreamPayPluginRegistry as O, PLAN_NAME_METADATA_KEY as P, type StreamPayPlugins as Q, REFERENCE_ID_METADATA_KEY as R, type StreamPayErrorCode as S, type StreamPayProduct as T, type StreamPaySubscriptionEventType as U, type StreamPayWebhookData as V, type StreamPayWebhookEnvelope as W, type StreamPayWebhookPayload as X, type Subscription as Y, type SubscriptionBillingStatus as Z, type SubscriptionCallback as _, type StreamPayClient as a, type SubscriptionCallbackData as a0, type SubscriptionCallbacks as a1, type SubscriptionReferenceType as a2, type SubscriptionStatus as a3, type SubscriptionsOptions as a4, type SyncContext as a5, type TrialEligibilityContext as a6, type WebhookEnvelopeHandler as a7, type WebhookHandler as a8, type WebhookHandlers as a9, type WebhookSyncFailure as aa, type WebhooksOptions as ab, admin as ac, checkLimit as ad, checkout as ae, classifyWebhookFailure as af, dispatchWebhook as ag, hasFeature as ah, hasSubscriptionAccess as ai, isKnownStreamPayWebhookPayload as aj, isStreamPayWebhookEnvelope as ak, mapToErrorCode as al, portal as am, subscriptionSlotKey as an, subscriptions as ao, syncWebhookPayload as ap, webhooks as aq, type AuthorizeReferenceContext as b, type CheckoutCreatedContext as c, type CheckoutOptions as d, type CheckoutOverrides as e, type CheckoutParams as f, type CheckoutResolutionContext as g, type ClaimExistingConsumerBy as h, type ClaimExistingConsumerIdentifier as i, type ConsumerCreateOverrides as j, type PluginAdapter as k, type PortalOptions as l, REFERENCE_TYPE_METADATA_KEY as m, type ResolvedPlans as n, STREAMPAY_EVENT_TYPES as o, STREAMPAY_INVOICE_EVENT_TYPES as p, STREAMPAY_PAYMENT_EVENT_TYPES as q, STREAMPAY_PAYMENT_LINK_EVENT_TYPES as r, streampay as s, STREAMPAY_SUBSCRIPTION_EVENT_TYPES as t, SUBSCRIPTION_ROW_ID_METADATA_KEY as u, type StreamPayCustomFieldDefinition as v, type StreamPayCustomFieldsSchema as w, type StreamPayEndpoints as x, type StreamPayEntityType as y, type StreamPayEventType as z };
13008
+ export { $ERROR_CODES as $, type AdminOptions as A, type StreamPayHookContext as B, CheckoutBody as C, DEFAULT_ACCESS_STATUSES as D, type ErrorCodeEntry as E, type FeatureKey as F, type StreamPayInvoiceEventType as G, type StreamPayOptions as H, type StreamPayPaymentEventType as I, type StreamPayPaymentLinkEventType as J, type StreamPayPlan as K, type LimitCheckResult as L, type StreamPayPlanLike as M, type StreamPayPlugin as N, type StreamPayPluginRegistry as O, PLAN_NAME_METADATA_KEY as P, type StreamPayPlugins as Q, REFERENCE_ID_METADATA_KEY as R, type StreamPayErrorCode as S, type StreamPayProduct as T, type StreamPaySeatBilling as U, type StreamPaySubscriptionEventType as V, type StreamPayWebhookData as W, type StreamPayWebhookEnvelope as X, type StreamPayWebhookPayload as Y, type Subscription as Z, type SubscriptionBillingStatus as _, type StreamPayClient as a, type SubscriptionCallback as a0, type SubscriptionCallbackData as a1, type SubscriptionCallbacks as a2, type SubscriptionReferenceType as a3, type SubscriptionStatus as a4, type SubscriptionsOptions as a5, type SyncContext as a6, type TrialEligibilityContext as a7, type WebhookEnvelopeHandler as a8, type WebhookHandler as a9, type WebhookHandlers as aa, type WebhookSyncFailure as ab, type WebhooksOptions as ac, admin as ad, checkLimit as ae, checkout as af, classifyWebhookFailure as ag, dispatchWebhook as ah, hasFeature as ai, hasSubscriptionAccess as aj, isKnownStreamPayWebhookPayload as ak, isStreamPayWebhookEnvelope as al, mapToErrorCode as am, portal as an, subscriptionSlotKey as ao, subscriptions as ap, syncWebhookPayload as aq, webhooks as ar, type AuthorizeReferenceContext as b, type CheckoutCreatedContext as c, type CheckoutOptions as d, type CheckoutOverrides as e, type CheckoutParams as f, type CheckoutResolutionContext as g, type ClaimExistingConsumerBy as h, type ClaimExistingConsumerIdentifier as i, type ConsumerCreateOverrides as j, type PluginAdapter as k, type PortalOptions as l, REFERENCE_TYPE_METADATA_KEY as m, type ResolvedPlans as n, STREAMPAY_EVENT_TYPES as o, STREAMPAY_INVOICE_EVENT_TYPES as p, STREAMPAY_PAYMENT_EVENT_TYPES as q, STREAMPAY_PAYMENT_LINK_EVENT_TYPES as r, streampay as s, STREAMPAY_SUBSCRIPTION_EVENT_TYPES as t, SUBSCRIPTION_ROW_ID_METADATA_KEY as u, type StreamPayCustomFieldDefinition as v, type StreamPayCustomFieldsSchema as w, type StreamPayEndpoints as x, type StreamPayEntityType as y, type StreamPayEventType as z };