stripe 14.4.0 → 14.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 14.5.0 - 2023-11-16
4
+ * [#1957](https://github.com/stripe/stripe-node/pull/1957) Update generated code
5
+ * Add support for `bacs_debit_payments` on `AccountCreateParams.settings` and `AccountUpdateParams.settings`
6
+ * Add support for `service_user_number` on `Account.settings.bacs_debit_payments`
7
+ * Change type of `Account.settings.bacs_debit_payments.display_name` from `string` to `string | null`
8
+ * Add support for `capture_before` on `Charge.payment_method_details.card`
9
+ * Add support for `paypal` on `Checkout.Session.payment_method_options`
10
+ * Add support for `tax_amounts` on `CreditNoteCreateParams.lines[]`, `CreditNotePreviewLinesParams.lines[]`, and `CreditNotePreviewParams.lines[]`
11
+ * Add support for `network_data` on `Issuing.Transaction`
12
+ * [#1960](https://github.com/stripe/stripe-node/pull/1960) Update generated code
13
+ * Add support for `status` on `Checkout.SessionListParams`
14
+ * [#1958](https://github.com/stripe/stripe-node/pull/1958) Move Webhooks instance to static field
15
+ * [#1952](https://github.com/stripe/stripe-node/pull/1952) Use AbortController for native fetch cancellation when available
16
+
3
17
  ## 14.4.0 - 2023-11-09
4
18
  * [#1947](https://github.com/stripe/stripe-node/pull/1947) Update generated code
5
19
  * Add support for new value `terminal_reader_hardware_fault` on enums `Invoice.last_finalization_error.code`, `PaymentIntent.last_payment_error.code`, `SetupAttempt.setup_error.code`, `SetupIntent.last_setup_error.code`, and `StripeError.code`
package/VERSION CHANGED
@@ -1 +1 @@
1
- 14.4.0
1
+ 14.5.0
@@ -13,13 +13,79 @@ const HttpClient_js_1 = require("./HttpClient.js");
13
13
  class FetchHttpClient extends HttpClient_js_1.HttpClient {
14
14
  constructor(fetchFn) {
15
15
  super();
16
- this._fetchFn = fetchFn;
16
+ // Default to global fetch if available
17
+ if (!fetchFn) {
18
+ if (!globalThis.fetch) {
19
+ throw new Error('fetch() function not provided and is not defined in the global scope. ' +
20
+ 'You must provide a fetch implementation.');
21
+ }
22
+ fetchFn = globalThis.fetch;
23
+ }
24
+ // Both timeout behaviors differs from Node:
25
+ // - Fetch uses a single timeout for the entire length of the request.
26
+ // - Node is more fine-grained and resets the timeout after each stage of the request.
27
+ if (globalThis.AbortController) {
28
+ // Utilise native AbortController if available
29
+ // AbortController was added in Node v15.0.0, v14.17.0
30
+ this._fetchFn = FetchHttpClient.makeFetchWithAbortTimeout(fetchFn);
31
+ }
32
+ else {
33
+ // Fall back to racing against a timeout promise if not available in the runtime
34
+ // This does not actually cancel the underlying fetch operation or resources
35
+ this._fetchFn = FetchHttpClient.makeFetchWithRaceTimeout(fetchFn);
36
+ }
37
+ }
38
+ static makeFetchWithRaceTimeout(fetchFn) {
39
+ return (url, init, timeout) => {
40
+ let pendingTimeoutId;
41
+ const timeoutPromise = new Promise((_, reject) => {
42
+ pendingTimeoutId = setTimeout(() => {
43
+ pendingTimeoutId = null;
44
+ reject(HttpClient_js_1.HttpClient.makeTimeoutError());
45
+ }, timeout);
46
+ });
47
+ const fetchPromise = fetchFn(url, init);
48
+ return Promise.race([fetchPromise, timeoutPromise]).finally(() => {
49
+ if (pendingTimeoutId) {
50
+ clearTimeout(pendingTimeoutId);
51
+ }
52
+ });
53
+ };
54
+ }
55
+ static makeFetchWithAbortTimeout(fetchFn) {
56
+ return async (url, init, timeout) => {
57
+ // Use AbortController because AbortSignal.timeout() was added later in Node v17.3.0, v16.14.0
58
+ const abort = new AbortController();
59
+ let timeoutId = setTimeout(() => {
60
+ timeoutId = null;
61
+ abort.abort(HttpClient_js_1.HttpClient.makeTimeoutError());
62
+ }, timeout);
63
+ try {
64
+ return await fetchFn(url, Object.assign(Object.assign({}, init), { signal: abort.signal }));
65
+ }
66
+ catch (err) {
67
+ // Some implementations, like node-fetch, do not respect the reason passed to AbortController.abort()
68
+ // and instead it always throws an AbortError
69
+ // We catch this case to normalise all timeout errors
70
+ if (err.name === 'AbortError') {
71
+ throw HttpClient_js_1.HttpClient.makeTimeoutError();
72
+ }
73
+ else {
74
+ throw err;
75
+ }
76
+ }
77
+ finally {
78
+ if (timeoutId) {
79
+ clearTimeout(timeoutId);
80
+ }
81
+ }
82
+ };
17
83
  }
18
84
  /** @override. */
19
85
  getClientName() {
20
86
  return 'fetch';
21
87
  }
22
- makeRequest(host, port, path, method, headers, requestData, protocol, timeout) {
88
+ async makeRequest(host, port, path, method, headers, requestData, protocol, timeout) {
23
89
  const isInsecureConnection = protocol === 'http';
24
90
  const url = new URL(path, `${isInsecureConnection ? 'http' : 'https'}://${host}`);
25
91
  url.port = port;
@@ -29,43 +95,14 @@ class FetchHttpClient extends HttpClient_js_1.HttpClient {
29
95
  // for more details.
30
96
  const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH';
31
97
  const body = requestData || (methodHasPayload ? '' : undefined);
32
- const fetchFn = this._fetchFn || fetch;
33
- const fetchPromise = fetchFn(url.toString(), {
98
+ const res = await this._fetchFn(url.toString(), {
34
99
  method,
35
100
  // @ts-ignore
36
101
  headers,
37
102
  // @ts-ignore
38
103
  body,
39
- });
40
- // The Fetch API does not support passing in a timeout natively, so a
41
- // timeout promise is constructed to race against the fetch and preempt the
42
- // request, simulating a timeout.
43
- //
44
- // This timeout behavior differs from Node:
45
- // - Fetch uses a single timeout for the entire length of the request.
46
- // - Node is more fine-grained and resets the timeout after each stage of
47
- // the request.
48
- //
49
- // As an example, if the timeout is set to 30s and the connection takes 20s
50
- // to be established followed by 20s for the body, Fetch would timeout but
51
- // Node would not. The more fine-grained timeout cannot be implemented with
52
- // fetch.
53
- let pendingTimeoutId;
54
- const timeoutPromise = new Promise((_, reject) => {
55
- pendingTimeoutId = setTimeout(() => {
56
- pendingTimeoutId = null;
57
- reject(HttpClient_js_1.HttpClient.makeTimeoutError());
58
- }, timeout);
59
- });
60
- return Promise.race([fetchPromise, timeoutPromise])
61
- .then((res) => {
62
- return new FetchHttpClientResponse(res);
63
- })
64
- .finally(() => {
65
- if (pendingTimeoutId) {
66
- clearTimeout(pendingTimeoutId);
67
- }
68
- });
104
+ }, timeout);
105
+ return new FetchHttpClientResponse(res);
69
106
  }
70
107
  }
71
108
  exports.FetchHttpClient = FetchHttpClient;
@@ -34,13 +34,23 @@ const ALLOWED_CONFIG_PROPERTIES = [
34
34
  ];
35
35
  const defaultRequestSenderFactory = (stripe) => new RequestSender_js_1.RequestSender(stripe, StripeResource_js_1.StripeResource.MAX_BUFFERED_REQUEST_METRICS);
36
36
  function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
37
- Stripe.PACKAGE_VERSION = '14.4.0';
37
+ Stripe.PACKAGE_VERSION = '14.5.0';
38
38
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, (0, utils_js_1.determineProcessUserAgentProperties)());
39
39
  Stripe.StripeResource = StripeResource_js_1.StripeResource;
40
40
  Stripe.resources = resources;
41
41
  Stripe.HttpClient = HttpClient_js_1.HttpClient;
42
42
  Stripe.HttpClientResponse = HttpClient_js_1.HttpClientResponse;
43
43
  Stripe.CryptoProvider = CryptoProvider_js_1.CryptoProvider;
44
+ // Previously Stripe.webhooks was just the createWebhooks() factory function
45
+ // however going forward it will be a WebhookObject instance. To maintain
46
+ // backwards compatibility it is currently a factory function that also
47
+ // complies to the WebhookObject signature. The factory function signature
48
+ // will be removed as a breaking change in the next major release.
49
+ // See https://github.com/stripe/stripe-node/issues/1956
50
+ function createWebhooksDefault(fns = platformFunctions) {
51
+ return (0, Webhooks_js_1.createWebhooks)(fns);
52
+ }
53
+ Stripe.webhooks = Object.assign(createWebhooksDefault, (0, Webhooks_js_1.createWebhooks)(platformFunctions));
44
54
  function Stripe(key, config = {}) {
45
55
  if (!(this instanceof Stripe)) {
46
56
  return new Stripe(key, config);
@@ -94,7 +104,9 @@ function createStripe(platformFunctions, requestSender = defaultRequestSenderFac
94
104
  this._prepResources();
95
105
  this._setApiKey(key);
96
106
  this.errors = _Error;
97
- this.webhooks = (0, Webhooks_js_1.createWebhooks)(platformFunctions);
107
+ // Once Stripe.webhooks looses the factory function signature in a future release
108
+ // then this should become this.webhooks = Stripe.webhooks
109
+ this.webhooks = createWebhooksDefault();
98
110
  this._prevRequestMetrics = [];
99
111
  this._enableTelemetry = props.telemetry !== false;
100
112
  this._requestSender = requestSender(this);
@@ -103,7 +115,6 @@ function createStripe(platformFunctions, requestSender = defaultRequestSenderFac
103
115
  this.StripeResource = Stripe.StripeResource;
104
116
  }
105
117
  Stripe.errors = _Error;
106
- Stripe.webhooks = Webhooks_js_1.createWebhooks;
107
118
  Stripe.createNodeHttpClient = platformFunctions.createNodeHttpClient;
108
119
  /**
109
120
  * Creates an HTTP client for issuing Stripe API requests which uses the Web
@@ -10,13 +10,79 @@ import { HttpClient, HttpClientResponse, } from './HttpClient.js';
10
10
  export class FetchHttpClient extends HttpClient {
11
11
  constructor(fetchFn) {
12
12
  super();
13
- this._fetchFn = fetchFn;
13
+ // Default to global fetch if available
14
+ if (!fetchFn) {
15
+ if (!globalThis.fetch) {
16
+ throw new Error('fetch() function not provided and is not defined in the global scope. ' +
17
+ 'You must provide a fetch implementation.');
18
+ }
19
+ fetchFn = globalThis.fetch;
20
+ }
21
+ // Both timeout behaviors differs from Node:
22
+ // - Fetch uses a single timeout for the entire length of the request.
23
+ // - Node is more fine-grained and resets the timeout after each stage of the request.
24
+ if (globalThis.AbortController) {
25
+ // Utilise native AbortController if available
26
+ // AbortController was added in Node v15.0.0, v14.17.0
27
+ this._fetchFn = FetchHttpClient.makeFetchWithAbortTimeout(fetchFn);
28
+ }
29
+ else {
30
+ // Fall back to racing against a timeout promise if not available in the runtime
31
+ // This does not actually cancel the underlying fetch operation or resources
32
+ this._fetchFn = FetchHttpClient.makeFetchWithRaceTimeout(fetchFn);
33
+ }
34
+ }
35
+ static makeFetchWithRaceTimeout(fetchFn) {
36
+ return (url, init, timeout) => {
37
+ let pendingTimeoutId;
38
+ const timeoutPromise = new Promise((_, reject) => {
39
+ pendingTimeoutId = setTimeout(() => {
40
+ pendingTimeoutId = null;
41
+ reject(HttpClient.makeTimeoutError());
42
+ }, timeout);
43
+ });
44
+ const fetchPromise = fetchFn(url, init);
45
+ return Promise.race([fetchPromise, timeoutPromise]).finally(() => {
46
+ if (pendingTimeoutId) {
47
+ clearTimeout(pendingTimeoutId);
48
+ }
49
+ });
50
+ };
51
+ }
52
+ static makeFetchWithAbortTimeout(fetchFn) {
53
+ return async (url, init, timeout) => {
54
+ // Use AbortController because AbortSignal.timeout() was added later in Node v17.3.0, v16.14.0
55
+ const abort = new AbortController();
56
+ let timeoutId = setTimeout(() => {
57
+ timeoutId = null;
58
+ abort.abort(HttpClient.makeTimeoutError());
59
+ }, timeout);
60
+ try {
61
+ return await fetchFn(url, Object.assign(Object.assign({}, init), { signal: abort.signal }));
62
+ }
63
+ catch (err) {
64
+ // Some implementations, like node-fetch, do not respect the reason passed to AbortController.abort()
65
+ // and instead it always throws an AbortError
66
+ // We catch this case to normalise all timeout errors
67
+ if (err.name === 'AbortError') {
68
+ throw HttpClient.makeTimeoutError();
69
+ }
70
+ else {
71
+ throw err;
72
+ }
73
+ }
74
+ finally {
75
+ if (timeoutId) {
76
+ clearTimeout(timeoutId);
77
+ }
78
+ }
79
+ };
14
80
  }
15
81
  /** @override. */
16
82
  getClientName() {
17
83
  return 'fetch';
18
84
  }
19
- makeRequest(host, port, path, method, headers, requestData, protocol, timeout) {
85
+ async makeRequest(host, port, path, method, headers, requestData, protocol, timeout) {
20
86
  const isInsecureConnection = protocol === 'http';
21
87
  const url = new URL(path, `${isInsecureConnection ? 'http' : 'https'}://${host}`);
22
88
  url.port = port;
@@ -26,43 +92,14 @@ export class FetchHttpClient extends HttpClient {
26
92
  // for more details.
27
93
  const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH';
28
94
  const body = requestData || (methodHasPayload ? '' : undefined);
29
- const fetchFn = this._fetchFn || fetch;
30
- const fetchPromise = fetchFn(url.toString(), {
95
+ const res = await this._fetchFn(url.toString(), {
31
96
  method,
32
97
  // @ts-ignore
33
98
  headers,
34
99
  // @ts-ignore
35
100
  body,
36
- });
37
- // The Fetch API does not support passing in a timeout natively, so a
38
- // timeout promise is constructed to race against the fetch and preempt the
39
- // request, simulating a timeout.
40
- //
41
- // This timeout behavior differs from Node:
42
- // - Fetch uses a single timeout for the entire length of the request.
43
- // - Node is more fine-grained and resets the timeout after each stage of
44
- // the request.
45
- //
46
- // As an example, if the timeout is set to 30s and the connection takes 20s
47
- // to be established followed by 20s for the body, Fetch would timeout but
48
- // Node would not. The more fine-grained timeout cannot be implemented with
49
- // fetch.
50
- let pendingTimeoutId;
51
- const timeoutPromise = new Promise((_, reject) => {
52
- pendingTimeoutId = setTimeout(() => {
53
- pendingTimeoutId = null;
54
- reject(HttpClient.makeTimeoutError());
55
- }, timeout);
56
- });
57
- return Promise.race([fetchPromise, timeoutPromise])
58
- .then((res) => {
59
- return new FetchHttpClientResponse(res);
60
- })
61
- .finally(() => {
62
- if (pendingTimeoutId) {
63
- clearTimeout(pendingTimeoutId);
64
- }
65
- });
101
+ }, timeout);
102
+ return new FetchHttpClientResponse(res);
66
103
  }
67
104
  }
68
105
  export class FetchHttpClientResponse extends HttpClientResponse {
@@ -31,13 +31,23 @@ const ALLOWED_CONFIG_PROPERTIES = [
31
31
  ];
32
32
  const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS);
33
33
  export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
34
- Stripe.PACKAGE_VERSION = '14.4.0';
34
+ Stripe.PACKAGE_VERSION = '14.5.0';
35
35
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties());
36
36
  Stripe.StripeResource = StripeResource;
37
37
  Stripe.resources = resources;
38
38
  Stripe.HttpClient = HttpClient;
39
39
  Stripe.HttpClientResponse = HttpClientResponse;
40
40
  Stripe.CryptoProvider = CryptoProvider;
41
+ // Previously Stripe.webhooks was just the createWebhooks() factory function
42
+ // however going forward it will be a WebhookObject instance. To maintain
43
+ // backwards compatibility it is currently a factory function that also
44
+ // complies to the WebhookObject signature. The factory function signature
45
+ // will be removed as a breaking change in the next major release.
46
+ // See https://github.com/stripe/stripe-node/issues/1956
47
+ function createWebhooksDefault(fns = platformFunctions) {
48
+ return createWebhooks(fns);
49
+ }
50
+ Stripe.webhooks = Object.assign(createWebhooksDefault, createWebhooks(platformFunctions));
41
51
  function Stripe(key, config = {}) {
42
52
  if (!(this instanceof Stripe)) {
43
53
  return new Stripe(key, config);
@@ -91,7 +101,9 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
91
101
  this._prepResources();
92
102
  this._setApiKey(key);
93
103
  this.errors = _Error;
94
- this.webhooks = createWebhooks(platformFunctions);
104
+ // Once Stripe.webhooks looses the factory function signature in a future release
105
+ // then this should become this.webhooks = Stripe.webhooks
106
+ this.webhooks = createWebhooksDefault();
95
107
  this._prevRequestMetrics = [];
96
108
  this._enableTelemetry = props.telemetry !== false;
97
109
  this._requestSender = requestSender(this);
@@ -100,7 +112,6 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
100
112
  this.StripeResource = Stripe.StripeResource;
101
113
  }
102
114
  Stripe.errors = _Error;
103
- Stripe.webhooks = createWebhooks;
104
115
  Stripe.createNodeHttpClient = platformFunctions.createNodeHttpClient;
105
116
  /**
106
117
  * Creates an HTTP client for issuing Stripe API requests which uses the Web
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "14.4.0",
3
+ "version": "14.5.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -1045,9 +1045,14 @@ declare module 'stripe' {
1045
1045
  namespace Settings {
1046
1046
  interface BacsDebitPayments {
1047
1047
  /**
1048
- * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct Debit, this will appear on the mandate, and as the statement descriptor.
1048
+ * The Bacs Direct Debit display name for this account. For payments made with Bacs Direct Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps display it as the name of the business. To use custom branding, set the Bacs Direct Debit Display Name during or right after creation. Custom branding incurs an additional monthly fee for the platform. The fee appears 5 business days after requesting Bacs. If you don't set the display name before requesting Bacs capability, it's automatically set as "Stripe" and the account is onboarded to Stripe branding, which is free.
1049
1049
  */
1050
- display_name?: string;
1050
+ display_name: string | null;
1051
+
1052
+ /**
1053
+ * The Bacs Direct Debit Service user number for this account. For payments made with Bacs Direct Debit, this number is a unique identifier of the account with our banking partners.
1054
+ */
1055
+ service_user_number: string | null;
1051
1056
  }
1052
1057
 
1053
1058
  interface Branding {
@@ -1060,6 +1060,11 @@ declare module 'stripe' {
1060
1060
  }
1061
1061
 
1062
1062
  interface Settings {
1063
+ /**
1064
+ * Settings specific to Bacs Direct Debit.
1065
+ */
1066
+ bacs_debit_payments?: Settings.BacsDebitPayments;
1067
+
1063
1068
  /**
1064
1069
  * Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products.
1065
1070
  */
@@ -1092,6 +1097,13 @@ declare module 'stripe' {
1092
1097
  }
1093
1098
 
1094
1099
  namespace Settings {
1100
+ interface BacsDebitPayments {
1101
+ /**
1102
+ * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps display it as the name of the business. To use custom branding, set the Bacs Direct Debit Display Name during or right after creation. Custom branding incurs an additional monthly fee for the platform. If you don't set the display name before requesting Bacs capability, it's automatically set as "Stripe" and the account is onboarded to Stripe branding, which is free.
1103
+ */
1104
+ display_name?: string;
1105
+ }
1106
+
1095
1107
  interface Branding {
1096
1108
  /**
1097
1109
  * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px.
@@ -2317,6 +2329,11 @@ declare module 'stripe' {
2317
2329
  }
2318
2330
 
2319
2331
  interface Settings {
2332
+ /**
2333
+ * Settings specific to Bacs Direct Debit payments.
2334
+ */
2335
+ bacs_debit_payments?: Settings.BacsDebitPayments;
2336
+
2320
2337
  /**
2321
2338
  * Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products.
2322
2339
  */
@@ -2349,6 +2366,13 @@ declare module 'stripe' {
2349
2366
  }
2350
2367
 
2351
2368
  namespace Settings {
2369
+ interface BacsDebitPayments {
2370
+ /**
2371
+ * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps display it as the name of the business. To use custom branding, set the Bacs Direct Debit Display Name during or right after creation. Custom branding incurs an additional monthly fee for the platform. If you don't set the display name before requesting Bacs capability, it's automatically set as "Stripe" and the account is onboarded to Stripe branding, which is free.
2372
+ */
2373
+ display_name?: string;
2374
+ }
2375
+
2352
2376
  interface Branding {
2353
2377
  /**
2354
2378
  * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px.
@@ -688,6 +688,11 @@ declare module 'stripe' {
688
688
  */
689
689
  brand: string | null;
690
690
 
691
+ /**
692
+ * When using manual capture, a future timestamp at which the charge will be automatically refunded if uncaptured.
693
+ */
694
+ capture_before?: number;
695
+
691
696
  /**
692
697
  * Check results by Card networks on Card address and CVC at time of payment.
693
698
  */
@@ -840,6 +840,8 @@ declare module 'stripe' {
840
840
 
841
841
  paynow?: PaymentMethodOptions.Paynow;
842
842
 
843
+ paypal?: PaymentMethodOptions.Paypal;
844
+
843
845
  pix?: PaymentMethodOptions.Pix;
844
846
 
845
847
  revolut_pay?: PaymentMethodOptions.RevolutPay;
@@ -1259,6 +1261,36 @@ declare module 'stripe' {
1259
1261
  setup_future_usage?: 'none';
1260
1262
  }
1261
1263
 
1264
+ interface Paypal {
1265
+ /**
1266
+ * Controls when the funds will be captured from the customer's account.
1267
+ */
1268
+ capture_method?: 'manual';
1269
+
1270
+ /**
1271
+ * Preferred locale of the PayPal checkout page that the customer is redirected to.
1272
+ */
1273
+ preferred_locale: string | null;
1274
+
1275
+ /**
1276
+ * A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID. This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID.
1277
+ */
1278
+ reference: string | null;
1279
+
1280
+ /**
1281
+ * Indicates that you intend to make future payments with this PaymentIntent's payment method.
1282
+ *
1283
+ * Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes.
1284
+ *
1285
+ * When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication).
1286
+ */
1287
+ setup_future_usage?: Paypal.SetupFutureUsage;
1288
+ }
1289
+
1290
+ namespace Paypal {
1291
+ type SetupFutureUsage = 'none' | 'off_session';
1292
+ }
1293
+
1262
1294
  interface Pix {
1263
1295
  /**
1264
1296
  * The number of seconds after which Pix payment will expire.
@@ -2219,6 +2219,11 @@ declare module 'stripe' {
2219
2219
  */
2220
2220
  payment_link?: string;
2221
2221
 
2222
+ /**
2223
+ * Only return the Checkout Sessions matching the given status.
2224
+ */
2225
+ status?: SessionListParams.Status;
2226
+
2222
2227
  /**
2223
2228
  * Only return the Checkout Session for the subscription specified.
2224
2229
  */
@@ -2232,6 +2237,8 @@ declare module 'stripe' {
2232
2237
  */
2233
2238
  email: string;
2234
2239
  }
2240
+
2241
+ type Status = 'complete' | 'expired' | 'open';
2235
2242
  }
2236
2243
 
2237
2244
  interface SessionExpireParams {
@@ -92,7 +92,12 @@ declare module 'stripe' {
92
92
  quantity?: number;
93
93
 
94
94
  /**
95
- * The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item`.
95
+ * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
96
+ */
97
+ tax_amounts?: Stripe.Emptyable<Array<Line.TaxAmount>>;
98
+
99
+ /**
100
+ * The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
96
101
  */
97
102
  tax_rates?: Stripe.Emptyable<Array<string>>;
98
103
 
@@ -113,6 +118,23 @@ declare module 'stripe' {
113
118
  }
114
119
 
115
120
  namespace Line {
121
+ interface TaxAmount {
122
+ /**
123
+ * The amount, in cents (or local equivalent), of the tax.
124
+ */
125
+ amount: number;
126
+
127
+ /**
128
+ * The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
129
+ */
130
+ tax_rate: string;
131
+
132
+ /**
133
+ * The amount on which tax is calculated, in cents (or local equivalent).
134
+ */
135
+ taxable_amount: number;
136
+ }
137
+
116
138
  type Type = 'custom_line_item' | 'invoice_line_item';
117
139
  }
118
140
 
@@ -268,7 +290,12 @@ declare module 'stripe' {
268
290
  quantity?: number;
269
291
 
270
292
  /**
271
- * The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item`.
293
+ * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
294
+ */
295
+ tax_amounts?: Stripe.Emptyable<Array<Line.TaxAmount>>;
296
+
297
+ /**
298
+ * The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
272
299
  */
273
300
  tax_rates?: Stripe.Emptyable<Array<string>>;
274
301
 
@@ -289,6 +316,23 @@ declare module 'stripe' {
289
316
  }
290
317
 
291
318
  namespace Line {
319
+ interface TaxAmount {
320
+ /**
321
+ * The amount, in cents (or local equivalent), of the tax.
322
+ */
323
+ amount: number;
324
+
325
+ /**
326
+ * The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
327
+ */
328
+ tax_rate: string;
329
+
330
+ /**
331
+ * The amount on which tax is calculated, in cents (or local equivalent).
332
+ */
333
+ taxable_amount: number;
334
+ }
335
+
292
336
  type Type = 'custom_line_item' | 'invoice_line_item';
293
337
  }
294
338
 
@@ -396,7 +440,12 @@ declare module 'stripe' {
396
440
  quantity?: number;
397
441
 
398
442
  /**
399
- * The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item`.
443
+ * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
444
+ */
445
+ tax_amounts?: Stripe.Emptyable<Array<Line.TaxAmount>>;
446
+
447
+ /**
448
+ * The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
400
449
  */
401
450
  tax_rates?: Stripe.Emptyable<Array<string>>;
402
451
 
@@ -417,6 +466,23 @@ declare module 'stripe' {
417
466
  }
418
467
 
419
468
  namespace Line {
469
+ interface TaxAmount {
470
+ /**
471
+ * The amount, in cents (or local equivalent), of the tax.
472
+ */
473
+ amount: number;
474
+
475
+ /**
476
+ * The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
477
+ */
478
+ tax_rate: string;
479
+
480
+ /**
481
+ * The amount on which tax is calculated, in cents (or local equivalent).
482
+ */
483
+ taxable_amount: number;
484
+ }
485
+
420
486
  type Type = 'custom_line_item' | 'invoice_line_item';
421
487
  }
422
488
 
@@ -88,6 +88,11 @@ declare module 'stripe' {
88
88
  */
89
89
  metadata: Stripe.Metadata;
90
90
 
91
+ /**
92
+ * Details about the transaction, such as processing dates, set by the card network.
93
+ */
94
+ network_data: Transaction.NetworkData | null;
95
+
91
96
  /**
92
97
  * Additional purchase information that is optionally provided by the merchant.
93
98
  */
@@ -179,6 +184,13 @@ declare module 'stripe' {
179
184
  url: string | null;
180
185
  }
181
186
 
187
+ interface NetworkData {
188
+ /**
189
+ * The date the transaction was processed by the card network. This can be different from the date the seller recorded the transaction depending on when the acquirer submits the transaction to the network.
190
+ */
191
+ processing_date: string | null;
192
+ }
193
+
182
194
  interface PurchaseDetails {
183
195
  /**
184
196
  * Information about the flight that was purchased with this transaction.
@@ -585,7 +585,7 @@ declare module 'stripe' {
585
585
  ): Promise<Stripe.Response<Stripe.Price>>;
586
586
 
587
587
  /**
588
- * Returns a list of your prices.
588
+ * Returns a list of your active prices. For the list of inactive prices, set active to false.
589
589
  */
590
590
  list(
591
591
  params?: PriceListParams,
package/types/Topups.d.ts CHANGED
@@ -71,7 +71,7 @@ declare module 'stripe' {
71
71
  metadata: Stripe.Metadata;
72
72
 
73
73
  /**
74
- * For most Stripe users, the source of every top-up is a bank account. This hash is then the [source object](https://stripe.com/docs/api#source_object) describing that bank account.
74
+ * The source field is deprecated. It might not always be present in the API response.
75
75
  */
76
76
  source: Stripe.Source | null;
77
77
 
package/types/index.d.ts CHANGED
@@ -233,6 +233,12 @@ declare module 'stripe' {
233
233
  export class Stripe {
234
234
  static Stripe: typeof Stripe;
235
235
 
236
+ // Actually has the signature `Stripe.Webhooks & ((platformFunctions?: PlatformFunctions) => Stripe.Webhooks)`
237
+ // However the factory function signature was never public in the typings and
238
+ // will be removed in the next major version so it is omitted
239
+ // See https://github.com/stripe/stripe-node/issues/1956
240
+ static webhooks: Stripe.Webhooks;
241
+
236
242
  constructor(apiKey: string, config?: Stripe.StripeConfig);
237
243
 
238
244
  StripeResource: Stripe.StripeResource;