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
@@ -0,0 +1,388 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Moderation extends APIResource {
8
+ /**
9
+ * Screens text, an image, or both, and returns a verdict: `allow`, `flag` or
10
+ * `deny`. The API is fail-closed: do not generate when you get no verdict.
11
+ *
12
+ * **Pricing.** Dodo Payments charges $0.30 per 1000 billable screens and debits
13
+ * the fee from your balance. A billable screen is a live-mode screen that returns
14
+ * a verdict. Errors and test-mode screens are free.
15
+ *
16
+ * **429.** Honour `Retry-After` and retry. A 429 is a throughput limit, not a
17
+ * verdict.
18
+ *
19
+ * **Test mode** returns mock verdicts and never calls the model. The default
20
+ * verdict is `allow`. Put one of these strings in `text` to select another
21
+ * outcome: `dodo_mock_flag` (`flag`), `dodo_mock_deny` (`deny`),
22
+ * `dodo_mock_overloaded` (429) or `dodo_mock_not_ready` (503).
23
+ */
24
+ screen(body: ModerationScreenParams, options?: RequestOptions): APIPromise<ModerationScreenResponse> {
25
+ return this._client.post('/moderation/screen', { body, ...options });
26
+ }
27
+
28
+ /**
29
+ * Shows how many billable screens you made and how close you are to your next
30
+ * charge.
31
+ *
32
+ * **Billing.** A billable screen is a live-mode screen that returns a verdict.
33
+ * Dodo Payments charges $0.30 for each full block of 1000 billable screens and
34
+ * debits the fee from your balance. Each full block is charged within one hour.
35
+ * Screens that do not fill a block stay unbilled until they do. Errors and
36
+ * test-mode screens are free and are not counted.
37
+ */
38
+ retrieveUsage(options?: RequestOptions): APIPromise<ModerationRetrieveUsageResponse> {
39
+ return this._client.get('/moderation/usage', options);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * A moderation category.
45
+ */
46
+ export type ModerationCategory =
47
+ | 'violent_crimes'
48
+ | 'sex_related_crimes'
49
+ | 'child_sexual_exploitation'
50
+ | 'suicide_and_self_harm'
51
+ | 'indiscriminate_weapons'
52
+ | 'intellectual_property'
53
+ | 'defamation'
54
+ | 'non_violent_crimes'
55
+ | 'hate'
56
+ | 'privacy'
57
+ | 'specialized_advice'
58
+ | 'sexual_content'
59
+ | 'non_consensual_intimate_imagery'
60
+ | 'minor_coded_language'
61
+ | 'real_person_likeness'
62
+ | 'living_artist_style'
63
+ | 'prompt_injection';
64
+
65
+ /**
66
+ * How each score in `categories` was measured.
67
+ */
68
+ export interface ModerationCategoryProvenance {
69
+ /**
70
+ * Child sexual exploitation.
71
+ */
72
+ child_sexual_exploitation: ModerationProvenance;
73
+
74
+ /**
75
+ * False depiction that is likely to injure the reputation of a real person.
76
+ */
77
+ defamation: ModerationProvenance;
78
+
79
+ /**
80
+ * Demeaning people because of a protected characteristic.
81
+ */
82
+ hate: ModerationProvenance;
83
+
84
+ /**
85
+ * Chemical, biological, radiological, nuclear or explosive weapons.
86
+ */
87
+ indiscriminate_weapons: ModerationProvenance;
88
+
89
+ /**
90
+ * Copyright or trademark infringement.
91
+ */
92
+ intellectual_property: ModerationProvenance;
93
+
94
+ /**
95
+ * Imitation of the signature style of a specific living artist.
96
+ */
97
+ living_artist_style: ModerationProvenance;
98
+
99
+ /**
100
+ * Age-coded language that suggests the subject is a minor.
101
+ */
102
+ minor_coded_language: ModerationProvenance;
103
+
104
+ /**
105
+ * Non-consensual intimate imagery: undressing, nudifying or sexualising a real
106
+ * person.
107
+ */
108
+ non_consensual_intimate_imagery: ModerationProvenance;
109
+
110
+ /**
111
+ * Non-violent crimes.
112
+ */
113
+ non_violent_crimes: ModerationProvenance;
114
+
115
+ /**
116
+ * Sensitive private information about a person.
117
+ */
118
+ privacy: ModerationProvenance;
119
+
120
+ /**
121
+ * An attempt to override or manipulate the instructions of the system.
122
+ */
123
+ prompt_injection: ModerationProvenance;
124
+
125
+ /**
126
+ * The likeness of a real, identifiable, named person.
127
+ */
128
+ real_person_likeness: ModerationProvenance;
129
+
130
+ /**
131
+ * Sex-related crimes.
132
+ */
133
+ sex_related_crimes: ModerationProvenance;
134
+
135
+ /**
136
+ * Sexually explicit or pornographic content.
137
+ */
138
+ sexual_content: ModerationProvenance;
139
+
140
+ /**
141
+ * Unqualified financial, medical, legal or electoral advice.
142
+ */
143
+ specialized_advice: ModerationProvenance;
144
+
145
+ /**
146
+ * Suicide and self-harm.
147
+ */
148
+ suicide_and_self_harm: ModerationProvenance;
149
+
150
+ /**
151
+ * Violent crimes.
152
+ */
153
+ violent_crimes: ModerationProvenance;
154
+ }
155
+
156
+ /**
157
+ * The probability, from 0 to 1, that the screen falls in each category.
158
+ */
159
+ export interface ModerationCategoryScores {
160
+ /**
161
+ * Child sexual exploitation.
162
+ */
163
+ child_sexual_exploitation: number;
164
+
165
+ /**
166
+ * False depiction that is likely to injure the reputation of a real person.
167
+ */
168
+ defamation: number;
169
+
170
+ /**
171
+ * Demeaning people because of a protected characteristic.
172
+ */
173
+ hate: number;
174
+
175
+ /**
176
+ * Chemical, biological, radiological, nuclear or explosive weapons.
177
+ */
178
+ indiscriminate_weapons: number;
179
+
180
+ /**
181
+ * Copyright or trademark infringement.
182
+ */
183
+ intellectual_property: number;
184
+
185
+ /**
186
+ * Imitation of the signature style of a specific living artist.
187
+ */
188
+ living_artist_style: number;
189
+
190
+ /**
191
+ * Age-coded language that suggests the subject is a minor.
192
+ */
193
+ minor_coded_language: number;
194
+
195
+ /**
196
+ * Non-consensual intimate imagery: undressing, nudifying or sexualising a real
197
+ * person.
198
+ */
199
+ non_consensual_intimate_imagery: number;
200
+
201
+ /**
202
+ * Non-violent crimes.
203
+ */
204
+ non_violent_crimes: number;
205
+
206
+ /**
207
+ * Sensitive private information about a person.
208
+ */
209
+ privacy: number;
210
+
211
+ /**
212
+ * An attempt to override or manipulate the instructions of the system.
213
+ */
214
+ prompt_injection: number;
215
+
216
+ /**
217
+ * The likeness of a real, identifiable, named person.
218
+ */
219
+ real_person_likeness: number;
220
+
221
+ /**
222
+ * Sex-related crimes.
223
+ */
224
+ sex_related_crimes: number;
225
+
226
+ /**
227
+ * Sexually explicit or pornographic content.
228
+ */
229
+ sexual_content: number;
230
+
231
+ /**
232
+ * Unqualified financial, medical, legal or electoral advice.
233
+ */
234
+ specialized_advice: number;
235
+
236
+ /**
237
+ * Suicide and self-harm.
238
+ */
239
+ suicide_and_self_harm: number;
240
+
241
+ /**
242
+ * Violent crimes.
243
+ */
244
+ violent_crimes: number;
245
+ }
246
+
247
+ /**
248
+ * The verdict. `allow` means the content passed. `deny` means block the content.
249
+ * `flag` means apply your own judgement. It is not a soft deny.
250
+ */
251
+ export type ModerationDecision = 'allow' | 'flag' | 'deny';
252
+
253
+ /**
254
+ * How a score was measured. `targeted` means a check for that one category
255
+ * measured it. `broad` means the general check that covers all categories measured
256
+ * it.
257
+ */
258
+ export type ModerationProvenance = 'targeted' | 'broad';
259
+
260
+ /**
261
+ * Your moderation usage.
262
+ */
263
+ export interface ModerationRetrieveUsageResponse {
264
+ /**
265
+ * Your billable screens per UTC day for the last 30 days, charged or not. A day
266
+ * with no screens is not in the list.
267
+ */
268
+ daily: Array<ModerationRetrieveUsageResponse.Daily>;
269
+
270
+ /**
271
+ * Billable screens still needed to fill the next block of 1000. A full block is
272
+ * charged within one hour, so this value is 1000 when your unbilled screens fill
273
+ * whole blocks.
274
+ */
275
+ screens_to_next_block: number;
276
+
277
+ /**
278
+ * Billable screens that Dodo Payments has not charged for yet.
279
+ */
280
+ unbilled_screens: number;
281
+ }
282
+
283
+ export namespace ModerationRetrieveUsageResponse {
284
+ export interface Daily {
285
+ /**
286
+ * The UTC day.
287
+ */
288
+ date: string;
289
+
290
+ /**
291
+ * Billable screens on that day.
292
+ */
293
+ screens: number;
294
+ }
295
+ }
296
+
297
+ /**
298
+ * The verdict of one screen.
299
+ */
300
+ export interface ModerationScreenResponse {
301
+ /**
302
+ * The probability, from 0 to 1, that the screen falls in each category.
303
+ */
304
+ categories: ModerationCategoryScores;
305
+
306
+ /**
307
+ * True when real-person likeness and sexual content together crossed their
308
+ * combined threshold, the pattern of a sexual deepfake.
309
+ */
310
+ compound_triggered: boolean;
311
+
312
+ /**
313
+ * The verdict. `allow` means the content passed. `deny` means block the content.
314
+ * `flag` means apply your own judgement. It is not a soft deny.
315
+ */
316
+ decision: ModerationDecision;
317
+
318
+ /**
319
+ * The time the screen took, in milliseconds.
320
+ */
321
+ latency_ms: number;
322
+
323
+ /**
324
+ * True when the text was also screened in a normalized form, with obfuscation such
325
+ * as invisible or look-alike characters removed.
326
+ */
327
+ normalized_applied: boolean;
328
+
329
+ /**
330
+ * Human-readable reasons for the decision. The wording can change, so do not parse
331
+ * it.
332
+ */
333
+ notes: Array<string>;
334
+
335
+ /**
336
+ * The number of yes/no questions the model answered for this screen.
337
+ */
338
+ passes: number;
339
+
340
+ /**
341
+ * How each score in `categories` was measured.
342
+ */
343
+ provenance: ModerationCategoryProvenance;
344
+
345
+ /**
346
+ * The `request_id` you sent, or null.
347
+ */
348
+ request_id: string | null;
349
+
350
+ /**
351
+ * The categories whose score crossed the threshold of the category. It can be
352
+ * empty on a `flag` from the general check. `notes` then gives the reason.
353
+ */
354
+ triggered: Array<ModerationCategory>;
355
+ }
356
+
357
+ export interface ModerationScreenParams {
358
+ /**
359
+ * The image to screen, as base64, with or without a `data:image/...;base64,`
360
+ * prefix. The formats are JPEG, PNG, WebP, GIF and BMP. The limit is 6991530
361
+ * base64 characters, and the decoded image must be at most 5 MiB.
362
+ */
363
+ image?: string | null;
364
+
365
+ /**
366
+ * Your identifier for this screen, up to 128 characters, with no control
367
+ * characters. The response returns it in `request_id`.
368
+ */
369
+ request_id?: string | null;
370
+
371
+ /**
372
+ * The text to screen, up to 8000 characters.
373
+ */
374
+ text?: string | null;
375
+ }
376
+
377
+ export declare namespace Moderation {
378
+ export {
379
+ type ModerationCategory as ModerationCategory,
380
+ type ModerationCategoryProvenance as ModerationCategoryProvenance,
381
+ type ModerationCategoryScores as ModerationCategoryScores,
382
+ type ModerationDecision as ModerationDecision,
383
+ type ModerationProvenance as ModerationProvenance,
384
+ type ModerationRetrieveUsageResponse as ModerationRetrieveUsageResponse,
385
+ type ModerationScreenResponse as ModerationScreenResponse,
386
+ type ModerationScreenParams as ModerationScreenParams,
387
+ };
388
+ }
@@ -329,6 +329,13 @@ export interface Payment {
329
329
  */
330
330
  disputes: Array<DisputesAPI.Dispute>;
331
331
 
332
+ /**
333
+ * True when one payment starts more than one subscription. Read this field to find
334
+ * the payment type. Do not read the length of `subscription_ids`. Do not read
335
+ * `subscription_id` for null.
336
+ */
337
+ is_multi_subscription: boolean;
338
+
332
339
  /**
333
340
  * Whether this payment was created solely to update a subscription's payment
334
341
  * method (a zero-/setup-amount charge). `false` for normal charges.
@@ -377,6 +384,13 @@ export interface Payment {
377
384
  */
378
385
  settlement_currency: MiscAPI.Currency;
379
386
 
387
+ /**
388
+ * Every subscription that this payment starts or charges, in a stable order. It is
389
+ * empty for a one-time payment. It holds the value of `subscription_id` when the
390
+ * payment names one subscription.
391
+ */
392
+ subscription_ids: Array<string>;
393
+
380
394
  /**
381
395
  * Total amount charged to the customer including tax, in the currency's smallest
382
396
  * unit (e.g. cents for USD, yen for JPY, fils for KWD — see the currency's decimal
@@ -496,7 +510,9 @@ export interface Payment {
496
510
  status?: IntentStatus | null;
497
511
 
498
512
  /**
499
- * Identifier of the subscription if payment is part of a subscription
513
+ * Identifier of the subscription if payment is part of a subscription. A
514
+ * multi-subscription payment leaves this null, because no single subscription owns
515
+ * the payment. Read `subscription_ids` for those.
500
516
  */
501
517
  subscription_id?: string | null;
502
518
 
@@ -675,6 +691,18 @@ export interface RefundListItem {
675
691
  */
676
692
  currency?: MiscAPI.Currency | null;
677
693
 
694
+ /**
695
+ * The reference number that the card network or the bank gives to the refund. The
696
+ * customer can give this number to their bank to trace the refund. It is null
697
+ * until the payment processor sends it.
698
+ */
699
+ network_reference?: string | null;
700
+
701
+ /**
702
+ * The kind of `network_reference`: ARN, STAN or RRN.
703
+ */
704
+ network_reference_type?: RefundsAPI.RefundNetworkReferenceType | null;
705
+
678
706
  /**
679
707
  * The reason provided for the refund, if any. Optional.
680
708
  */
@@ -748,6 +776,13 @@ export interface PaymentListResponse {
748
776
 
749
777
  has_license_key: boolean;
750
778
 
779
+ /**
780
+ * True when one payment starts more than one subscription. Read this field to find
781
+ * the payment type. Do not read the length of `subscription_ids`. Do not read
782
+ * `subscription_id` for null.
783
+ */
784
+ is_multi_subscription: boolean;
785
+
751
786
  /**
752
787
  * Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
753
788
  */
@@ -761,6 +796,13 @@ export interface PaymentListResponse {
761
796
  */
762
797
  payment_provider: 'stripe' | 'adyen' | 'dodo';
763
798
 
799
+ /**
800
+ * Every subscription that this payment starts or charges, in a stable order. It is
801
+ * empty for a one-time payment. It holds the value of `subscription_id` when the
802
+ * payment names one subscription.
803
+ */
804
+ subscription_ids: Array<string>;
805
+
764
806
  total_amount: number;
765
807
 
766
808
  /**
@@ -38,11 +38,27 @@ export type BreakupRetrieveResponse = Array<BreakupRetrieveResponse.BreakupRetri
38
38
  export namespace BreakupRetrieveResponse {
39
39
  /**
40
40
  * Payout breakup aggregated by event type, with amounts in the payout's currency.
41
+ *
42
+ * The rows sum to the payout amount. The last row can be `unattributed`, which is
43
+ * not a ledger event type. It holds the payout amount less the entries that fund
44
+ * it, and it takes either sign:
45
+ *
46
+ * - Positive: the entries come to less than the payout, so the payout drew on the
47
+ * balance an earlier cycle left over. A cycle of refunds and disputes produces a
48
+ * large positive value.
49
+ * - Negative: the entries come to more than the payout, and the remainder funds a
50
+ * later payout. This is the common case, for two reasons. The walk that claims
51
+ * the entries stops at the first one that reaches its target, so it passes the
52
+ * target by part of an entry. The target is also the gross debit, which holds
53
+ * the payout fee, and the fee is not a line here.
54
+ *
55
+ * The row is absent when the two are equal.
41
56
  */
42
57
  export interface BreakupRetrieveResponseItem {
43
58
  /**
44
59
  * The type of balance ledger event (e.g., "payment", "refund", "dispute",
45
- * "payment_fees").
60
+ * "payment_fees"), or `unattributed` for the payout amount the entries do not
61
+ * account for.
46
62
  */
47
63
  event_type: string;
48
64
 
@@ -13,10 +13,10 @@ import { path } from '../../../internal/utils/path';
13
13
 
14
14
  export class Details extends APIResource {
15
15
  /**
16
- * Returns paginated individual balance ledger entries for a payout, with each
17
- * entry's amount pro-rated into the payout's currency. Supports pagination via
18
- * `page_size` (default 10, max 100) and `page_number` (default 0) query
19
- * parameters.
16
+ * Returns paginated individual balance ledger entries for a payout. Each entry is
17
+ * converted into the payout's currency at the rate the payout settled at. Supports
18
+ * pagination via `page_size` (default 10, max 100) and `page_number` (default 0)
19
+ * query parameters.
20
20
  *
21
21
  * @example
22
22
  * ```ts
@@ -64,8 +64,8 @@ export class Details extends APIResource {
64
64
  export type DetailListResponsesDefaultPageNumberPagination = DefaultPageNumberPagination<DetailListResponse>;
65
65
 
66
66
  /**
67
- * Individual balance ledger entry for a payout, with amounts pro-rated into the
68
- * payout's currency.
67
+ * Individual balance ledger entry for a payout, converted into the payout's
68
+ * currency.
69
69
  */
70
70
  export interface DetailListResponse {
71
71
  /**
@@ -97,8 +97,9 @@ export interface DetailListResponse {
97
97
 
98
98
  /**
99
99
  * Amount in the payout's currency, in that currency's smallest unit (cents for
100
- * USD, yen for JPY, fils for KWD). Uses cumulative rounding to ensure sum matches
101
- * payout total exactly.
100
+ * USD, yen for JPY, fils for KWD). The entry is converted at the rate the payout
101
+ * settled at. These amounts sum to the value of the entries, which can be less
102
+ * than the payout: the grouped breakup reports the difference as `unattributed`.
102
103
  */
103
104
  payout_currency_amount: number;
104
105
 
@@ -114,12 +114,34 @@ export interface Refund {
114
114
  */
115
115
  currency?: MiscAPI.Currency | null;
116
116
 
117
+ /**
118
+ * The reference number that the card network or the bank gives to the refund. The
119
+ * customer can give this number to their bank to trace the refund. It is null
120
+ * until the payment processor sends it.
121
+ */
122
+ network_reference?: string | null;
123
+
124
+ /**
125
+ * The kind of `network_reference`: ARN, STAN or RRN.
126
+ */
127
+ network_reference_type?: RefundNetworkReferenceType | null;
128
+
117
129
  /**
118
130
  * The reason provided for the refund, if any. Optional.
119
131
  */
120
132
  reason?: string | null;
121
133
  }
122
134
 
135
+ /**
136
+ * The kind of reference number that the card network or the bank gives to a
137
+ * refund.
138
+ */
139
+ export type RefundNetworkReferenceType =
140
+ | 'acquirer_reference_number'
141
+ | 'system_trace_audit_number'
142
+ | 'retrieval_reference_number'
143
+ | 'other';
144
+
123
145
  export type RefundStatus = 'succeeded' | 'failed' | 'pending' | 'review';
124
146
 
125
147
  export interface RefundListParams extends DefaultPageNumberPaginationParams {
@@ -193,6 +215,7 @@ export namespace RefundCreateParams {
193
215
  export declare namespace Refunds {
194
216
  export {
195
217
  type Refund as Refund,
218
+ type RefundNetworkReferenceType as RefundNetworkReferenceType,
196
219
  type RefundStatus as RefundStatus,
197
220
  type RefundListParams as RefundListParams,
198
221
  type RefundCreateParams as RefundCreateParams,
@@ -634,6 +634,12 @@ export interface Subscription {
634
634
  */
635
635
  cancelled_at?: string | null;
636
636
 
637
+ /**
638
+ * The caller that cancelled the subscription or scheduled its cancel. `null` when
639
+ * no caller is known, for example when the system cancelled the subscription.
640
+ */
641
+ cancelled_by?: SubscriptionCancelledBy | null;
642
+
637
643
  /**
638
644
  * Customer's responses to custom fields collected during checkout
639
645
  */
@@ -694,6 +700,28 @@ export interface Subscription {
694
700
  trial_amount?: number | null;
695
701
  }
696
702
 
703
+ /**
704
+ * The caller that cancelled a subscription or scheduled its cancel.
705
+ */
706
+ export interface SubscriptionCancelledBy {
707
+ /**
708
+ * The kind of caller.
709
+ */
710
+ actor_type: 'customer' | 'merchant_user' | 'api_key' | 'dodo_team';
711
+
712
+ /**
713
+ * Email of the customer or of the dashboard user. `null` for an API key or the
714
+ * Dodo Payments team.
715
+ */
716
+ email?: string | null;
717
+
718
+ /**
719
+ * Name of the customer or of the dashboard user. `null` for an API key or the Dodo
720
+ * Payments team.
721
+ */
722
+ name?: string | null;
723
+ }
724
+
697
725
  export type SubscriptionStatus =
698
726
  | 'pending'
699
727
  | 'active'
@@ -1014,6 +1042,12 @@ export interface SubscriptionListResponse {
1014
1042
  */
1015
1043
  cancelled_at?: string | null;
1016
1044
 
1045
+ /**
1046
+ * The caller that cancelled the subscription or scheduled its cancel. `null` when
1047
+ * no caller is known, for example when the system cancelled the subscription.
1048
+ */
1049
+ cancelled_by?: SubscriptionCancelledBy | null;
1050
+
1017
1051
  /**
1018
1052
  * Business / legal name associated with the tax id (B2B). When set this is used on
1019
1053
  * the invoice in place of the customer's personal name.
@@ -1225,14 +1259,22 @@ export namespace SubscriptionPreviewChangePlanResponse {
1225
1259
  currency: MiscAPI.Currency;
1226
1260
 
1227
1261
  /**
1228
- * Net credit movement in the smallest currency unit (e.g. cents). **Negative** –
1229
- * credits were deducted from the customer's balance to offset the charge (typical
1230
- * on upgrades). **Positive** – credits were added to the customer's balance,
1231
- * either from a downgrade proration refund or from topping-up the wallet to meet a
1232
- * gateway minimum-charge threshold. **Zero** – no credit movement occurred.
1262
+ * Net credit movement in the smallest unit of `customer_credits_currency` (e.g.
1263
+ * cents). Read `customer_credits_currency` for the currency. It can differ from
1264
+ * `currency`. **Negative** – credits were deducted from the customer's balance to
1265
+ * offset the charge (typical on upgrades). **Positive** – credits were added to
1266
+ * the customer's balance, either from a downgrade proration refund or from
1267
+ * topping-up the wallet to meet a gateway minimum-charge threshold. **Zero** – no
1268
+ * credit movement occurred.
1233
1269
  */
1234
1270
  customer_credits: number;
1235
1271
 
1272
+ /**
1273
+ * This field gives the currency of `customer_credits`. The credit wallet uses the
1274
+ * subscription currency.
1275
+ */
1276
+ customer_credits_currency: MiscAPI.Currency;
1277
+
1236
1278
  settlement_amount: number;
1237
1279
 
1238
1280
  settlement_currency: MiscAPI.Currency;
@@ -1989,6 +2031,7 @@ export declare namespace Subscriptions {
1989
2031
  type OnDemandSubscription as OnDemandSubscription,
1990
2032
  type ScheduledPlanChange as ScheduledPlanChange,
1991
2033
  type Subscription as Subscription,
2034
+ type SubscriptionCancelledBy as SubscriptionCancelledBy,
1992
2035
  type SubscriptionStatus as SubscriptionStatus,
1993
2036
  type TimeInterval as TimeInterval,
1994
2037
  type UpdateSubscriptionPlanReq as UpdateSubscriptionPlanReq,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.51.0'; // x-release-please-version
1
+ export const VERSION = '2.53.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.51.0";
1
+ export declare const VERSION = "2.53.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.51.0";
1
+ export declare const VERSION = "2.53.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.51.0'; // x-release-please-version
4
+ exports.VERSION = '2.53.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.51.0'; // x-release-please-version
1
+ export const VERSION = '2.53.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map