dodopayments 2.51.0 → 2.53.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 (83) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +4 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/balances.d.mts +2 -2
  12. package/resources/balances.d.mts.map +1 -1
  13. package/resources/balances.d.ts +2 -2
  14. package/resources/balances.d.ts.map +1 -1
  15. package/resources/checkout-sessions.d.mts +107 -9
  16. package/resources/checkout-sessions.d.mts.map +1 -1
  17. package/resources/checkout-sessions.d.ts +107 -9
  18. package/resources/checkout-sessions.d.ts.map +1 -1
  19. package/resources/customers/emails.d.mts +7 -4
  20. package/resources/customers/emails.d.mts.map +1 -1
  21. package/resources/customers/emails.d.ts +7 -4
  22. package/resources/customers/emails.d.ts.map +1 -1
  23. package/resources/discounts.d.mts +13 -9
  24. package/resources/discounts.d.mts.map +1 -1
  25. package/resources/discounts.d.ts +13 -9
  26. package/resources/discounts.d.ts.map +1 -1
  27. package/resources/index.d.mts +3 -2
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +3 -2
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +3 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +1 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/moderation.d.mts +299 -0
  36. package/resources/moderation.d.mts.map +1 -0
  37. package/resources/moderation.d.ts +299 -0
  38. package/resources/moderation.d.ts.map +1 -0
  39. package/resources/moderation.js +41 -0
  40. package/resources/moderation.js.map +1 -0
  41. package/resources/moderation.mjs +37 -0
  42. package/resources/moderation.mjs.map +1 -0
  43. package/resources/payments.d.mts +37 -1
  44. package/resources/payments.d.mts.map +1 -1
  45. package/resources/payments.d.ts +37 -1
  46. package/resources/payments.d.ts.map +1 -1
  47. package/resources/payouts/breakup/breakup.d.mts +17 -1
  48. package/resources/payouts/breakup/breakup.d.mts.map +1 -1
  49. package/resources/payouts/breakup/breakup.d.ts +17 -1
  50. package/resources/payouts/breakup/breakup.d.ts.map +1 -1
  51. package/resources/payouts/breakup/breakup.js.map +1 -1
  52. package/resources/payouts/breakup/breakup.mjs.map +1 -1
  53. package/resources/payouts/breakup/details.d.mts +9 -8
  54. package/resources/payouts/breakup/details.d.mts.map +1 -1
  55. package/resources/payouts/breakup/details.d.ts +9 -8
  56. package/resources/payouts/breakup/details.d.ts.map +1 -1
  57. package/resources/payouts/breakup/details.js +4 -4
  58. package/resources/payouts/breakup/details.mjs +4 -4
  59. package/resources/refunds.d.mts +16 -1
  60. package/resources/refunds.d.mts.map +1 -1
  61. package/resources/refunds.d.ts +16 -1
  62. package/resources/refunds.d.ts.map +1 -1
  63. package/resources/subscriptions.d.mts +42 -6
  64. package/resources/subscriptions.d.mts.map +1 -1
  65. package/resources/subscriptions.d.ts +42 -6
  66. package/resources/subscriptions.d.ts.map +1 -1
  67. package/src/client.ts +36 -1
  68. package/src/resources/balances.ts +8 -2
  69. package/src/resources/checkout-sessions.ts +116 -9
  70. package/src/resources/customers/emails.ts +7 -4
  71. package/src/resources/discounts.ts +13 -9
  72. package/src/resources/index.ts +13 -0
  73. package/src/resources/moderation.ts +388 -0
  74. package/src/resources/payments.ts +43 -1
  75. package/src/resources/payouts/breakup/breakup.ts +17 -1
  76. package/src/resources/payouts/breakup/details.ts +9 -8
  77. package/src/resources/refunds.ts +23 -0
  78. package/src/resources/subscriptions.ts +48 -5
  79. package/src/version.ts +1 -1
  80. package/version.d.mts +1 -1
  81. package/version.d.ts +1 -1
  82. package/version.js +1 -1
  83. package/version.mjs +1 -1
@@ -192,6 +192,16 @@ export interface CheckoutSessionFlags {
192
192
  */
193
193
  redirect_immediately?: boolean;
194
194
 
195
+ /**
196
+ * If true, the customer must give the name on the card to pay by card. Apple Pay
197
+ * and Google Pay also collect the payer name, and the payment stores it as the
198
+ * card holder name. The checkout page enforces this. Other payment methods ignore
199
+ * it.
200
+ *
201
+ * Default is false
202
+ */
203
+ require_cardholder_name?: boolean;
204
+
195
205
  /**
196
206
  * If true, the customer must provide a phone number to complete checkout. Requires
197
207
  * `allow_phone_number_collection` to also be true.
@@ -226,6 +236,11 @@ export interface CheckoutSessionFlags {
226
236
  }
227
237
 
228
238
  export interface CheckoutSessionRequest {
239
+ /**
240
+ * The products of the checkout. A cart holds at most 20 of them, one-time and
241
+ * subscription products together. An empty cart is valid for the
242
+ * product-collection flow, where the customer chooses the product later.
243
+ */
229
244
  product_cart: Array<ProductItemReq>;
230
245
 
231
246
  /**
@@ -244,7 +259,14 @@ export interface CheckoutSessionRequest {
244
259
  billing_address?: CheckoutSessionBillingAddress | null;
245
260
 
246
261
  /**
247
- * This field is ingored if adaptive pricing is disabled
262
+ * The currency to charge the customer in.
263
+ *
264
+ * Adaptive pricing must be enabled for the business. The customer then pays in
265
+ * this currency. If you do not set it, the currency comes from the billing
266
+ * country.
267
+ *
268
+ * If adaptive pricing is disabled, the API discards this field. The currency then
269
+ * comes from the product price, or from the billing country.
248
270
  */
249
271
  billing_currency?: MiscAPI.Currency | null;
250
272
 
@@ -319,8 +341,11 @@ export interface CheckoutSessionRequest {
319
341
  /**
320
342
  * If true, only zipcode is required when confirm is true; other address fields
321
343
  * remain optional
344
+ *
345
+ * Default is true when `feature_flags.single_page` is true. Otherwise, default is
346
+ * false.
322
347
  */
323
- minimal_address?: boolean;
348
+ minimal_address?: boolean | null;
324
349
 
325
350
  /**
326
351
  * Optional payment method ID to use for this checkout session. Only allowed when
@@ -713,7 +738,9 @@ export interface CheckoutSessionPreviewResponse {
713
738
  * The upcoming billing date for subscriptions, computed relative to now: with a
714
739
  * trial it is `now + trial_period_days`, otherwise `now + payment frequency`.
715
740
  * `None` for one-time-only carts. This is a preview estimate; the authoritative
716
- * value is set when the subscription activates.
741
+ * value is set when the subscription activates. For a cart of more than one
742
+ * subscription, this is the earliest date of the cart. `subscriptions` gives the
743
+ * date of each subscription.
717
744
  */
718
745
  next_billing_date?: string | null;
719
746
 
@@ -722,6 +749,12 @@ export interface CheckoutSessionPreviewResponse {
722
749
  */
723
750
  recurring_breakup?: CheckoutSessionPreviewResponse.RecurringBreakup | null;
724
751
 
752
+ /**
753
+ * One entry for each subscription of a cart that holds more than one. Each
754
+ * subscription renews on its own schedule, so the checkout shows each one here.
755
+ */
756
+ subscriptions?: Array<CheckoutSessionPreviewResponse.Subscription> | null;
757
+
725
758
  /**
726
759
  * Registered business name from the official registry (EU/GB/AU) when found
727
760
  */
@@ -745,13 +778,16 @@ export interface CheckoutSessionPreviewResponse {
745
778
  /**
746
779
  * Per-unit trial amount after discounts, in the price currency's minor units
747
780
  * (pre-quantity, pre-tax; see `current_breakup` for the taxed total due today).
748
- * Only present for a paid trial; `None` for a free trial or no trial.
781
+ * Only present for a paid trial; `None` for a free trial or no trial. Always
782
+ * `None` for a cart of more than one subscription.
749
783
  */
750
784
  trial_amount?: number | null;
751
785
 
752
786
  /**
753
787
  * Effective trial duration in days for the subscription line, when there's a trial
754
- * (free or paid). `None` if no subscription or no trial.
788
+ * (free or paid). `None` if no subscription or no trial. Always `None` for a cart
789
+ * of more than one subscription. Read the trial of each subscription from
790
+ * `subscriptions`.
755
791
  */
756
792
  trial_period_days?: number | null;
757
793
  }
@@ -976,9 +1012,55 @@ export namespace CheckoutSessionPreviewResponse {
976
1012
  */
977
1013
  tax?: number | null;
978
1014
  }
1015
+
1016
+ /**
1017
+ * The quote of one subscription in a cart of several.
1018
+ */
1019
+ export interface Subscription {
1020
+ /**
1021
+ * The amount this subscription charges today, including tax.
1022
+ */
1023
+ amount_due_now: number;
1024
+
1025
+ /**
1026
+ * The subscription product.
1027
+ */
1028
+ product_id: string;
1029
+
1030
+ /**
1031
+ * The amount of each renewal, including tax.
1032
+ */
1033
+ recurring_amount: number;
1034
+
1035
+ /**
1036
+ * A preview of the first renewal date. The date is set when the subscription
1037
+ * activates.
1038
+ */
1039
+ next_billing_date?: string | null;
1040
+
1041
+ /**
1042
+ * The tax in `recurring_amount`.
1043
+ */
1044
+ recurring_tax?: number | null;
1045
+
1046
+ /**
1047
+ * The tax in `amount_due_now`.
1048
+ */
1049
+ tax_due_now?: number | null;
1050
+
1051
+ /**
1052
+ * The trial duration in days. `None` when the subscription has no trial.
1053
+ */
1054
+ trial_period_days?: number | null;
1055
+ }
979
1056
  }
980
1057
 
981
1058
  export interface CheckoutSessionCreateParams {
1059
+ /**
1060
+ * The products of the checkout. A cart holds at most 20 of them, one-time and
1061
+ * subscription products together. An empty cart is valid for the
1062
+ * product-collection flow, where the customer chooses the product later.
1063
+ */
982
1064
  product_cart: Array<ProductItemReq>;
983
1065
 
984
1066
  /**
@@ -997,7 +1079,14 @@ export interface CheckoutSessionCreateParams {
997
1079
  billing_address?: CheckoutSessionBillingAddress | null;
998
1080
 
999
1081
  /**
1000
- * This field is ingored if adaptive pricing is disabled
1082
+ * The currency to charge the customer in.
1083
+ *
1084
+ * Adaptive pricing must be enabled for the business. The customer then pays in
1085
+ * this currency. If you do not set it, the currency comes from the billing
1086
+ * country.
1087
+ *
1088
+ * If adaptive pricing is disabled, the API discards this field. The currency then
1089
+ * comes from the product price, or from the billing country.
1001
1090
  */
1002
1091
  billing_currency?: MiscAPI.Currency | null;
1003
1092
 
@@ -1072,8 +1161,11 @@ export interface CheckoutSessionCreateParams {
1072
1161
  /**
1073
1162
  * If true, only zipcode is required when confirm is true; other address fields
1074
1163
  * remain optional
1164
+ *
1165
+ * Default is true when `feature_flags.single_page` is true. Otherwise, default is
1166
+ * false.
1075
1167
  */
1076
- minimal_address?: boolean;
1168
+ minimal_address?: boolean | null;
1077
1169
 
1078
1170
  /**
1079
1171
  * Optional payment method ID to use for this checkout session. Only allowed when
@@ -1111,6 +1203,11 @@ export interface CheckoutSessionCreateParams {
1111
1203
  }
1112
1204
 
1113
1205
  export interface CheckoutSessionPreviewParams {
1206
+ /**
1207
+ * The products of the checkout. A cart holds at most 20 of them, one-time and
1208
+ * subscription products together. An empty cart is valid for the
1209
+ * product-collection flow, where the customer chooses the product later.
1210
+ */
1114
1211
  product_cart: Array<ProductItemReq>;
1115
1212
 
1116
1213
  /**
@@ -1129,7 +1226,14 @@ export interface CheckoutSessionPreviewParams {
1129
1226
  billing_address?: CheckoutSessionBillingAddress | null;
1130
1227
 
1131
1228
  /**
1132
- * This field is ingored if adaptive pricing is disabled
1229
+ * The currency to charge the customer in.
1230
+ *
1231
+ * Adaptive pricing must be enabled for the business. The customer then pays in
1232
+ * this currency. If you do not set it, the currency comes from the billing
1233
+ * country.
1234
+ *
1235
+ * If adaptive pricing is disabled, the API discards this field. The currency then
1236
+ * comes from the product price, or from the billing country.
1133
1237
  */
1134
1238
  billing_currency?: MiscAPI.Currency | null;
1135
1239
 
@@ -1204,8 +1308,11 @@ export interface CheckoutSessionPreviewParams {
1204
1308
  /**
1205
1309
  * If true, only zipcode is required when confirm is true; other address fields
1206
1310
  * remain optional
1311
+ *
1312
+ * Default is true when `feature_flags.single_page` is true. Otherwise, default is
1313
+ * false.
1207
1314
  */
1208
- minimal_address?: boolean;
1315
+ minimal_address?: boolean | null;
1209
1316
 
1210
1317
  /**
1211
1318
  * Optional payment method ID to use for this checkout session. Only allowed when
@@ -166,7 +166,8 @@ export interface EmailLogItem {
166
166
  from?: string | null;
167
167
 
168
168
  /**
169
- * The address the email reached.
169
+ * The address the email went to. On a failed email this is the address the
170
+ * provider reports as bounced.
170
171
  */
171
172
  recipient?: string | null;
172
173
 
@@ -190,7 +191,8 @@ export type EmailLogStatus = 'sent' | 'delivered' | 'failed' | 'complained' | 'b
190
191
  */
191
192
  export interface EmailPolicies {
192
193
  /**
193
- * A permanent failure was recorded, so the same address would be a no-op.
194
+ * A permanent failure was recorded, so a send to the same address delivers
195
+ * nothing. It is false for a suppressed address that a resend can clear.
194
196
  */
195
197
  requires_different_address: boolean;
196
198
 
@@ -210,8 +212,9 @@ export interface EmailPolicies {
210
212
  retry_allowed: boolean;
211
213
 
212
214
  /**
213
- * A later send of this email reached the provider, so this row is history. To send
214
- * it again would deliver a second copy.
215
+ * A later send of this email replaced this row, so this row is history. A row that
216
+ * never went out needs a later send that reached the provider. A failed row needs
217
+ * a later send that was delivered.
215
218
  */
216
219
  superseded: boolean;
217
220
  }
@@ -375,9 +375,11 @@ export interface DiscountCreateParams {
375
375
 
376
376
  /**
377
377
  * Per-currency options (flat deduction / percentage cap + minimum subtotal).
378
- * Required for `flat` codes (must include a resolvable default); optional
379
- * per-currency caps for `percentage` codes. Per-row invariants are checked in
380
- * `normalize_currency_options`, not via `#[validate(nested)]`.
378
+ * Checkout uses the row for the currency the buyer pays in. For any other currency
379
+ * it converts the default row. Required for `flat` codes (must include a
380
+ * resolvable default); optional per-currency caps for `percentage` codes. Per-row
381
+ * invariants are checked in `normalize_currency_options`, not via
382
+ * `#[validate(nested)]`.
381
383
  */
382
384
  currency_options?: Array<DiscountCreateParams.CurrencyOption> | null;
383
385
 
@@ -446,13 +448,14 @@ export namespace DiscountCreateParams {
446
448
  */
447
449
  export interface CurrencyOption {
448
450
  /**
449
- * The currency this option applies to.
451
+ * The currency this option applies to. The row applies when the buyer pays in this
452
+ * currency.
450
453
  */
451
454
  currency: MiscAPI.Currency;
452
455
 
453
456
  /**
454
- * Whether this row is the default to convert from for unconfigured currencies. At
455
- * most one row per discount may be default.
457
+ * Whether this row is the default to convert from when the buyer pays in a
458
+ * currency that has no row. At most one row per discount may be default.
456
459
  */
457
460
  is_default?: boolean;
458
461
 
@@ -555,13 +558,14 @@ export namespace DiscountUpdateParams {
555
558
  */
556
559
  export interface CurrencyOption {
557
560
  /**
558
- * The currency this option applies to.
561
+ * The currency this option applies to. The row applies when the buyer pays in this
562
+ * currency.
559
563
  */
560
564
  currency: MiscAPI.Currency;
561
565
 
562
566
  /**
563
- * Whether this row is the default to convert from for unconfigured currencies. At
564
- * most one row per discount may be default.
567
+ * Whether this row is the default to convert from when the buyer pays in a
568
+ * currency that has no row. At most one row per discount may be default.
565
569
  */
566
570
  is_default?: boolean;
567
571
 
@@ -146,6 +146,17 @@ export {
146
146
  type TaxCategory,
147
147
  type MiscListSupportedCountriesResponse,
148
148
  } from './misc';
149
+ export {
150
+ Moderation,
151
+ type ModerationCategory,
152
+ type ModerationCategoryProvenance,
153
+ type ModerationCategoryScores,
154
+ type ModerationDecision,
155
+ type ModerationProvenance,
156
+ type ModerationRetrieveUsageResponse,
157
+ type ModerationScreenResponse,
158
+ type ModerationScreenParams,
159
+ } from './moderation';
149
160
  export {
150
161
  Payments,
151
162
  type AttachExistingCustomer,
@@ -213,6 +224,7 @@ export {
213
224
  export {
214
225
  Refunds,
215
226
  type Refund,
227
+ type RefundNetworkReferenceType,
216
228
  type RefundStatus,
217
229
  type RefundListParams,
218
230
  type RefundCreateParams,
@@ -228,6 +240,7 @@ export {
228
240
  type OnDemandSubscription,
229
241
  type ScheduledPlanChange,
230
242
  type Subscription,
243
+ type SubscriptionCancelledBy,
231
244
  type SubscriptionStatus,
232
245
  type TimeInterval,
233
246
  type UpdateSubscriptionPlanReq,