dodopayments 2.48.0 → 2.50.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 (177) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/bin/migration-config.json +70 -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 +3 -2
  13. package/resources/balances.d.mts.map +1 -1
  14. package/resources/balances.d.ts +3 -2
  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/checkout-sessions.d.mts +5 -0
  73. package/resources/checkout-sessions.d.mts.map +1 -1
  74. package/resources/checkout-sessions.d.ts +5 -0
  75. package/resources/checkout-sessions.d.ts.map +1 -1
  76. package/resources/credit-entitlements/balances.d.mts +7 -4
  77. package/resources/credit-entitlements/balances.d.mts.map +1 -1
  78. package/resources/credit-entitlements/balances.d.ts +7 -4
  79. package/resources/credit-entitlements/balances.d.ts.map +1 -1
  80. package/resources/credit-entitlements/balances.js +1 -0
  81. package/resources/credit-entitlements/balances.js.map +1 -1
  82. package/resources/credit-entitlements/balances.mjs +1 -0
  83. package/resources/credit-entitlements/balances.mjs.map +1 -1
  84. package/resources/customers/customers.d.mts +14 -0
  85. package/resources/customers/customers.d.mts.map +1 -1
  86. package/resources/customers/customers.d.ts +14 -0
  87. package/resources/customers/customers.d.ts.map +1 -1
  88. package/resources/customers/customers.js +4 -0
  89. package/resources/customers/customers.js.map +1 -1
  90. package/resources/customers/customers.mjs +4 -0
  91. package/resources/customers/customers.mjs.map +1 -1
  92. package/resources/customers/emails.d.mts +169 -0
  93. package/resources/customers/emails.d.mts.map +1 -0
  94. package/resources/customers/emails.d.ts +169 -0
  95. package/resources/customers/emails.d.ts.map +1 -0
  96. package/resources/customers/emails.js +48 -0
  97. package/resources/customers/emails.js.map +1 -0
  98. package/resources/customers/emails.mjs +44 -0
  99. package/resources/customers/emails.mjs.map +1 -0
  100. package/resources/customers/index.d.mts +1 -0
  101. package/resources/customers/index.d.mts.map +1 -1
  102. package/resources/customers/index.d.ts +1 -0
  103. package/resources/customers/index.d.ts.map +1 -1
  104. package/resources/customers/index.js +3 -1
  105. package/resources/customers/index.js.map +1 -1
  106. package/resources/customers/index.mjs +1 -0
  107. package/resources/customers/index.mjs.map +1 -1
  108. package/resources/index.d.mts +3 -2
  109. package/resources/index.d.mts.map +1 -1
  110. package/resources/index.d.ts +3 -2
  111. package/resources/index.d.ts.map +1 -1
  112. package/resources/index.js +3 -1
  113. package/resources/index.js.map +1 -1
  114. package/resources/index.mjs +1 -0
  115. package/resources/index.mjs.map +1 -1
  116. package/resources/payments.d.mts +64 -1
  117. package/resources/payments.d.mts.map +1 -1
  118. package/resources/payments.d.ts +64 -1
  119. package/resources/payments.d.ts.map +1 -1
  120. package/resources/payments.js +21 -0
  121. package/resources/payments.js.map +1 -1
  122. package/resources/payments.mjs +21 -0
  123. package/resources/payments.mjs.map +1 -1
  124. package/resources/products/products.d.mts +54 -13
  125. package/resources/products/products.d.mts.map +1 -1
  126. package/resources/products/products.d.ts +54 -13
  127. package/resources/products/products.d.ts.map +1 -1
  128. package/resources/products/products.js +0 -1
  129. package/resources/products/products.js.map +1 -1
  130. package/resources/products/products.mjs +0 -1
  131. package/resources/products/products.mjs.map +1 -1
  132. package/resources/subscriptions.d.mts +18 -3
  133. package/resources/subscriptions.d.mts.map +1 -1
  134. package/resources/subscriptions.d.ts +18 -3
  135. package/resources/subscriptions.d.ts.map +1 -1
  136. package/resources/webhook-events.d.mts +12 -2
  137. package/resources/webhook-events.d.mts.map +1 -1
  138. package/resources/webhook-events.d.ts +12 -2
  139. package/resources/webhook-events.d.ts.map +1 -1
  140. package/resources/webhooks/index.d.mts +1 -1
  141. package/resources/webhooks/index.d.mts.map +1 -1
  142. package/resources/webhooks/index.d.ts +1 -1
  143. package/resources/webhooks/index.d.ts.map +1 -1
  144. package/resources/webhooks/index.js.map +1 -1
  145. package/resources/webhooks/index.mjs.map +1 -1
  146. package/resources/webhooks/webhooks.d.mts +543 -51
  147. package/resources/webhooks/webhooks.d.mts.map +1 -1
  148. package/resources/webhooks/webhooks.d.ts +543 -51
  149. package/resources/webhooks/webhooks.d.ts.map +1 -1
  150. package/resources/webhooks/webhooks.js.map +1 -1
  151. package/resources/webhooks/webhooks.mjs.map +1 -1
  152. package/src/client.ts +11 -0
  153. package/src/resources/balances.ts +8 -2
  154. package/src/resources/blocklist/blocklist.ts +37 -0
  155. package/src/resources/blocklist/customers/customers.ts +254 -0
  156. package/src/resources/blocklist/customers/index.ts +21 -0
  157. package/src/resources/blocklist/customers/notes.ts +62 -0
  158. package/src/resources/blocklist/customers.ts +3 -0
  159. package/src/resources/blocklist/index.ts +15 -0
  160. package/src/resources/blocklist.ts +3 -0
  161. package/src/resources/checkout-sessions.ts +6 -0
  162. package/src/resources/credit-entitlements/balances.ts +8 -4
  163. package/src/resources/customers/customers.ts +38 -0
  164. package/src/resources/customers/emails.ts +238 -0
  165. package/src/resources/customers/index.ts +11 -0
  166. package/src/resources/index.ts +4 -0
  167. package/src/resources/payments.ts +84 -0
  168. package/src/resources/products/products.ts +62 -16
  169. package/src/resources/subscriptions.ts +22 -2
  170. package/src/resources/webhook-events.ts +13 -1
  171. package/src/resources/webhooks/index.ts +1 -0
  172. package/src/resources/webhooks/webhooks.ts +575 -48
  173. package/src/version.ts +1 -1
  174. package/version.d.mts +1 -1
  175. package/version.d.ts +1 -1
  176. package/version.js +1 -1
  177. package/version.mjs +1 -1
@@ -526,6 +526,12 @@ export interface Subscription {
526
526
  */
527
527
  customer: PaymentsAPI.CustomerLimitedDetails;
528
528
 
529
+ /**
530
+ * Whether a payment method is on file. False while a card-optional subscription
531
+ * waits for the customer to add one.
532
+ */
533
+ has_payment_method: boolean;
534
+
529
535
  /**
530
536
  * Additional custom data associated with the subscription
531
537
  */
@@ -695,7 +701,8 @@ export type SubscriptionStatus =
695
701
  | 'paused'
696
702
  | 'cancelled'
697
703
  | 'failed'
698
- | 'expired';
704
+ | 'expired'
705
+ | 'past_due';
699
706
 
700
707
  /**
701
708
  * Unit of a duration count (e.g. license-key validity period).
@@ -822,6 +829,12 @@ export interface SubscriptionCreateResponse {
822
829
  */
823
830
  payment_id: string;
824
831
 
832
+ /**
833
+ * False when the customer can start this subscription with no card. True for every
834
+ * other subscription.
835
+ */
836
+ payment_method_required: boolean;
837
+
825
838
  /**
826
839
  * Tax will be added to the amount and charged to the customer on each billing
827
840
  * cycle
@@ -913,6 +926,12 @@ export interface SubscriptionListResponse {
913
926
  */
914
927
  discounts: Array<SubscriptionListResponse.Discount>;
915
928
 
929
+ /**
930
+ * Whether a payment method is on file. False while a card-optional subscription
931
+ * waits for the customer to add one.
932
+ */
933
+ has_payment_method: boolean;
934
+
916
935
  /**
917
936
  * Additional custom data associated with the subscription
918
937
  */
@@ -1392,7 +1411,7 @@ export interface SubscriptionListParams extends DefaultPageNumberPaginationParam
1392
1411
  /**
1393
1412
  * Filter by status
1394
1413
  */
1395
- status?: 'pending' | 'active' | 'on_hold' | 'paused' | 'cancelled' | 'failed' | 'expired';
1414
+ status?: 'pending' | 'active' | 'on_hold' | 'paused' | 'cancelled' | 'failed' | 'expired' | 'past_due';
1396
1415
  }
1397
1416
 
1398
1417
  export interface SubscriptionCreateParams {
@@ -1548,6 +1567,7 @@ export interface SubscriptionUpdateParams {
1548
1567
  | 'cancelled_by_customer'
1549
1568
  | 'cancelled_by_merchant'
1550
1569
  | 'cancelled_by_merchant_send_dunning'
1570
+ | 'cancelled_by_merchant_grace_period_expired'
1551
1571
  | 'dodo_team'
1552
1572
  | null;
1553
1573
 
@@ -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,