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
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './customers/index';
@@ -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';
@@ -678,6 +678,12 @@ export interface CheckoutSessionPreviewResponse {
678
678
  */
679
679
  is_byop: boolean;
680
680
 
681
+ /**
682
+ * False when the customer can confirm this session with no card. True for every
683
+ * other cart, including a one-time cart.
684
+ */
685
+ payment_method_required: boolean;
686
+
681
687
  /**
682
688
  * The total product cart
683
689
  */
@@ -216,6 +216,7 @@ export class Balances extends APIResource {
216
216
  * - `reason` - Optional human-readable reason
217
217
  * - `expires_at` - Optional expiration for credited amount (only for credit type)
218
218
  * - `idempotency_key` - Optional key to prevent duplicate entries
219
+ * - `metadata` - Optional key-value pairs
219
220
  *
220
221
  * # Responses
221
222
  *
@@ -287,9 +288,7 @@ export interface CreditLedgerEntry {
287
288
  is_credit: boolean;
288
289
 
289
290
  /**
290
- * Metadata associated with the credit grant's source (the subscription or payment
291
- * created at checkout). Empty when the grant has no resolvable source (e.g.
292
- * credits granted directly via the API).
291
+ * Metadata associated with this entry.
293
292
  */
294
293
  metadata: MiscAPI.Metadata;
295
294
 
@@ -363,6 +362,11 @@ export interface BalanceCreateLedgerEntryResponse {
363
362
 
364
363
  is_credit: boolean;
365
364
 
365
+ /**
366
+ * Metadata stored on this entry.
367
+ */
368
+ metadata: MiscAPI.Metadata;
369
+
366
370
  overage_after: string;
367
371
 
368
372
  overage_before: string;
@@ -489,7 +493,7 @@ export interface BalanceCreateLedgerEntryParams {
489
493
 
490
494
  /**
491
495
  * Body param: Optional metadata (max 50 key-value pairs, key max 40 chars, value
492
- * max 500 chars)
496
+ * max 500 chars).
493
497
  */
494
498
  metadata?: MiscAPI.Metadata | null;
495
499
 
@@ -5,6 +5,18 @@ import * as MiscAPI from '../misc';
5
5
  import * as PaymentsAPI from '../payments';
6
6
  import * as CustomerPortalAPI from './customer-portal';
7
7
  import { CustomerPortal, CustomerPortalCreateParams } from './customer-portal';
8
+ import * as EmailsAPI from './emails';
9
+ import {
10
+ EmailBody,
11
+ EmailFailureCode,
12
+ EmailListParams,
13
+ EmailLogItem,
14
+ EmailLogItemsDefaultPageNumberPagination,
15
+ EmailLogStatus,
16
+ EmailPolicies,
17
+ EmailRetrieveBodyParams,
18
+ Emails,
19
+ } from './emails';
8
20
  import * as EntitlementsAPI from '../entitlements/entitlements';
9
21
  import * as GrantsAPI from '../entitlements/grants';
10
22
  import { EntitlementGrantsDefaultPageNumberPagination } from '../entitlements/grants';
@@ -23,6 +35,7 @@ import { path } from '../../internal/utils/path';
23
35
  export class Customers extends APIResource {
24
36
  customerPortal: CustomerPortalAPI.CustomerPortal = new CustomerPortalAPI.CustomerPortal(this._client);
25
37
  wallets: WalletsAPI.Wallets = new WalletsAPI.Wallets(this._client);
38
+ emails: EmailsAPI.Emails = new EmailsAPI.Emails(this._client);
26
39
 
27
40
  /**
28
41
  * @example
@@ -192,6 +205,18 @@ export interface Customer {
192
205
 
193
206
  name: string;
194
207
 
208
+ /**
209
+ * When the merchant blocked this customer. The dashboard shows the "Blocked" badge
210
+ * and the unblock action from it. The list route leaves it empty; only the
211
+ * single-customer route resolves it.
212
+ */
213
+ blocked_at?: string | null;
214
+
215
+ /**
216
+ * Blocklist entry behind `blocked_at`, so the dashboard can link to it.
217
+ */
218
+ blocklist_entry_id?: string | null;
219
+
195
220
  /**
196
221
  * Additional metadata for the customer
197
222
  */
@@ -418,6 +443,7 @@ export interface CustomerListEntitlementGrantsParams extends DefaultPageNumberPa
418
443
 
419
444
  Customers.CustomerPortal = CustomerPortal;
420
445
  Customers.Wallets = Wallets;
446
+ Customers.Emails = Emails;
421
447
 
422
448
  export declare namespace Customers {
423
449
  export {
@@ -441,6 +467,18 @@ export declare namespace Customers {
441
467
  type CustomerWallet as CustomerWallet,
442
468
  type WalletListResponse as WalletListResponse,
443
469
  };
470
+
471
+ export {
472
+ Emails as Emails,
473
+ type EmailBody as EmailBody,
474
+ type EmailFailureCode as EmailFailureCode,
475
+ type EmailLogItem as EmailLogItem,
476
+ type EmailLogStatus as EmailLogStatus,
477
+ type EmailPolicies as EmailPolicies,
478
+ type EmailLogItemsDefaultPageNumberPagination as EmailLogItemsDefaultPageNumberPagination,
479
+ type EmailListParams as EmailListParams,
480
+ type EmailRetrieveBodyParams as EmailRetrieveBodyParams,
481
+ };
444
482
  }
445
483
 
446
484
  export { type EntitlementGrantsDefaultPageNumberPagination };
@@ -0,0 +1,238 @@
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 {
6
+ DefaultPageNumberPagination,
7
+ type DefaultPageNumberPaginationParams,
8
+ PagePromise,
9
+ } from '../../core/pagination';
10
+ import { RequestOptions } from '../../internal/request-options';
11
+ import { path } from '../../internal/utils/path';
12
+
13
+ export class Emails extends APIResource {
14
+ /**
15
+ * Returns every transactional email sent to this customer in the last 180 days,
16
+ * newest first, with its delivery outcome. Delivery status comes from the email
17
+ * provider and is as fresh as replication, typically seconds.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * // Automatically fetches more pages as needed.
22
+ * for await (const emailLogItem of client.customers.emails.list(
23
+ * 'customer_id',
24
+ * )) {
25
+ * // ...
26
+ * }
27
+ * ```
28
+ */
29
+ list(
30
+ customerID: string,
31
+ query: EmailListParams | null | undefined = {},
32
+ options?: RequestOptions,
33
+ ): PagePromise<EmailLogItemsDefaultPageNumberPagination, EmailLogItem> {
34
+ return this._client.getAPIList(
35
+ path`/customers/${customerID}/emails`,
36
+ DefaultPageNumberPagination<EmailLogItem>,
37
+ { query, ...options },
38
+ );
39
+ }
40
+
41
+ /**
42
+ * Returns the email exactly as it was sent, plus the reason it failed when it did.
43
+ * Some emails have no body to show: an authentication email carries a live login
44
+ * token, a blocked email never reached the provider, and the provider clears
45
+ * bodies at 180 days.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const emailBody =
50
+ * await client.customers.emails.retrieveBody(
51
+ * 'email_log_id',
52
+ * { customer_id: 'customer_id' },
53
+ * );
54
+ * ```
55
+ */
56
+ retrieveBody(
57
+ emailLogID: string,
58
+ params: EmailRetrieveBodyParams,
59
+ options?: RequestOptions,
60
+ ): APIPromise<EmailBody> {
61
+ const { customer_id } = params;
62
+ return this._client.get(path`/customers/${customer_id}/emails/${emailLogID}/body`, options);
63
+ }
64
+ }
65
+
66
+ export type EmailLogItemsDefaultPageNumberPagination = DefaultPageNumberPagination<EmailLogItem>;
67
+
68
+ export interface EmailBody {
69
+ /**
70
+ * Whether the merchant wrote this content. It is true for the recovery and dunning
71
+ * emails, which the merchant writes.
72
+ *
73
+ * The content is email HTML. Render it in a sandbox, whatever this value is.
74
+ */
75
+ merchant_authored: boolean;
76
+
77
+ /**
78
+ * Why the email did not arrive. It is null unless the email failed.
79
+ */
80
+ failure_code?: EmailFailureCode | null;
81
+
82
+ /**
83
+ * A sentence that explains `failure_code`. It is null unless the email failed.
84
+ */
85
+ failure_reason?: string | null;
86
+
87
+ /**
88
+ * The stored HTML. It is null on a text-only email.
89
+ */
90
+ html?: string | null;
91
+
92
+ /**
93
+ * The stored plain text.
94
+ */
95
+ text?: string | null;
96
+ }
97
+
98
+ /**
99
+ * Why an email did not reach the recipient.
100
+ *
101
+ * The code is stable. `send_failed` is the catch-all: it covers every failure that
102
+ * the other codes do not name.
103
+ */
104
+ export type EmailFailureCode =
105
+ | 'mailbox_not_found'
106
+ | 'address_rejected'
107
+ | 'address_suppressed'
108
+ | 'mailbox_full'
109
+ | 'temporary_failure'
110
+ | 'message_too_large'
111
+ | 'marked_as_spam'
112
+ | 'send_failed';
113
+
114
+ export interface EmailLogItem {
115
+ /**
116
+ * The group this email belongs to: payments, refunds, subscriptions,
117
+ * dunning_recovery, entitlements or auth.
118
+ */
119
+ category: string;
120
+
121
+ /**
122
+ * When this email was sent.
123
+ */
124
+ created_at: string;
125
+
126
+ /**
127
+ * Identifies this email. Use it to read the body or to send it again.
128
+ */
129
+ email_log_id: string;
130
+
131
+ /**
132
+ * What kind of email this is, for example `payment_successful`.
133
+ */
134
+ email_type: string;
135
+
136
+ /**
137
+ * Whether this email has content to show. The content endpoint can still refuse,
138
+ * because the content is removed after 180 days.
139
+ */
140
+ has_preview: boolean;
141
+
142
+ /**
143
+ * What you may do with this email.
144
+ */
145
+ policies: EmailPolicies;
146
+
147
+ /**
148
+ * Where the email got to: sent, delivered, failed, complained or blocked.
149
+ */
150
+ status: EmailLogStatus;
151
+
152
+ /**
153
+ * Why the email did not arrive. It is null unless the email failed.
154
+ */
155
+ failure_code?: EmailFailureCode | null;
156
+
157
+ /**
158
+ * A sentence that explains `failure_code`. It is null unless the email failed.
159
+ */
160
+ failure_reason?: string | null;
161
+
162
+ /**
163
+ * The address the email was sent from.
164
+ */
165
+ from?: string | null;
166
+
167
+ /**
168
+ * What the merchant typed, when test mode redirected the send to the business
169
+ * owner.
170
+ */
171
+ intended_recipient?: string | null;
172
+
173
+ /**
174
+ * The address the email reached.
175
+ */
176
+ recipient?: string | null;
177
+
178
+ /**
179
+ * The subject line as it was sent. Empty until the provider replicates.
180
+ */
181
+ subject?: string | null;
182
+ }
183
+
184
+ /**
185
+ * The delivery status of one email.
186
+ *
187
+ * `sent` also covers an email that is still on its way. A status only becomes
188
+ * `delivered`, `failed` or `complained` when the mail server answers.
189
+ */
190
+ export type EmailLogStatus = 'sent' | 'delivered' | 'failed' | 'complained' | 'blocked';
191
+
192
+ /**
193
+ * What the merchant may do with one row. The server decides; the client never
194
+ * derives eligibility itself.
195
+ */
196
+ export interface EmailPolicies {
197
+ /**
198
+ * A permanent failure was recorded, so the same address would be a no-op.
199
+ */
200
+ requires_different_address: boolean;
201
+
202
+ /**
203
+ * The row was delivered and may be sent again.
204
+ */
205
+ resend_allowed: boolean;
206
+
207
+ /**
208
+ * How many sends are left in this email's chain.
209
+ */
210
+ resends_remaining: number;
211
+
212
+ /**
213
+ * The row failed and may be sent again.
214
+ */
215
+ retry_allowed: boolean;
216
+ }
217
+
218
+ export interface EmailListParams extends DefaultPageNumberPaginationParams {}
219
+
220
+ export interface EmailRetrieveBodyParams {
221
+ /**
222
+ * The customer's id
223
+ */
224
+ customer_id: string;
225
+ }
226
+
227
+ export declare namespace Emails {
228
+ export {
229
+ type EmailBody as EmailBody,
230
+ type EmailFailureCode as EmailFailureCode,
231
+ type EmailLogItem as EmailLogItem,
232
+ type EmailLogStatus as EmailLogStatus,
233
+ type EmailPolicies as EmailPolicies,
234
+ type EmailLogItemsDefaultPageNumberPagination as EmailLogItemsDefaultPageNumberPagination,
235
+ type EmailListParams as EmailListParams,
236
+ type EmailRetrieveBodyParams as EmailRetrieveBodyParams,
237
+ };
238
+ }
@@ -15,4 +15,15 @@ export {
15
15
  type CustomerListEntitlementGrantsParams,
16
16
  type CustomersDefaultPageNumberPagination,
17
17
  } from './customers';
18
+ export {
19
+ Emails,
20
+ type EmailBody,
21
+ type EmailFailureCode,
22
+ type EmailLogItem,
23
+ type EmailLogStatus,
24
+ type EmailPolicies,
25
+ type EmailListParams,
26
+ type EmailRetrieveBodyParams,
27
+ type EmailLogItemsDefaultPageNumberPagination,
28
+ } from './emails';
18
29
  export { Wallets, type CustomerWallet, type WalletListResponse } from './wallets/index';
@@ -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,
@@ -69,7 +69,6 @@ export class Products extends APIResource {
69
69
  * name: 'name',
70
70
  * price: {
71
71
  * currency: 'AED',
72
- * discount: 0,
73
72
  * price: 0,
74
73
  * type: 'one_time_price',
75
74
  * },
@@ -486,11 +485,6 @@ export namespace Price {
486
485
  */
487
486
  currency: MiscAPI.Currency;
488
487
 
489
- /**
490
- * Discount applied to the price, represented as a percentage (0 to 100).
491
- */
492
- discount: number;
493
-
494
488
  /**
495
489
  * The payment amount, in the smallest denomination of the currency (e.g., cents
496
490
  * for USD). For example, to charge $1.00, pass `100`.
@@ -502,6 +496,23 @@ export namespace Price {
502
496
 
503
497
  type: 'one_time_price';
504
498
 
499
+ /**
500
+ * @deprecated Deprecated: use `discount_bps` instead.
501
+ *
502
+ * Discount applied to the price, represented as a percentage (0 to 100). A
503
+ * response rounds this value to the nearest whole percent. Defaults to `0`.
504
+ */
505
+ discount?: number;
506
+
507
+ /**
508
+ * Discount applied to the price, in basis points. 100 basis points make one
509
+ * percent, so `1250` is a discount of 12.5%.
510
+ *
511
+ * Use this field for a discount with a fraction of a percent. A request that sends
512
+ * this field ignores `discount`. A value of `0` gives no discount.
513
+ */
514
+ discount_bps?: number | null;
515
+
505
516
  /**
506
517
  * Indicates whether the customer can pay any amount they choose. If set to `true`,
507
518
  * the [`price`](Self::price) field is the minimum amount.
@@ -537,11 +548,6 @@ export namespace Price {
537
548
  */
538
549
  currency: MiscAPI.Currency;
539
550
 
540
- /**
541
- * Discount applied to the price, represented as a percentage (0 to 100).
542
- */
543
- discount: number;
544
-
545
551
  /**
546
552
  * Number of units for the payment frequency. For example, a value of `1` with a
547
553
  * `payment_frequency_interval` of `month` represents monthly payments.
@@ -572,6 +578,23 @@ export namespace Price {
572
578
 
573
579
  type: 'recurring_price';
574
580
 
581
+ /**
582
+ * @deprecated Deprecated: use `discount_bps` instead.
583
+ *
584
+ * Discount applied to the price, represented as a percentage (0 to 100). A
585
+ * response rounds this value to the nearest whole percent. Defaults to `0`.
586
+ */
587
+ discount?: number;
588
+
589
+ /**
590
+ * Discount applied to the price, in basis points. 100 basis points make one
591
+ * percent, so `1250` is a discount of 12.5%.
592
+ *
593
+ * Use this field for a discount with a fraction of a percent. A request that sends
594
+ * this field ignores `discount`. A value of `0` gives no discount.
595
+ */
596
+ discount_bps?: number | null;
597
+
575
598
  /**
576
599
  * Opts this price in to purchasing power parity. The business must also enable
577
600
  * purchasing power parity. The discount percentage per country is always
@@ -596,10 +619,21 @@ export namespace Price {
596
619
  */
597
620
  trial_apply_discounts?: boolean | null;
598
621
 
622
+ /**
623
+ * Let a customer start a free trial with no card. Defaults to false.
624
+ */
625
+ trial_payment_method_optional?: boolean;
626
+
599
627
  /**
600
628
  * Number of days for the trial period. A value of `0` indicates no trial period.
601
629
  */
602
630
  trial_period_days?: number;
631
+
632
+ /**
633
+ * Let a customer start a subscription with no card, when the amount due today is
634
+ * `0` (a native `0` price, or a 100% discount). Defaults to false.
635
+ */
636
+ zero_amount_payment_method_optional?: boolean;
603
637
  }
604
638
 
605
639
  /**
@@ -611,11 +645,6 @@ export namespace Price {
611
645
  */
612
646
  currency: MiscAPI.Currency;
613
647
 
614
- /**
615
- * Discount applied to the price, represented as a percentage (0 to 100).
616
- */
617
- discount: number;
618
-
619
648
  /**
620
649
  * The fixed payment amount. Represented in the lowest denomination of the currency
621
650
  * (e.g., cents for USD). For example, to charge $1.00, pass `100`.
@@ -646,6 +675,23 @@ export namespace Price {
646
675
 
647
676
  type: 'usage_based_price';
648
677
 
678
+ /**
679
+ * @deprecated Deprecated: use `discount_bps` instead.
680
+ *
681
+ * Discount applied to the price, represented as a percentage (0 to 100). A
682
+ * response rounds this value to the nearest whole percent. Defaults to `0`.
683
+ */
684
+ discount?: number;
685
+
686
+ /**
687
+ * Discount applied to the price, in basis points. 100 basis points make one
688
+ * percent, so `1250` is a discount of 12.5%.
689
+ *
690
+ * Use this field for a discount with a fraction of a percent. A request that sends
691
+ * this field ignores `discount`. A value of `0` gives no discount.
692
+ */
693
+ discount_bps?: number | null;
694
+
649
695
  meters?: Array<ProductsAPI.AddMeterToPrice> | null;
650
696
 
651
697
  /**