dodopayments 2.48.0 → 2.49.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 (134) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/bin/migration-config.json +37 -0
  3. package/client.d.mts +7 -4
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +7 -4
  6. package/client.d.ts.map +1 -1
  7. package/client.js +3 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +3 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/balances.d.mts +1 -0
  13. package/resources/balances.d.mts.map +1 -1
  14. package/resources/balances.d.ts +1 -0
  15. package/resources/balances.d.ts.map +1 -1
  16. package/resources/blocklist/blocklist.d.mts +10 -0
  17. package/resources/blocklist/blocklist.d.mts.map +1 -0
  18. package/resources/blocklist/blocklist.d.ts +10 -0
  19. package/resources/blocklist/blocklist.d.ts.map +1 -0
  20. package/resources/blocklist/blocklist.js +17 -0
  21. package/resources/blocklist/blocklist.js.map +1 -0
  22. package/resources/blocklist/blocklist.mjs +12 -0
  23. package/resources/blocklist/blocklist.mjs.map +1 -0
  24. package/resources/blocklist/customers/customers.d.mts +161 -0
  25. package/resources/blocklist/customers/customers.d.mts.map +1 -0
  26. package/resources/blocklist/customers/customers.d.ts +161 -0
  27. package/resources/blocklist/customers/customers.d.ts.map +1 -0
  28. package/resources/blocklist/customers/customers.js +38 -0
  29. package/resources/blocklist/customers/customers.js.map +1 -0
  30. package/resources/blocklist/customers/customers.mjs +33 -0
  31. package/resources/blocklist/customers/customers.mjs.map +1 -0
  32. package/resources/blocklist/customers/index.d.mts +3 -0
  33. package/resources/blocklist/customers/index.d.mts.map +1 -0
  34. package/resources/blocklist/customers/index.d.ts +3 -0
  35. package/resources/blocklist/customers/index.d.ts.map +1 -0
  36. package/resources/blocklist/customers/index.js +9 -0
  37. package/resources/blocklist/customers/index.js.map +1 -0
  38. package/resources/blocklist/customers/index.mjs +4 -0
  39. package/resources/blocklist/customers/index.mjs.map +1 -0
  40. package/resources/blocklist/customers/notes.d.mts +34 -0
  41. package/resources/blocklist/customers/notes.d.mts.map +1 -0
  42. package/resources/blocklist/customers/notes.d.ts +34 -0
  43. package/resources/blocklist/customers/notes.d.ts.map +1 -0
  44. package/resources/blocklist/customers/notes.js +17 -0
  45. package/resources/blocklist/customers/notes.js.map +1 -0
  46. package/resources/blocklist/customers/notes.mjs +13 -0
  47. package/resources/blocklist/customers/notes.mjs.map +1 -0
  48. package/resources/blocklist/customers.d.mts +2 -0
  49. package/resources/blocklist/customers.d.mts.map +1 -0
  50. package/resources/blocklist/customers.d.ts +2 -0
  51. package/resources/blocklist/customers.d.ts.map +1 -0
  52. package/resources/blocklist/customers.js +6 -0
  53. package/resources/blocklist/customers.js.map +1 -0
  54. package/resources/blocklist/customers.mjs +3 -0
  55. package/resources/blocklist/customers.mjs.map +1 -0
  56. package/resources/blocklist/index.d.mts +3 -0
  57. package/resources/blocklist/index.d.mts.map +1 -0
  58. package/resources/blocklist/index.d.ts +3 -0
  59. package/resources/blocklist/index.d.ts.map +1 -0
  60. package/resources/blocklist/index.js +9 -0
  61. package/resources/blocklist/index.js.map +1 -0
  62. package/resources/blocklist/index.mjs +4 -0
  63. package/resources/blocklist/index.mjs.map +1 -0
  64. package/resources/blocklist.d.mts +2 -0
  65. package/resources/blocklist.d.mts.map +1 -0
  66. package/resources/blocklist.d.ts +2 -0
  67. package/resources/blocklist.d.ts.map +1 -0
  68. package/resources/blocklist.js +6 -0
  69. package/resources/blocklist.js.map +1 -0
  70. package/resources/blocklist.mjs +3 -0
  71. package/resources/blocklist.mjs.map +1 -0
  72. package/resources/customers/customers.d.mts +10 -0
  73. package/resources/customers/customers.d.mts.map +1 -1
  74. package/resources/customers/customers.d.ts +10 -0
  75. package/resources/customers/customers.d.ts.map +1 -1
  76. package/resources/customers/customers.js.map +1 -1
  77. package/resources/customers/customers.mjs.map +1 -1
  78. package/resources/index.d.mts +3 -2
  79. package/resources/index.d.mts.map +1 -1
  80. package/resources/index.d.ts +3 -2
  81. package/resources/index.d.ts.map +1 -1
  82. package/resources/index.js +3 -1
  83. package/resources/index.js.map +1 -1
  84. package/resources/index.mjs +1 -0
  85. package/resources/index.mjs.map +1 -1
  86. package/resources/payments.d.mts +64 -1
  87. package/resources/payments.d.mts.map +1 -1
  88. package/resources/payments.d.ts +64 -1
  89. package/resources/payments.d.ts.map +1 -1
  90. package/resources/payments.js +21 -0
  91. package/resources/payments.js.map +1 -1
  92. package/resources/payments.mjs +21 -0
  93. package/resources/payments.mjs.map +1 -1
  94. package/resources/subscriptions.d.mts +3 -3
  95. package/resources/subscriptions.d.mts.map +1 -1
  96. package/resources/subscriptions.d.ts +3 -3
  97. package/resources/subscriptions.d.ts.map +1 -1
  98. package/resources/webhook-events.d.mts +12 -2
  99. package/resources/webhook-events.d.mts.map +1 -1
  100. package/resources/webhook-events.d.ts +12 -2
  101. package/resources/webhook-events.d.ts.map +1 -1
  102. package/resources/webhooks/index.d.mts +1 -1
  103. package/resources/webhooks/index.d.mts.map +1 -1
  104. package/resources/webhooks/index.d.ts +1 -1
  105. package/resources/webhooks/index.d.ts.map +1 -1
  106. package/resources/webhooks/index.js.map +1 -1
  107. package/resources/webhooks/index.mjs.map +1 -1
  108. package/resources/webhooks/webhooks.d.mts +543 -51
  109. package/resources/webhooks/webhooks.d.mts.map +1 -1
  110. package/resources/webhooks/webhooks.d.ts +543 -51
  111. package/resources/webhooks/webhooks.d.ts.map +1 -1
  112. package/resources/webhooks/webhooks.js.map +1 -1
  113. package/resources/webhooks/webhooks.mjs.map +1 -1
  114. package/src/client.ts +11 -0
  115. package/src/resources/balances.ts +2 -0
  116. package/src/resources/blocklist/blocklist.ts +37 -0
  117. package/src/resources/blocklist/customers/customers.ts +254 -0
  118. package/src/resources/blocklist/customers/index.ts +21 -0
  119. package/src/resources/blocklist/customers/notes.ts +62 -0
  120. package/src/resources/blocklist/customers.ts +3 -0
  121. package/src/resources/blocklist/index.ts +15 -0
  122. package/src/resources/blocklist.ts +3 -0
  123. package/src/resources/customers/customers.ts +12 -0
  124. package/src/resources/index.ts +4 -0
  125. package/src/resources/payments.ts +84 -0
  126. package/src/resources/subscriptions.ts +4 -2
  127. package/src/resources/webhook-events.ts +13 -1
  128. package/src/resources/webhooks/index.ts +1 -0
  129. package/src/resources/webhooks/webhooks.ts +575 -48
  130. package/src/version.ts +1 -1
  131. package/version.d.mts +1 -1
  132. package/version.d.ts +1 -1
  133. package/version.js +1 -1
  134. package/version.mjs +1 -1
@@ -0,0 +1,15 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Blocklist } from './blocklist';
4
+ export {
5
+ Customers,
6
+ type BlockByCustomerID,
7
+ type BlockByEmail,
8
+ type BlockIdentifier,
9
+ type BlockedCustomer,
10
+ type BlockedCustomerSource,
11
+ type CreateBlockedCustomerRequest,
12
+ type CustomerListParams,
13
+ type CustomerCreateParams,
14
+ type BlockedCustomersDefaultPageNumberPagination,
15
+ } from './customers/index';
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './blocklist/index';
@@ -192,6 +192,18 @@ export interface Customer {
192
192
 
193
193
  name: string;
194
194
 
195
+ /**
196
+ * When the merchant blocked this customer. The dashboard shows the "Blocked" badge
197
+ * and the unblock action from it. The list route leaves it empty; only the
198
+ * single-customer route resolves it.
199
+ */
200
+ blocked_at?: string | null;
201
+
202
+ /**
203
+ * Blocklist entry behind `blocked_at`, so the dashboard can link to it.
204
+ */
205
+ blocklist_entry_id?: string | null;
206
+
195
207
  /**
196
208
  * Additional metadata for the customer
197
209
  */
@@ -15,6 +15,7 @@ export {
15
15
  type BalanceRetrieveLedgerParams,
16
16
  type BalanceLedgerEntriesDefaultPageNumberPagination,
17
17
  } from './balances';
18
+ export { Blocklist } from './blocklist/blocklist';
18
19
  export {
19
20
  Brands,
20
21
  type Brand,
@@ -154,6 +155,8 @@ export {
154
155
  type CustomerLimitedDetails,
155
156
  type CustomerRequest,
156
157
  type IntentStatus,
158
+ type ManualRetry,
159
+ type ManualRetryState,
157
160
  type NewCustomer,
158
161
  type OneTimeProductCartItem,
159
162
  type Payment,
@@ -302,6 +305,7 @@ export {
302
305
  type SubscriptionExpiredWebhookEvent,
303
306
  type SubscriptionFailedWebhookEvent,
304
307
  type SubscriptionOnHoldWebhookEvent,
308
+ type SubscriptionPastDueWebhookEvent,
305
309
  type SubscriptionPausedWebhookEvent,
306
310
  type SubscriptionPlanChangedWebhookEvent,
307
311
  type SubscriptionRenewedWebhookEvent,
@@ -67,6 +67,29 @@ export class Payments extends APIResource {
67
67
  ): APIPromise<PaymentRetrieveLineItemsResponse> {
68
68
  return this._client.get(path`/payments/${paymentID}/line-items`, options);
69
69
  }
70
+
71
+ /**
72
+ * @example
73
+ * ```ts
74
+ * const manualRetry = await client.payments.retry(
75
+ * 'payment_id',
76
+ * );
77
+ * ```
78
+ */
79
+ retry(paymentID: string, options?: RequestOptions): APIPromise<ManualRetry> {
80
+ return this._client.post(path`/payments/${paymentID}/retry`, options);
81
+ }
82
+
83
+ /**
84
+ * @example
85
+ * ```ts
86
+ * const manualRetryState =
87
+ * await client.payments.retrieveRetryState('payment_id');
88
+ * ```
89
+ */
90
+ retrieveRetryState(paymentID: string, options?: RequestOptions): APIPromise<ManualRetryState> {
91
+ return this._client.get(path`/payments/${paymentID}/retry`, options);
92
+ }
70
93
  }
71
94
 
72
95
  export type PaymentListResponsesDefaultPageNumberPagination =
@@ -177,6 +200,65 @@ export type IntentStatus =
177
200
  | 'partially_captured'
178
201
  | 'partially_captured_and_capturable';
179
202
 
203
+ export interface ManualRetry {
204
+ /**
205
+ * The invoice the send charged.
206
+ */
207
+ invoice_id: string;
208
+
209
+ /**
210
+ * Always true on this route. Tells the row apart from an automatic attempt.
211
+ */
212
+ is_manual_retry: boolean;
213
+
214
+ /**
215
+ * The payment row this send created.
216
+ */
217
+ payment_id: string;
218
+
219
+ /**
220
+ * Which attempt this send is, counting manual sends on the invoice.
221
+ */
222
+ retry_attempt: number;
223
+
224
+ sends_allowed: number;
225
+
226
+ /**
227
+ * Manual sends spent on this invoice, including this one.
228
+ */
229
+ sends_used: number;
230
+
231
+ /**
232
+ * When the next send becomes available. Null when no send is left.
233
+ */
234
+ retry_available_at?: string | null;
235
+
236
+ /**
237
+ * Outcome of the charge. `processing` means the processor has not settled it yet,
238
+ * and the payment webhooks report the result.
239
+ */
240
+ status?: IntentStatus | null;
241
+ }
242
+
243
+ export interface ManualRetryState {
244
+ can_retry: boolean;
245
+
246
+ sends_allowed: number;
247
+
248
+ sends_used: number;
249
+
250
+ /**
251
+ * The code `POST` would fail with. Null when `can_retry` is true.
252
+ */
253
+ reason?: string | null;
254
+
255
+ /**
256
+ * When the next send becomes available. Null when no send is left, or when the
257
+ * block has nothing to do with the cooldown.
258
+ */
259
+ retry_available_at?: string | null;
260
+ }
261
+
180
262
  export interface NewCustomer {
181
263
  /**
182
264
  * Email is required for creating a new customer
@@ -1065,6 +1147,8 @@ export declare namespace Payments {
1065
1147
  type CustomerLimitedDetails as CustomerLimitedDetails,
1066
1148
  type CustomerRequest as CustomerRequest,
1067
1149
  type IntentStatus as IntentStatus,
1150
+ type ManualRetry as ManualRetry,
1151
+ type ManualRetryState as ManualRetryState,
1068
1152
  type NewCustomer as NewCustomer,
1069
1153
  type OneTimeProductCartItem as OneTimeProductCartItem,
1070
1154
  type Payment as Payment,
@@ -695,7 +695,8 @@ export type SubscriptionStatus =
695
695
  | 'paused'
696
696
  | 'cancelled'
697
697
  | 'failed'
698
- | 'expired';
698
+ | 'expired'
699
+ | 'past_due';
699
700
 
700
701
  /**
701
702
  * Unit of a duration count (e.g. license-key validity period).
@@ -1392,7 +1393,7 @@ export interface SubscriptionListParams extends DefaultPageNumberPaginationParam
1392
1393
  /**
1393
1394
  * Filter by status
1394
1395
  */
1395
- status?: 'pending' | 'active' | 'on_hold' | 'paused' | 'cancelled' | 'failed' | 'expired';
1396
+ status?: 'pending' | 'active' | 'on_hold' | 'paused' | 'cancelled' | 'failed' | 'expired' | 'past_due';
1396
1397
  }
1397
1398
 
1398
1399
  export interface SubscriptionCreateParams {
@@ -1548,6 +1549,7 @@ export interface SubscriptionUpdateParams {
1548
1549
  | 'cancelled_by_customer'
1549
1550
  | 'cancelled_by_merchant'
1550
1551
  | 'cancelled_by_merchant_send_dunning'
1552
+ | 'cancelled_by_merchant_grace_period_expired'
1551
1553
  | 'dodo_team'
1552
1554
  | null;
1553
1555
 
@@ -32,6 +32,7 @@ export type WebhookEventType =
32
32
  | 'subscription.active'
33
33
  | 'subscription.renewed'
34
34
  | 'subscription.on_hold'
35
+ | 'subscription.past_due'
35
36
  | 'subscription.paused'
36
37
  | 'subscription.unpaused'
37
38
  | 'subscription.cancelled'
@@ -105,6 +106,17 @@ export namespace WebhookPayload {
105
106
  */
106
107
  export interface Subscription extends SubscriptionsAPI.Subscription {
107
108
  payload_type: 'Subscription';
109
+
110
+ /**
111
+ * Time when the grace period ends. The subscription moves to `on_hold` or to
112
+ * `cancelled` at this time.
113
+ *
114
+ * Read in the same query as the rest of the payload, so it always comes from the
115
+ * row snapshot that produced `status`. It is set whenever the subscription sits in
116
+ * a window at that moment. A delayed event of another type therefore carries the
117
+ * deadline too, next to a `past_due` status.
118
+ */
119
+ past_due_ends_at?: string | null;
108
120
  }
109
121
 
110
122
  export interface Refund extends RefundsAPI.Refund {
@@ -270,7 +282,7 @@ export namespace WebhookPayload {
270
282
 
271
283
  subscription_id: string;
272
284
 
273
- trigger_state: 'on_hold' | 'cancelled';
285
+ trigger_state: 'on_hold' | 'cancelled' | 'past_due';
274
286
 
275
287
  payment_id?: string | null;
276
288
  }
@@ -46,6 +46,7 @@ export {
46
46
  type SubscriptionExpiredWebhookEvent,
47
47
  type SubscriptionFailedWebhookEvent,
48
48
  type SubscriptionOnHoldWebhookEvent,
49
+ type SubscriptionPastDueWebhookEvent,
49
50
  type SubscriptionPausedWebhookEvent,
50
51
  type SubscriptionPlanChangedWebhookEvent,
51
52
  type SubscriptionRenewedWebhookEvent,