stripe 8.221.0 → 9.1.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,34 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 9.1.0 - 2022-05-11
4
+ * [#1420](https://github.com/stripe/stripe-node/pull/1420) API Updates
5
+ * Add support for `description` on `CheckoutSessionCreateParams.subscription_data`, `SubscriptionCreateParams`, `SubscriptionUpdateParams`, and `Subscription`
6
+ * Add support for `consent_collection`, `payment_intent_data`, `shipping_options`, `submit_type`, and `tax_id_collection` on `PaymentLinkCreateParams` and `PaymentLink`
7
+ * Add support for `customer_creation` on `PaymentLinkCreateParams`, `PaymentLinkUpdateParams`, and `PaymentLink`
8
+ * Add support for `metadata` on `SubscriptionSchedule.phases[]`, `SubscriptionScheduleCreateParams.phases[]`, and `SubscriptionScheduleUpdateParams.phases[]`
9
+ * Add support for new value `billing_portal.session.created` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]`
10
+
11
+ ## 9.0.0 - 2022-05-09
12
+ 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.
13
+ (⚠️ = breaking changes):
14
+ * ⚠️[#1336](https://github.com/stripe/stripe-node/pull/1336) feat(http-client): retry closed connection errors
15
+ * [#1415](https://github.com/stripe/stripe-node/pull/1415) [#1417](https://github.com/stripe/stripe-node/pull/1417) API Updates
16
+ * ⚠️ Replace the legacy `Order` API with the new `Order` API.
17
+ * Resource modified: `Order`.
18
+ * New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
19
+ * Removed methods: `pay` and `return_order`
20
+ * Removed resources: `OrderItem` and `OrderReturn`
21
+ * Removed references from other resources: `Charge.order`
22
+ * Add support for `amount_discount`, `amount_tax`, and `product` on `LineItem`
23
+ * 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`
24
+
25
+ ## 8.222.0 - 2022-05-05
26
+ * [#1414](https://github.com/stripe/stripe-node/pull/1414) API Updates
27
+ * Add support for `default_price_data` on `ProductCreateParams`
28
+ * Add support for `default_price` on `ProductUpdateParams` and `Product`
29
+ * Add support for `instructions_email` on `RefundCreateParams` and `Refund`
30
+
31
+
3
32
  ## 8.221.0 - 2022-05-05
4
33
  * [#1413](https://github.com/stripe/stripe-node/pull/1413) API Updates
5
34
  * Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.221.0
1
+ 9.1.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 {
@@ -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'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "8.221.0",
3
+ "version": "9.1.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -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).
@@ -588,7 +588,7 @@ declare module 'stripe' {
588
588
  /**
589
589
  * Recipient name.
590
590
  */
591
- name?: string | null;
591
+ name?: string;
592
592
 
593
593
  /**
594
594
  * Recipient phone (including extension).
@@ -913,9 +913,8 @@ declare module 'stripe' {
913
913
  amount: number;
914
914
 
915
915
  /**
916
- * A discount represents the actual application of a coupon to a particular
917
- * customer. It contains information about when the discount began and when it
918
- * will end.
916
+ * A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes).
917
+ * It contains information about when the discount began, when it will end, and what it is applied to.
919
918
  *
920
919
  * Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts).
921
920
  */
@@ -2157,6 +2156,13 @@ declare module 'stripe' {
2157
2156
  */
2158
2157
  default_tax_rates?: Array<string>;
2159
2158
 
2159
+ /**
2160
+ * The subscription's description, meant to be displayable to the customer.
2161
+ * Use this field to optionally store an explanation of the subscription
2162
+ * for rendering in Stripe hosted surfaces.
2163
+ */
2164
+ description?: string;
2165
+
2160
2166
  /**
2161
2167
  * A list of items, each with an attached plan, that the customer is subscribing to. Prefer using `line_items`.
2162
2168
  */
@@ -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).
@@ -23,8 +23,8 @@ declare module 'stripe' {
23
23
 
24
24
  /**
25
25
  * A coupon contains information about a percent-off or amount-off discount you
26
- * might want to apply to a customer. Coupons may be applied to [invoices](https://stripe.com/docs/api#invoices) or
27
- * [orders](https://stripe.com/docs/api#create_order_legacy-coupon). Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge).
26
+ * might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
27
+ * [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
28
28
  */
29
29
  coupon: Stripe.Coupon;
30
30
 
@@ -87,8 +87,8 @@ declare module 'stripe' {
87
87
 
88
88
  /**
89
89
  * A coupon contains information about a percent-off or amount-off discount you
90
- * might want to apply to a customer. Coupons may be applied to [invoices](https://stripe.com/docs/api#invoices) or
91
- * [orders](https://stripe.com/docs/api#create_order_legacy-coupon). Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge).
90
+ * might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
91
+ * [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
92
92
  */
93
93
  coupon: Stripe.Coupon;
94
94
 
@@ -401,7 +401,7 @@ declare module 'stripe' {
401
401
  /**
402
402
  * Recipient name.
403
403
  */
404
- name?: string | null;
404
+ name?: string;
405
405
 
406
406
  /**
407
407
  * Recipient phone (including extension).
@@ -16,11 +16,21 @@ declare module 'stripe' {
16
16
  */
17
17
  object: 'item';
18
18
 
19
+ /**
20
+ * Total discount amount applied. If no discounts were applied, defaults to 0.
21
+ */
22
+ amount_discount?: number;
23
+
19
24
  /**
20
25
  * Total before any discounts or taxes are applied.
21
26
  */
22
27
  amount_subtotal: number;
23
28
 
29
+ /**
30
+ * Total tax amount applied. If no tax was applied, defaults to 0.
31
+ */
32
+ amount_tax?: number;
33
+
24
34
  /**
25
35
  * Total after discounts and taxes.
26
36
  */
@@ -46,6 +56,13 @@ declare module 'stripe' {
46
56
  */
47
57
  price: Stripe.Price | null;
48
58
 
59
+ /**
60
+ * The ID of the product for this line item.
61
+ *
62
+ * This will always be the same as `price.product`.
63
+ */
64
+ product?: string | Stripe.Product | Stripe.DeletedProduct;
65
+
49
66
  /**
50
67
  * The quantity of products being purchased.
51
68
  */
@@ -65,9 +82,8 @@ declare module 'stripe' {
65
82
  amount: number;
66
83
 
67
84
  /**
68
- * A discount represents the actual application of a coupon to a particular
69
- * customer. It contains information about when the discount began and when it
70
- * will end.
85
+ * A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes).
86
+ * It contains information about when the discount began, when it will end, and what it is applied to.
71
87
  *
72
88
  * Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts).
73
89
  */