dodopayments 2.45.1 → 2.47.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +4 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/brands.d.mts +59 -2
  10. package/resources/brands.d.mts.map +1 -1
  11. package/resources/brands.d.ts +59 -2
  12. package/resources/brands.d.ts.map +1 -1
  13. package/resources/brands.js +16 -2
  14. package/resources/brands.js.map +1 -1
  15. package/resources/brands.mjs +16 -2
  16. package/resources/brands.mjs.map +1 -1
  17. package/resources/checkout-sessions.d.mts +8 -0
  18. package/resources/checkout-sessions.d.mts.map +1 -1
  19. package/resources/checkout-sessions.d.ts +8 -0
  20. package/resources/checkout-sessions.d.ts.map +1 -1
  21. package/resources/index.d.mts +2 -2
  22. package/resources/index.d.mts.map +1 -1
  23. package/resources/index.d.ts +2 -2
  24. package/resources/index.d.ts.map +1 -1
  25. package/resources/index.js.map +1 -1
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/subscriptions.d.mts +17 -2
  28. package/resources/subscriptions.d.mts.map +1 -1
  29. package/resources/subscriptions.d.ts +17 -2
  30. package/resources/subscriptions.d.ts.map +1 -1
  31. package/resources/webhook-events.d.mts +1 -1
  32. package/resources/webhook-events.d.mts.map +1 -1
  33. package/resources/webhook-events.d.ts +1 -1
  34. package/resources/webhook-events.d.ts.map +1 -1
  35. package/resources/webhooks/index.d.mts +1 -1
  36. package/resources/webhooks/index.d.mts.map +1 -1
  37. package/resources/webhooks/index.d.ts +1 -1
  38. package/resources/webhooks/index.d.ts.map +1 -1
  39. package/resources/webhooks/index.js.map +1 -1
  40. package/resources/webhooks/index.mjs.map +1 -1
  41. package/resources/webhooks/webhooks.d.mts +75 -3
  42. package/resources/webhooks/webhooks.d.mts.map +1 -1
  43. package/resources/webhooks/webhooks.d.ts +75 -3
  44. package/resources/webhooks/webhooks.d.ts.map +1 -1
  45. package/resources/webhooks/webhooks.js.map +1 -1
  46. package/resources/webhooks/webhooks.mjs.map +1 -1
  47. package/src/client.ts +10 -0
  48. package/src/resources/brands.ts +77 -2
  49. package/src/resources/checkout-sessions.ts +9 -0
  50. package/src/resources/index.ts +5 -0
  51. package/src/resources/subscriptions.ts +27 -2
  52. package/src/resources/webhook-events.ts +1 -0
  53. package/src/resources/webhooks/index.ts +2 -0
  54. package/src/resources/webhooks/webhooks.ts +94 -0
  55. package/src/version.ts +1 -1
  56. package/version.d.mts +1 -1
  57. package/version.d.ts +1 -1
  58. package/version.js +1 -1
  59. package/version.mjs +1 -1
@@ -12,8 +12,11 @@ export class Brands extends APIResource {
12
12
  * const brands = await client.brands.list();
13
13
  * ```
14
14
  */
15
- list(options?: RequestOptions): APIPromise<BrandListResponse> {
16
- return this._client.get('/brands', options);
15
+ list(
16
+ query: BrandListParams | null | undefined = {},
17
+ options?: RequestOptions,
18
+ ): APIPromise<BrandListResponse> {
19
+ return this._client.get('/brands', { query, ...options });
17
20
  }
18
21
 
19
22
  /**
@@ -63,6 +66,21 @@ export class Brands extends APIResource {
63
66
  updateImages(id: string, options?: RequestOptions): APIPromise<BrandUpdateImagesResponse> {
64
67
  return this._client.put(path`/brands/${id}/images`, options);
65
68
  }
69
+
70
+ /**
71
+ * Archive a brand. Its products, live subscriptions, and product collections move
72
+ * to the `move_products_to` brand. Archive is permanent.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const response = await client.brands.archive(
77
+ * 'brnd_8dFiAW42v28JzhlVSocjq',
78
+ * );
79
+ * ```
80
+ */
81
+ archive(id: string, body: BrandArchiveParams, options?: RequestOptions): APIPromise<BrandArchiveResponse> {
82
+ return this._client.post(path`/brands/${id}/archive`, { body, ...options });
83
+ }
66
84
  }
67
85
 
68
86
  export interface Brand {
@@ -78,6 +96,11 @@ export interface Brand {
78
96
 
79
97
  verification_status: 'Success' | 'Fail' | 'Review' | 'Hold';
80
98
 
99
+ /**
100
+ * Time the brand was archived. Null for an active brand.
101
+ */
102
+ archived_at?: string | null;
103
+
81
104
  description?: string | null;
82
105
 
83
106
  image?: string | null;
@@ -101,6 +124,38 @@ export interface BrandListResponse {
101
124
  items: Array<Brand>;
102
125
  }
103
126
 
127
+ export interface BrandArchiveResponse {
128
+ /**
129
+ * Time the brand was archived.
130
+ */
131
+ archived_at: string;
132
+
133
+ /**
134
+ * The archived brand.
135
+ */
136
+ brand_id: string;
137
+
138
+ /**
139
+ * Count of product collections moved to the target brand.
140
+ */
141
+ collections_moved: number;
142
+
143
+ /**
144
+ * Count of products moved to the target brand.
145
+ */
146
+ products_moved: number;
147
+
148
+ /**
149
+ * Count of live subscriptions moved to the target brand.
150
+ */
151
+ subscriptions_moved: number;
152
+
153
+ /**
154
+ * Brand that received the moved records. Null when no target was given.
155
+ */
156
+ moved_to_brand_id?: string | null;
157
+ }
158
+
104
159
  export interface BrandUpdateImagesResponse {
105
160
  /**
106
161
  * UUID that will be used as the image identifier/key suffix
@@ -113,6 +168,13 @@ export interface BrandUpdateImagesResponse {
113
168
  url: string;
114
169
  }
115
170
 
171
+ export interface BrandListParams {
172
+ /**
173
+ * Set to true to also list archived brands. Default false.
174
+ */
175
+ include_archived?: boolean;
176
+ }
177
+
116
178
  export interface BrandCreateParams {
117
179
  description?: string | null;
118
180
 
@@ -142,12 +204,25 @@ export interface BrandUpdateParams {
142
204
  url?: string | null;
143
205
  }
144
206
 
207
+ export interface BrandArchiveParams {
208
+ /**
209
+ * Brand that takes over the products and the live subscriptions of the brand you
210
+ * archive. It must be a brand of the same business, and it must not be archived.
211
+ * The primary brand (its brand id is the business id) is a valid target. Omit this
212
+ * field only when the brand holds no products and no live subscriptions.
213
+ */
214
+ move_products_to?: string | null;
215
+ }
216
+
145
217
  export declare namespace Brands {
146
218
  export {
147
219
  type Brand as Brand,
148
220
  type BrandListResponse as BrandListResponse,
221
+ type BrandArchiveResponse as BrandArchiveResponse,
149
222
  type BrandUpdateImagesResponse as BrandUpdateImagesResponse,
223
+ type BrandListParams as BrandListParams,
150
224
  type BrandCreateParams as BrandCreateParams,
151
225
  type BrandUpdateParams as BrandUpdateParams,
226
+ type BrandArchiveParams as BrandArchiveParams,
152
227
  };
153
228
  }
@@ -199,6 +199,15 @@ export interface CheckoutSessionFlags {
199
199
  * Default is false
200
200
  */
201
201
  require_phone_number?: boolean;
202
+
203
+ /**
204
+ * If true, the session uses the single-page checkout flow: the page initializes
205
+ * the payment at load time and confirms it in place, with no separate payment
206
+ * page.
207
+ *
208
+ * Default is false
209
+ */
210
+ single_page?: boolean;
202
211
  }
203
212
 
204
213
  export interface CheckoutSessionRequest {
@@ -19,9 +19,12 @@ export {
19
19
  Brands,
20
20
  type Brand,
21
21
  type BrandListResponse,
22
+ type BrandArchiveResponse,
22
23
  type BrandUpdateImagesResponse,
24
+ type BrandListParams,
23
25
  type BrandCreateParams,
24
26
  type BrandUpdateParams,
27
+ type BrandArchiveParams,
25
28
  } from './brands';
26
29
  export {
27
30
  CheckoutSessions,
@@ -298,8 +301,10 @@ export {
298
301
  type SubscriptionExpiredWebhookEvent,
299
302
  type SubscriptionFailedWebhookEvent,
300
303
  type SubscriptionOnHoldWebhookEvent,
304
+ type SubscriptionPausedWebhookEvent,
301
305
  type SubscriptionPlanChangedWebhookEvent,
302
306
  type SubscriptionRenewedWebhookEvent,
307
+ type SubscriptionUnpausedWebhookEvent,
303
308
  type SubscriptionUpdatePaymentMethodWebhookEvent,
304
309
  type SubscriptionUpdatedWebhookEvent,
305
310
  type UnsafeUnwrapWebhookEvent,
@@ -663,6 +663,12 @@ export interface Subscription {
663
663
  */
664
664
  expires_at?: string | null;
665
665
 
666
+ /**
667
+ * Timestamp when the subscription was paused, if it currently is (or is `OnHold`
668
+ * due to an unresolved pause settlement). `null` otherwise.
669
+ */
670
+ paused_at?: string | null;
671
+
666
672
  /**
667
673
  * Saved payment method id used for recurring charges
668
674
  */
@@ -686,7 +692,14 @@ export interface Subscription {
686
692
  trial_amount?: number | null;
687
693
  }
688
694
 
689
- export type SubscriptionStatus = 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';
695
+ export type SubscriptionStatus =
696
+ | 'pending'
697
+ | 'active'
698
+ | 'on_hold'
699
+ | 'paused'
700
+ | 'cancelled'
701
+ | 'failed'
702
+ | 'expired';
690
703
 
691
704
  /**
692
705
  * Unit of a duration count (e.g. license-key validity period).
@@ -974,6 +987,12 @@ export interface SubscriptionListResponse {
974
987
  */
975
988
  discount_id?: string | null;
976
989
 
990
+ /**
991
+ * Timestamp when the subscription was paused, if it currently is (or is `OnHold`
992
+ * due to an unresolved pause settlement). `null` otherwise.
993
+ */
994
+ paused_at?: string | null;
995
+
977
996
  /**
978
997
  * Saved payment method id used for recurring charges
979
998
  */
@@ -1320,7 +1339,7 @@ export interface SubscriptionListParams extends DefaultPageNumberPaginationParam
1320
1339
  /**
1321
1340
  * Filter by status
1322
1341
  */
1323
- status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';
1342
+ status?: 'pending' | 'active' | 'on_hold' | 'paused' | 'cancelled' | 'failed' | 'expired';
1324
1343
  }
1325
1344
 
1326
1345
  export interface SubscriptionCreateParams {
@@ -1515,6 +1534,12 @@ export interface SubscriptionUpdateParams {
1515
1534
 
1516
1535
  next_billing_date?: string | null;
1517
1536
 
1537
+ /**
1538
+ * `Some(true)` pauses an active subscription; `Some(false)` unpauses a `Paused`
1539
+ * (or abandoned `OnHold`) subscription. Exclusive of every other field.
1540
+ */
1541
+ pause?: boolean | null;
1542
+
1518
1543
  status?: SubscriptionStatus | null;
1519
1544
 
1520
1545
  /**
@@ -33,6 +33,7 @@ export type WebhookEventType =
33
33
  | 'subscription.renewed'
34
34
  | 'subscription.on_hold'
35
35
  | 'subscription.paused'
36
+ | 'subscription.unpaused'
36
37
  | 'subscription.cancelled'
37
38
  | 'subscription.failed'
38
39
  | 'subscription.expired'
@@ -46,8 +46,10 @@ export {
46
46
  type SubscriptionExpiredWebhookEvent,
47
47
  type SubscriptionFailedWebhookEvent,
48
48
  type SubscriptionOnHoldWebhookEvent,
49
+ type SubscriptionPausedWebhookEvent,
49
50
  type SubscriptionPlanChangedWebhookEvent,
50
51
  type SubscriptionRenewedWebhookEvent,
52
+ type SubscriptionUnpausedWebhookEvent,
51
53
  type SubscriptionUpdatePaymentMethodWebhookEvent,
52
54
  type SubscriptionUpdatedWebhookEvent,
53
55
  type UnsafeUnwrapWebhookEvent,
@@ -1573,6 +1573,28 @@ export interface SubscriptionOnHoldWebhookEvent {
1573
1573
  type: 'subscription.on_hold';
1574
1574
  }
1575
1575
 
1576
+ export interface SubscriptionPausedWebhookEvent {
1577
+ /**
1578
+ * The business identifier
1579
+ */
1580
+ business_id: string;
1581
+
1582
+ /**
1583
+ * Response struct representing subscription details
1584
+ */
1585
+ data: SubscriptionsAPI.Subscription;
1586
+
1587
+ /**
1588
+ * The timestamp of when the event occurred
1589
+ */
1590
+ timestamp: string;
1591
+
1592
+ /**
1593
+ * The event type
1594
+ */
1595
+ type: 'subscription.paused';
1596
+ }
1597
+
1576
1598
  export interface SubscriptionPlanChangedWebhookEvent {
1577
1599
  /**
1578
1600
  * The business identifier
@@ -1617,6 +1639,28 @@ export interface SubscriptionRenewedWebhookEvent {
1617
1639
  type: 'subscription.renewed';
1618
1640
  }
1619
1641
 
1642
+ export interface SubscriptionUnpausedWebhookEvent {
1643
+ /**
1644
+ * The business identifier
1645
+ */
1646
+ business_id: string;
1647
+
1648
+ /**
1649
+ * Response struct representing subscription details
1650
+ */
1651
+ data: SubscriptionsAPI.Subscription;
1652
+
1653
+ /**
1654
+ * The timestamp of when the event occurred
1655
+ */
1656
+ timestamp: string;
1657
+
1658
+ /**
1659
+ * The event type
1660
+ */
1661
+ type: 'subscription.unpaused';
1662
+ }
1663
+
1620
1664
  export interface SubscriptionUpdatePaymentMethodWebhookEvent {
1621
1665
  /**
1622
1666
  * The business identifier
@@ -3048,6 +3092,28 @@ export interface SubscriptionOnHoldWebhookEvent {
3048
3092
  type: 'subscription.on_hold';
3049
3093
  }
3050
3094
 
3095
+ export interface SubscriptionPausedWebhookEvent {
3096
+ /**
3097
+ * The business identifier
3098
+ */
3099
+ business_id: string;
3100
+
3101
+ /**
3102
+ * Response struct representing subscription details
3103
+ */
3104
+ data: SubscriptionsAPI.Subscription;
3105
+
3106
+ /**
3107
+ * The timestamp of when the event occurred
3108
+ */
3109
+ timestamp: string;
3110
+
3111
+ /**
3112
+ * The event type
3113
+ */
3114
+ type: 'subscription.paused';
3115
+ }
3116
+
3051
3117
  export interface SubscriptionPlanChangedWebhookEvent {
3052
3118
  /**
3053
3119
  * The business identifier
@@ -3092,6 +3158,28 @@ export interface SubscriptionRenewedWebhookEvent {
3092
3158
  type: 'subscription.renewed';
3093
3159
  }
3094
3160
 
3161
+ export interface SubscriptionUnpausedWebhookEvent {
3162
+ /**
3163
+ * The business identifier
3164
+ */
3165
+ business_id: string;
3166
+
3167
+ /**
3168
+ * Response struct representing subscription details
3169
+ */
3170
+ data: SubscriptionsAPI.Subscription;
3171
+
3172
+ /**
3173
+ * The timestamp of when the event occurred
3174
+ */
3175
+ timestamp: string;
3176
+
3177
+ /**
3178
+ * The event type
3179
+ */
3180
+ type: 'subscription.unpaused';
3181
+ }
3182
+
3095
3183
  export interface SubscriptionUpdatePaymentMethodWebhookEvent {
3096
3184
  /**
3097
3185
  * The business identifier
@@ -3178,8 +3266,10 @@ export type UnsafeUnwrapWebhookEvent =
3178
3266
  | SubscriptionExpiredWebhookEvent
3179
3267
  | SubscriptionFailedWebhookEvent
3180
3268
  | SubscriptionOnHoldWebhookEvent
3269
+ | SubscriptionPausedWebhookEvent
3181
3270
  | SubscriptionPlanChangedWebhookEvent
3182
3271
  | SubscriptionRenewedWebhookEvent
3272
+ | SubscriptionUnpausedWebhookEvent
3183
3273
  | SubscriptionUpdatePaymentMethodWebhookEvent
3184
3274
  | SubscriptionUpdatedWebhookEvent;
3185
3275
 
@@ -3225,8 +3315,10 @@ export type UnwrapWebhookEvent =
3225
3315
  | SubscriptionExpiredWebhookEvent
3226
3316
  | SubscriptionFailedWebhookEvent
3227
3317
  | SubscriptionOnHoldWebhookEvent
3318
+ | SubscriptionPausedWebhookEvent
3228
3319
  | SubscriptionPlanChangedWebhookEvent
3229
3320
  | SubscriptionRenewedWebhookEvent
3321
+ | SubscriptionUnpausedWebhookEvent
3230
3322
  | SubscriptionUpdatePaymentMethodWebhookEvent
3231
3323
  | SubscriptionUpdatedWebhookEvent;
3232
3324
 
@@ -3353,8 +3445,10 @@ export declare namespace Webhooks {
3353
3445
  type SubscriptionExpiredWebhookEvent as SubscriptionExpiredWebhookEvent,
3354
3446
  type SubscriptionFailedWebhookEvent as SubscriptionFailedWebhookEvent,
3355
3447
  type SubscriptionOnHoldWebhookEvent as SubscriptionOnHoldWebhookEvent,
3448
+ type SubscriptionPausedWebhookEvent as SubscriptionPausedWebhookEvent,
3356
3449
  type SubscriptionPlanChangedWebhookEvent as SubscriptionPlanChangedWebhookEvent,
3357
3450
  type SubscriptionRenewedWebhookEvent as SubscriptionRenewedWebhookEvent,
3451
+ type SubscriptionUnpausedWebhookEvent as SubscriptionUnpausedWebhookEvent,
3358
3452
  type SubscriptionUpdatePaymentMethodWebhookEvent as SubscriptionUpdatePaymentMethodWebhookEvent,
3359
3453
  type SubscriptionUpdatedWebhookEvent as SubscriptionUpdatedWebhookEvent,
3360
3454
  type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.45.1'; // x-release-please-version
1
+ export const VERSION = '2.47.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.45.1";
1
+ export declare const VERSION = "2.47.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.45.1";
1
+ export declare const VERSION = "2.47.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.45.1'; // x-release-please-version
4
+ exports.VERSION = '2.47.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.45.1'; // x-release-please-version
1
+ export const VERSION = '2.47.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map