stripe 8.220.0 → 9.0.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 (35) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/VERSION +1 -1
  3. package/lib/StripeResource.js +10 -2
  4. package/lib/net/HttpClient.js +1 -0
  5. package/lib/resources/FinancialConnections/Accounts.js +25 -0
  6. package/lib/resources/{OrderReturns.js → FinancialConnections/Sessions.js} +7 -8
  7. package/lib/resources/Orders.js +15 -4
  8. package/lib/resources.js +4 -1
  9. package/package.json +1 -1
  10. package/types/2020-08-27/Accounts.d.ts +18 -0
  11. package/types/2020-08-27/Charges.d.ts +1 -6
  12. package/types/2020-08-27/Checkout/Sessions.d.ts +43 -1
  13. package/types/2020-08-27/Customers.d.ts +1 -1
  14. package/types/2020-08-27/FinancialConnections/AccountOwners.d.ts +52 -0
  15. package/types/2020-08-27/FinancialConnections/AccountOwnerships.d.ts +32 -0
  16. package/types/2020-08-27/FinancialConnections/Accounts.d.ts +311 -0
  17. package/types/2020-08-27/FinancialConnections/Sessions.d.ts +185 -0
  18. package/types/2020-08-27/Invoices.d.ts +54 -1
  19. package/types/2020-08-27/Issuing/Cardholders.d.ts +1 -1
  20. package/types/2020-08-27/Issuing/Cards.d.ts +1 -1
  21. package/types/2020-08-27/LineItems.d.ts +17 -0
  22. package/types/2020-08-27/Orders.d.ts +2683 -310
  23. package/types/2020-08-27/PaymentIntents.d.ts +114 -2
  24. package/types/2020-08-27/PaymentMethods.d.ts +10 -0
  25. package/types/2020-08-27/Persons.d.ts +20 -0
  26. package/types/2020-08-27/Products.d.ts +62 -0
  27. package/types/2020-08-27/Refunds.d.ts +7 -0
  28. package/types/2020-08-27/SetupIntents.d.ts +1539 -14
  29. package/types/2020-08-27/Sources.d.ts +1 -1
  30. package/types/2020-08-27/Subscriptions.d.ts +53 -0
  31. package/types/2020-08-27/Tokens.d.ts +19 -0
  32. package/types/2020-08-27/WebhookEndpoints.d.ts +0 -6
  33. package/types/2020-08-27/index.d.ts +8 -3
  34. package/types/2020-08-27/OrderItems.d.ts +0 -45
  35. package/types/2020-08-27/OrderReturns.d.ts +0 -103
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 9.0.0 - 2022-05-09
4
+ Major version release - The [migration guide](https://github.com/stripe/stripe-node/wiki/Migration-Guide-for-v9) contains a detailed list of backwards-incompatible changes with upgrade instructions.
5
+ (⚠️ = breaking changes):
6
+ * ⚠️[#1336](https://github.com/stripe/stripe-node/pull/1336) feat(http-client): retry closed connection errors
7
+ * [#1415](https://github.com/stripe/stripe-node/pull/1415) [#1417](https://github.com/stripe/stripe-node/pull/1417) API Updates
8
+ * ⚠️ Replace the legacy `Order` API with the new `Order` API.
9
+ * Resource modified: `Order`.
10
+ * New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
11
+ * Removed methods: `pay` and `return_order`
12
+ * Removed resources: `OrderItem` and `OrderReturn`
13
+ * Removed references from other resources: `Charge.order`
14
+ * Add support for `amount_discount`, `amount_tax`, and `product` on `LineItem`
15
+ * Change type of `Charge.shipping.name`, `Checkout.Session.shipping.name`, `Customer.shipping.name`, `Invoice.customer_shipping.name`, `PaymentIntent.shipping.name`, `ShippingDetails.name`, and `Source.source_order.shipping.name` from `nullable(string)` to `string`
16
+
17
+ ## 8.222.0 - 2022-05-05
18
+ * [#1414](https://github.com/stripe/stripe-node/pull/1414) API Updates
19
+ * Add support for `default_price_data` on `ProductCreateParams`
20
+ * Add support for `default_price` on `ProductUpdateParams` and `Product`
21
+ * Add support for `instructions_email` on `RefundCreateParams` and `Refund`
22
+
23
+
24
+ ## 8.221.0 - 2022-05-05
25
+ * [#1413](https://github.com/stripe/stripe-node/pull/1413) API Updates
26
+ * Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
27
+ * Add support for `financial_connections` on `Checkout.Session.payment_method_options.us_bank_account`, `CheckoutSessionCreateParams.payment_method_options.us_bank_account`, `Invoice.payment_settings.payment_method_options.us_bank_account`, `InvoiceCreateParams.payment_settings.payment_method_options.us_bank_account`, `InvoiceUpdateParams.payment_settings.payment_method_options.us_bank_account`, `PaymentIntent.payment_method_options.us_bank_account`, `PaymentIntentConfirmParams.payment_method_options.us_bank_account`, `PaymentIntentCreateParams.payment_method_options.us_bank_account`, `PaymentIntentUpdateParams.payment_method_options.us_bank_account`, `SetupIntent.payment_method_options.us_bank_account`, `SetupIntentConfirmParams.payment_method_options.us_bank_account`, `SetupIntentCreateParams.payment_method_options.us_bank_account`, `SetupIntentUpdateParams.payment_method_options.us_bank_account`, `Subscription.payment_settings.payment_method_options.us_bank_account`, `SubscriptionCreateParams.payment_settings.payment_method_options.us_bank_account`, and `SubscriptionUpdateParams.payment_settings.payment_method_options.us_bank_account`
28
+ * Add support for `financial_connections_account` on `PaymentIntentConfirmParams.payment_method_data.us_bank_account`, `PaymentIntentCreateParams.payment_method_data.us_bank_account`, `PaymentIntentUpdateParams.payment_method_data.us_bank_account`, `PaymentMethod.us_bank_account`, `PaymentMethodCreateParams.us_bank_account`, `SetupIntentConfirmParams.payment_method_data.us_bank_account`, `SetupIntentCreateParams.payment_method_data.us_bank_account`, and `SetupIntentUpdateParams.payment_method_data.us_bank_account`
29
+
30
+ * [#1410](https://github.com/stripe/stripe-node/pull/1410) API Updates
31
+ * Add support for `registered_address` on `AccountCreateParams.individual`, `AccountUpdateParams.individual`, `PersonCreateParams`, `PersonUpdateParams`, `Person`, `TokenCreateParams.account.individual`, and `TokenCreateParams.person`
32
+ * Change type of `PaymentIntent.amount_details.tip.amount` from `nullable(integer)` to `integer`
33
+ * Change `PaymentIntent.amount_details.tip.amount` to be optional
34
+ * Add support for `payment_method_data` on `SetupIntentConfirmParams`, `SetupIntentCreateParams`, and `SetupIntentUpdateParams`
35
+ * [#1409](https://github.com/stripe/stripe-node/pull/1409) Update autoPagination tests to be hermetic.
36
+ * [#1411](https://github.com/stripe/stripe-node/pull/1411) Enable CI on beta branch
37
+
3
38
  ## 8.220.0 - 2022-05-03
4
39
  * [#1407](https://github.com/stripe/stripe-node/pull/1407) API Updates
5
40
  * Add support for new resource `CashBalance`
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.220.0
1
+ 9.0.0
@@ -273,7 +273,15 @@ StripeResource.prototype = {
273
273
  },
274
274
 
275
275
  // For more on when and how to retry API requests, see https://stripe.com/docs/error-handling#safely-retrying-requests-with-idempotency
276
- _shouldRetry(res, numRetries, maxRetries) {
276
+ _shouldRetry(res, numRetries, maxRetries, error) {
277
+ if (
278
+ error &&
279
+ numRetries === 0 &&
280
+ HttpClient.CONNECTION_CLOSED_ERROR_CODES.includes(error.code)
281
+ ) {
282
+ return true;
283
+ }
284
+
277
285
  // Do not retry if we are out of retries.
278
286
  if (numRetries >= maxRetries) {
279
287
  return false;
@@ -529,7 +537,7 @@ StripeResource.prototype = {
529
537
  }
530
538
  })
531
539
  .catch((error) => {
532
- if (this._shouldRetry(null, requestRetries, maxRetries)) {
540
+ if (this._shouldRetry(null, requestRetries, maxRetries, error)) {
533
541
  return retryRequest(
534
542
  makeRequest,
535
543
  apiVersion,
@@ -31,6 +31,7 @@ class HttpClient {
31
31
  }
32
32
  }
33
33
 
34
+ HttpClient.CONNECTION_CLOSED_ERROR_CODES = ['ECONNRESET', 'EPIPE'];
34
35
  HttpClient.TIMEOUT_ERROR_CODE = 'ETIMEDOUT';
35
36
 
36
37
  class HttpClientResponse {
@@ -0,0 +1,25 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ 'use strict';
4
+
5
+ const StripeResource = require('../../StripeResource');
6
+ const stripeMethod = StripeResource.method;
7
+
8
+ module.exports = StripeResource.extend({
9
+ path: 'financial_connections/accounts',
10
+
11
+ retrieve: stripeMethod({
12
+ method: 'GET',
13
+ path: '/{account}',
14
+ }),
15
+
16
+ disconnect: stripeMethod({
17
+ method: 'POST',
18
+ path: '/{account}/disconnect',
19
+ }),
20
+
21
+ refresh: stripeMethod({
22
+ method: 'POST',
23
+ path: '/{account}/refresh',
24
+ }),
25
+ });
@@ -2,20 +2,19 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- const StripeResource = require('../StripeResource');
5
+ const StripeResource = require('../../StripeResource');
6
6
  const stripeMethod = StripeResource.method;
7
7
 
8
8
  module.exports = StripeResource.extend({
9
- path: 'order_returns',
9
+ path: 'financial_connections/sessions',
10
10
 
11
- retrieve: stripeMethod({
12
- method: 'GET',
13
- path: '/{id}',
11
+ create: stripeMethod({
12
+ method: 'POST',
13
+ path: '',
14
14
  }),
15
15
 
16
- list: stripeMethod({
16
+ retrieve: stripeMethod({
17
17
  method: 'GET',
18
- path: '',
19
- methodType: 'list',
18
+ path: '/{session}',
20
19
  }),
21
20
  });
@@ -29,13 +29,24 @@ module.exports = StripeResource.extend({
29
29
  methodType: 'list',
30
30
  }),
31
31
 
32
- pay: stripeMethod({
32
+ cancel: stripeMethod({
33
33
  method: 'POST',
34
- path: '/{id}/pay',
34
+ path: '/{id}/cancel',
35
35
  }),
36
36
 
37
- returnOrder: stripeMethod({
37
+ listLineItems: stripeMethod({
38
+ method: 'GET',
39
+ path: '/{id}/line_items',
40
+ methodType: 'list',
41
+ }),
42
+
43
+ reopen: stripeMethod({
44
+ method: 'POST',
45
+ path: '/{id}/reopen',
46
+ }),
47
+
48
+ submit: stripeMethod({
38
49
  method: 'POST',
39
- path: '/{id}/returns',
50
+ path: '/{id}/submit',
40
51
  }),
41
52
  });
package/lib/resources.js CHANGED
@@ -30,7 +30,6 @@ module.exports = {
30
30
  Mandates: require('./resources/Mandates'),
31
31
  OAuth: require('./resources/OAuth'),
32
32
  Orders: require('./resources/Orders'),
33
- OrderReturns: require('./resources/OrderReturns'),
34
33
  PaymentIntents: require('./resources/PaymentIntents'),
35
34
  PaymentLinks: require('./resources/PaymentLinks'),
36
35
  PaymentMethods: require('./resources/PaymentMethods'),
@@ -63,6 +62,10 @@ module.exports = {
63
62
  Checkout: resourceNamespace('checkout', {
64
63
  Sessions: require('./resources/Checkout/Sessions'),
65
64
  }),
65
+ FinancialConnections: resourceNamespace('financialConnections', {
66
+ Accounts: require('./resources/FinancialConnections/Accounts'),
67
+ Sessions: require('./resources/FinancialConnections/Sessions'),
68
+ }),
66
69
  Identity: resourceNamespace('identity', {
67
70
  VerificationReports: require('./resources/Identity/VerificationReports'),
68
71
  VerificationSessions: require('./resources/Identity/VerificationSessions'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "8.220.0",
3
+ "version": "9.0.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -1899,6 +1899,11 @@ declare module 'stripe' {
1899
1899
  */
1900
1900
  political_exposure?: Individual.PoliticalExposure;
1901
1901
 
1902
+ /**
1903
+ * The individual's registered address.
1904
+ */
1905
+ registered_address?: Individual.RegisteredAddress;
1906
+
1902
1907
  /**
1903
1908
  * The last four digits of the individual's Social Security Number (U.S. only).
1904
1909
  */
@@ -1934,6 +1939,10 @@ declare module 'stripe' {
1934
1939
 
1935
1940
  type PoliticalExposure = 'existing' | 'none';
1936
1941
 
1942
+ interface RegisteredAddress extends Omit<Stripe.AddressParam, 'line1'> {
1943
+ line1?: string;
1944
+ }
1945
+
1937
1946
  interface Verification {
1938
1947
  /**
1939
1948
  * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.
@@ -2980,6 +2989,11 @@ declare module 'stripe' {
2980
2989
  */
2981
2990
  political_exposure?: Individual.PoliticalExposure;
2982
2991
 
2992
+ /**
2993
+ * The individual's registered address.
2994
+ */
2995
+ registered_address?: Individual.RegisteredAddress;
2996
+
2983
2997
  /**
2984
2998
  * The last four digits of the individual's Social Security Number (U.S. only).
2985
2999
  */
@@ -3015,6 +3029,10 @@ declare module 'stripe' {
3015
3029
 
3016
3030
  type PoliticalExposure = 'existing' | 'none';
3017
3031
 
3032
+ interface RegisteredAddress extends Omit<Stripe.AddressParam, 'line1'> {
3033
+ line1?: string;
3034
+ }
3035
+
3018
3036
  interface Verification {
3019
3037
  /**
3020
3038
  * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.
@@ -147,11 +147,6 @@ declare module 'stripe' {
147
147
  */
148
148
  on_behalf_of: string | Stripe.Account | null;
149
149
 
150
- /**
151
- * ID of the order this charge is for if one exists.
152
- */
153
- order: string | Stripe.Order | null;
154
-
155
150
  /**
156
151
  * Details about whether the payment was accepted, and why. See [understanding declines](https://stripe.com/docs/declines) for details.
157
152
  */
@@ -1723,7 +1718,7 @@ declare module 'stripe' {
1723
1718
  /**
1724
1719
  * Recipient name.
1725
1720
  */
1726
- name?: string | null;
1721
+ name?: string;
1727
1722
 
1728
1723
  /**
1729
1724
  * Recipient phone (including extension).
@@ -535,6 +535,8 @@ declare module 'stripe' {
535
535
  }
536
536
 
537
537
  interface UsBankAccount {
538
+ financial_connections?: UsBankAccount.FinancialConnections;
539
+
538
540
  /**
539
541
  * Bank account verification method.
540
542
  */
@@ -542,6 +544,26 @@ declare module 'stripe' {
542
544
  }
543
545
 
544
546
  namespace UsBankAccount {
547
+ interface FinancialConnections {
548
+ /**
549
+ * The list of permissions to request. The `payment_method` permission must be included.
550
+ */
551
+ permissions?: Array<FinancialConnections.Permission>;
552
+
553
+ /**
554
+ * For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
555
+ */
556
+ return_url?: string;
557
+ }
558
+
559
+ namespace FinancialConnections {
560
+ type Permission =
561
+ | 'balances'
562
+ | 'ownership'
563
+ | 'payment_method'
564
+ | 'transactions';
565
+ }
566
+
545
567
  type VerificationMethod = 'automatic' | 'instant';
546
568
  }
547
569
  }
@@ -566,7 +588,7 @@ declare module 'stripe' {
566
588
  /**
567
589
  * Recipient name.
568
590
  */
569
- name?: string | null;
591
+ name?: string;
570
592
 
571
593
  /**
572
594
  * Recipient phone (including extension).
@@ -1658,6 +1680,11 @@ declare module 'stripe' {
1658
1680
  }
1659
1681
 
1660
1682
  interface UsBankAccount {
1683
+ /**
1684
+ * Additional fields for Financial Connections Session creation
1685
+ */
1686
+ financial_connections?: UsBankAccount.FinancialConnections;
1687
+
1661
1688
  /**
1662
1689
  * Verification method for the intent
1663
1690
  */
@@ -1665,6 +1692,21 @@ declare module 'stripe' {
1665
1692
  }
1666
1693
 
1667
1694
  namespace UsBankAccount {
1695
+ interface FinancialConnections {
1696
+ /**
1697
+ * The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `payment_method`, and `transactions`.
1698
+ */
1699
+ permissions?: Array<FinancialConnections.Permission>;
1700
+ }
1701
+
1702
+ namespace FinancialConnections {
1703
+ type Permission =
1704
+ | 'balances'
1705
+ | 'ownership'
1706
+ | 'payment_method'
1707
+ | 'transactions';
1708
+ }
1709
+
1668
1710
  type VerificationMethod = 'automatic' | 'instant';
1669
1711
  }
1670
1712
 
@@ -185,7 +185,7 @@ declare module 'stripe' {
185
185
  /**
186
186
  * Recipient name.
187
187
  */
188
- name?: string | null;
188
+ name?: string;
189
189
 
190
190
  /**
191
191
  * Recipient phone (including extension).
@@ -0,0 +1,52 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace FinancialConnections {
6
+ /**
7
+ * The AccountOwner object.
8
+ */
9
+ interface AccountOwner {
10
+ /**
11
+ * Unique identifier for the object.
12
+ */
13
+ id: string;
14
+
15
+ /**
16
+ * String representing the object's type. Objects of the same type share the same value.
17
+ */
18
+ object: 'financial_connections.account_owner';
19
+
20
+ /**
21
+ * The email address of the owner.
22
+ */
23
+ email: string | null;
24
+
25
+ /**
26
+ * The full name of the owner.
27
+ */
28
+ name: string;
29
+
30
+ /**
31
+ * The ownership object that this owner belongs to.
32
+ */
33
+ ownership: string;
34
+
35
+ /**
36
+ * The raw phone number of the owner.
37
+ */
38
+ phone: string | null;
39
+
40
+ /**
41
+ * The raw physical address of the owner.
42
+ */
43
+ raw_address: string | null;
44
+
45
+ /**
46
+ * The timestamp of the refresh that updated this owner.
47
+ */
48
+ refreshed_at: number | null;
49
+ }
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,32 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace FinancialConnections {
6
+ /**
7
+ * The AccountOwnership object.
8
+ */
9
+ interface AccountOwnership {
10
+ /**
11
+ * Unique identifier for the object.
12
+ */
13
+ id: string;
14
+
15
+ /**
16
+ * String representing the object's type. Objects of the same type share the same value.
17
+ */
18
+ object: 'financial_connections.account_ownership';
19
+
20
+ /**
21
+ * Time at which the object was created. Measured in seconds since the Unix epoch.
22
+ */
23
+ created: number;
24
+
25
+ /**
26
+ * A paginated list of owners for this account.
27
+ */
28
+ owners: ApiList<Stripe.FinancialConnections.AccountOwner>;
29
+ }
30
+ }
31
+ }
32
+ }