stripe 8.188.0 → 8.189.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,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 8.189.0 - 2021-11-16
4
+ * [#1295](https://github.com/stripe/stripe-node/pull/1295) API Updates
5
+ * Add support for new resource `ShippingRate`
6
+ * Add support for `shipping_options` on `CheckoutSessionCreateParams` and `Checkout.Session`
7
+ * Add support for `shipping_rate` on `Checkout.Session`
8
+
3
9
  ## 8.188.0 - 2021-11-12
4
10
  * [#1293](https://github.com/stripe/stripe-node/pull/1293) API Updates
5
11
  * Add support for new value `agrobank` on enums `Charge.payment_method_details.fpx.bank`, `PaymentIntentCreateParams.payment_method_data.fpx.bank`, `PaymentIntentUpdateParams.payment_method_data.fpx.bank`, `PaymentIntentConfirmParams.payment_method_data.fpx.bank`, `PaymentMethodCreateParams.fpx.bank`, and `PaymentMethod.fpx.bank`
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.188.0
1
+ 8.189.0
@@ -0,0 +1,31 @@
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: 'shipping_rates',
10
+
11
+ create: stripeMethod({
12
+ method: 'POST',
13
+ path: '',
14
+ }),
15
+
16
+ retrieve: stripeMethod({
17
+ method: 'GET',
18
+ path: '/{shippingRateToken}',
19
+ }),
20
+
21
+ update: stripeMethod({
22
+ method: 'POST',
23
+ path: '/{shippingRateToken}',
24
+ }),
25
+
26
+ list: stripeMethod({
27
+ method: 'GET',
28
+ path: '',
29
+ methodType: 'list',
30
+ }),
31
+ });
package/lib/resources.js CHANGED
@@ -43,6 +43,7 @@ module.exports = {
43
43
  Reviews: require('./resources/Reviews'),
44
44
  SetupAttempts: require('./resources/SetupAttempts'),
45
45
  SetupIntents: require('./resources/SetupIntents'),
46
+ ShippingRates: require('./resources/ShippingRates'),
46
47
  Skus: require('./resources/SKUs'),
47
48
  Sources: require('./resources/Sources'),
48
49
  Subscriptions: require('./resources/Subscriptions'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "8.188.0",
3
+ "version": "8.189.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -1668,7 +1668,7 @@ declare module 'stripe' {
1668
1668
  application_fee_amount?: number;
1669
1669
 
1670
1670
  /**
1671
- * Whether to immediately capture the charge. Defaults to `true`. When `false`, the charge issues an authorization (or pre-authorization), and will need to be [captured](https://stripe.com/docs/api#capture_charge) later. Uncaptured charges expire in _seven days_. For more information, see the [authorizing charges and settling later](https://stripe.com/docs/charges/placing-a-hold) documentation.
1671
+ * Whether to immediately capture the charge. Defaults to `true`. When `false`, the charge issues an authorization (or pre-authorization), and will need to be [captured](https://stripe.com/docs/api#capture_charge) later. Uncaptured charges expire after a set number of days (7 by default). For more information, see the [authorizing charges and settling later](https://stripe.com/docs/charges/placing-a-hold) documentation.
1672
1672
  */
1673
1673
  capture?: boolean;
1674
1674
 
@@ -2018,7 +2018,7 @@ declare module 'stripe' {
2018
2018
  /**
2019
2019
  * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you [created a charge](https://stripe.com/docs/api#create_charge) with the capture option set to false.
2020
2020
  *
2021
- * Uncaptured payments expire exactly seven days after they are created. If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.
2021
+ * Uncaptured payments expire a set number of days after they are created ([7 by default](https://stripe.com/docs/charges/placing-a-hold)). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.
2022
2022
  */
2023
2023
  capture(
2024
2024
  id: string,
@@ -169,6 +169,16 @@ declare module 'stripe' {
169
169
  */
170
170
  shipping_address_collection: Session.ShippingAddressCollection | null;
171
171
 
172
+ /**
173
+ * The shipping rate options applied to this Session.
174
+ */
175
+ shipping_options: Array<Session.ShippingOption>;
176
+
177
+ /**
178
+ * The ID of the ShippingRate for Checkout Sessions in `payment` mode.
179
+ */
180
+ shipping_rate: string | Stripe.ShippingRate | null;
181
+
172
182
  /**
173
183
  * The status of the Checkout Session, one of `open`, `complete`, or `expired`.
174
184
  */
@@ -763,6 +773,18 @@ declare module 'stripe' {
763
773
  | 'ZZ';
764
774
  }
765
775
 
776
+ interface ShippingOption {
777
+ /**
778
+ * A non-negative integer in cents representing how much to charge.
779
+ */
780
+ shipping_amount: number;
781
+
782
+ /**
783
+ * The shipping rate.
784
+ */
785
+ shipping_rate: string | Stripe.ShippingRate;
786
+ }
787
+
766
788
  type Status = 'complete' | 'expired' | 'open';
767
789
 
768
790
  type SubmitType = 'auto' | 'book' | 'donate' | 'pay';
@@ -995,7 +1017,12 @@ declare module 'stripe' {
995
1017
  shipping_address_collection?: SessionCreateParams.ShippingAddressCollection;
996
1018
 
997
1019
  /**
998
- * The shipping rate to apply to this Session. Currently, only up to one may be specified.
1020
+ * The shipping rate options to apply to this Session.
1021
+ */
1022
+ shipping_options?: Array<SessionCreateParams.ShippingOption>;
1023
+
1024
+ /**
1025
+ * [Deprecated] The shipping rate to apply to this Session. Only up to one may be specified.
999
1026
  */
1000
1027
  shipping_rates?: Array<string>;
1001
1028
 
@@ -1849,6 +1876,119 @@ declare module 'stripe' {
1849
1876
  | 'ZZ';
1850
1877
  }
1851
1878
 
1879
+ interface ShippingOption {
1880
+ /**
1881
+ * The ID of the Shipping Rate to use for this shipping option.
1882
+ */
1883
+ shipping_rate?: string;
1884
+
1885
+ /**
1886
+ * Parameters to be passed to Shipping Rate creation for this shipping option
1887
+ */
1888
+ shipping_rate_data?: ShippingOption.ShippingRateData;
1889
+ }
1890
+
1891
+ namespace ShippingOption {
1892
+ interface ShippingRateData {
1893
+ /**
1894
+ * The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
1895
+ */
1896
+ delivery_estimate?: ShippingRateData.DeliveryEstimate;
1897
+
1898
+ /**
1899
+ * The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
1900
+ */
1901
+ display_name: string;
1902
+
1903
+ /**
1904
+ * Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`.
1905
+ */
1906
+ fixed_amount?: ShippingRateData.FixedAmount;
1907
+
1908
+ /**
1909
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
1910
+ */
1911
+ metadata?: Stripe.MetadataParam;
1912
+
1913
+ /**
1914
+ * Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
1915
+ */
1916
+ tax_behavior?: ShippingRateData.TaxBehavior;
1917
+
1918
+ /**
1919
+ * A [tax code](https://stripe.com/docs/tax/tax-codes) ID. The Shipping tax code is `txcd_92010001`.
1920
+ */
1921
+ tax_code?: string;
1922
+
1923
+ /**
1924
+ * The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now.
1925
+ */
1926
+ type?: 'fixed_amount';
1927
+ }
1928
+
1929
+ namespace ShippingRateData {
1930
+ interface DeliveryEstimate {
1931
+ /**
1932
+ * The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
1933
+ */
1934
+ maximum?: DeliveryEstimate.Maximum;
1935
+
1936
+ /**
1937
+ * The lower bound of the estimated range. If empty, represents no lower bound.
1938
+ */
1939
+ minimum?: DeliveryEstimate.Minimum;
1940
+ }
1941
+
1942
+ namespace DeliveryEstimate {
1943
+ interface Maximum {
1944
+ /**
1945
+ * A unit of time.
1946
+ */
1947
+ unit: Maximum.Unit;
1948
+
1949
+ /**
1950
+ * Must be greater than 0.
1951
+ */
1952
+ value: number;
1953
+ }
1954
+
1955
+ namespace Maximum {
1956
+ type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
1957
+ }
1958
+
1959
+ interface Minimum {
1960
+ /**
1961
+ * A unit of time.
1962
+ */
1963
+ unit: Minimum.Unit;
1964
+
1965
+ /**
1966
+ * Must be greater than 0.
1967
+ */
1968
+ value: number;
1969
+ }
1970
+
1971
+ namespace Minimum {
1972
+ type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
1973
+ }
1974
+ }
1975
+
1976
+ interface FixedAmount {
1977
+ /**
1978
+ * A non-negative integer in cents representing how much to charge.
1979
+ */
1980
+ amount: number;
1981
+
1982
+ /**
1983
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1984
+ */
1985
+ currency: string;
1986
+ }
1987
+
1988
+ type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
1989
+ }
1990
+ }
1991
+
1852
1992
  type SubmitType = 'auto' | 'book' | 'donate' | 'pay';
1853
1993
 
1854
1994
  interface SubscriptionData {
@@ -3793,7 +3793,7 @@ declare module 'stripe' {
3793
3793
  /**
3794
3794
  * Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
3795
3795
  *
3796
- * Uncaptured PaymentIntents will be canceled exactly seven days after they are created.
3796
+ * Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by default).
3797
3797
  *
3798
3798
  * Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
3799
3799
  */
@@ -0,0 +1,320 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ /**
6
+ * The ShippingRate object.
7
+ */
8
+ interface ShippingRate {
9
+ /**
10
+ * Unique identifier for the object.
11
+ */
12
+ id: string;
13
+
14
+ /**
15
+ * String representing the object's type. Objects of the same type share the same value.
16
+ */
17
+ object: 'shipping_rate';
18
+
19
+ /**
20
+ * Whether the shipping rate can be used for new purchases. Defaults to `true`.
21
+ */
22
+ active: boolean;
23
+
24
+ /**
25
+ * Time at which the object was created. Measured in seconds since the Unix epoch.
26
+ */
27
+ created: number;
28
+
29
+ /**
30
+ * The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
31
+ */
32
+ delivery_estimate: ShippingRate.DeliveryEstimate | null;
33
+
34
+ /**
35
+ * The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
36
+ */
37
+ display_name: string | null;
38
+
39
+ fixed_amount?: ShippingRate.FixedAmount;
40
+
41
+ /**
42
+ * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
43
+ */
44
+ livemode: boolean;
45
+
46
+ /**
47
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
48
+ */
49
+ metadata: Stripe.Metadata;
50
+
51
+ /**
52
+ * Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
53
+ */
54
+ tax_behavior: ShippingRate.TaxBehavior | null;
55
+
56
+ /**
57
+ * A [tax code](https://stripe.com/docs/tax/tax-codes) ID. The Shipping tax code is `txcd_92010001`.
58
+ */
59
+ tax_code: string | Stripe.TaxCode | null;
60
+
61
+ /**
62
+ * The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now.
63
+ */
64
+ type: 'fixed_amount';
65
+ }
66
+
67
+ namespace ShippingRate {
68
+ interface DeliveryEstimate {
69
+ /**
70
+ * The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
71
+ */
72
+ maximum: DeliveryEstimate.Maximum | null;
73
+
74
+ /**
75
+ * The lower bound of the estimated range. If empty, represents no lower bound.
76
+ */
77
+ minimum: DeliveryEstimate.Minimum | null;
78
+ }
79
+
80
+ namespace DeliveryEstimate {
81
+ interface Maximum {
82
+ /**
83
+ * A unit of time.
84
+ */
85
+ unit: Maximum.Unit;
86
+
87
+ /**
88
+ * Must be greater than 0.
89
+ */
90
+ value: number;
91
+ }
92
+
93
+ namespace Maximum {
94
+ type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
95
+ }
96
+
97
+ interface Minimum {
98
+ /**
99
+ * A unit of time.
100
+ */
101
+ unit: Minimum.Unit;
102
+
103
+ /**
104
+ * Must be greater than 0.
105
+ */
106
+ value: number;
107
+ }
108
+
109
+ namespace Minimum {
110
+ type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
111
+ }
112
+ }
113
+
114
+ interface FixedAmount {
115
+ /**
116
+ * A non-negative integer in cents representing how much to charge.
117
+ */
118
+ amount: number;
119
+
120
+ /**
121
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
122
+ */
123
+ currency: string;
124
+ }
125
+
126
+ type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
127
+ }
128
+
129
+ interface ShippingRateCreateParams {
130
+ /**
131
+ * The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
132
+ */
133
+ display_name: string;
134
+
135
+ /**
136
+ * The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
137
+ */
138
+ delivery_estimate?: ShippingRateCreateParams.DeliveryEstimate;
139
+
140
+ /**
141
+ * Specifies which fields in the response should be expanded.
142
+ */
143
+ expand?: Array<string>;
144
+
145
+ /**
146
+ * Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`.
147
+ */
148
+ fixed_amount?: ShippingRateCreateParams.FixedAmount;
149
+
150
+ /**
151
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
152
+ */
153
+ metadata?: Stripe.MetadataParam;
154
+
155
+ /**
156
+ * Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
157
+ */
158
+ tax_behavior?: ShippingRateCreateParams.TaxBehavior;
159
+
160
+ /**
161
+ * A [tax code](https://stripe.com/docs/tax/tax-codes) ID. The Shipping tax code is `txcd_92010001`.
162
+ */
163
+ tax_code?: string;
164
+
165
+ /**
166
+ * The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now.
167
+ */
168
+ type?: 'fixed_amount';
169
+ }
170
+
171
+ namespace ShippingRateCreateParams {
172
+ interface DeliveryEstimate {
173
+ /**
174
+ * The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
175
+ */
176
+ maximum?: DeliveryEstimate.Maximum;
177
+
178
+ /**
179
+ * The lower bound of the estimated range. If empty, represents no lower bound.
180
+ */
181
+ minimum?: DeliveryEstimate.Minimum;
182
+ }
183
+
184
+ namespace DeliveryEstimate {
185
+ interface Maximum {
186
+ /**
187
+ * A unit of time.
188
+ */
189
+ unit: Maximum.Unit;
190
+
191
+ /**
192
+ * Must be greater than 0.
193
+ */
194
+ value: number;
195
+ }
196
+
197
+ namespace Maximum {
198
+ type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
199
+ }
200
+
201
+ interface Minimum {
202
+ /**
203
+ * A unit of time.
204
+ */
205
+ unit: Minimum.Unit;
206
+
207
+ /**
208
+ * Must be greater than 0.
209
+ */
210
+ value: number;
211
+ }
212
+
213
+ namespace Minimum {
214
+ type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
215
+ }
216
+ }
217
+
218
+ interface FixedAmount {
219
+ /**
220
+ * A non-negative integer in cents representing how much to charge.
221
+ */
222
+ amount: number;
223
+
224
+ /**
225
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
226
+ */
227
+ currency: string;
228
+ }
229
+
230
+ type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
231
+ }
232
+
233
+ interface ShippingRateRetrieveParams {
234
+ /**
235
+ * Specifies which fields in the response should be expanded.
236
+ */
237
+ expand?: Array<string>;
238
+ }
239
+
240
+ interface ShippingRateUpdateParams {
241
+ /**
242
+ * Whether the shipping rate can be used for new purchases. Defaults to `true`.
243
+ */
244
+ active?: boolean;
245
+
246
+ /**
247
+ * Specifies which fields in the response should be expanded.
248
+ */
249
+ expand?: Array<string>;
250
+
251
+ /**
252
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
253
+ */
254
+ metadata?: Stripe.Emptyable<Stripe.MetadataParam>;
255
+ }
256
+
257
+ interface ShippingRateListParams extends PaginationParams {
258
+ /**
259
+ * Only return shipping rates that are active or inactive.
260
+ */
261
+ active?: boolean;
262
+
263
+ /**
264
+ * A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
265
+ */
266
+ created?: Stripe.RangeQueryParam | number;
267
+
268
+ /**
269
+ * Only return shipping rates for the given currency.
270
+ */
271
+ currency?: string;
272
+
273
+ /**
274
+ * Specifies which fields in the response should be expanded.
275
+ */
276
+ expand?: Array<string>;
277
+ }
278
+
279
+ class ShippingRatesResource {
280
+ /**
281
+ * Creates a new shipping rate object.
282
+ */
283
+ create(
284
+ params: ShippingRateCreateParams,
285
+ options?: RequestOptions
286
+ ): Promise<Stripe.Response<Stripe.ShippingRate>>;
287
+
288
+ /**
289
+ * Returns the shipping rate object with the given ID.
290
+ */
291
+ retrieve(
292
+ id: string,
293
+ params?: ShippingRateRetrieveParams,
294
+ options?: RequestOptions
295
+ ): Promise<Stripe.Response<Stripe.ShippingRate>>;
296
+ retrieve(
297
+ id: string,
298
+ options?: RequestOptions
299
+ ): Promise<Stripe.Response<Stripe.ShippingRate>>;
300
+
301
+ /**
302
+ * Updates an existing shipping rate object.
303
+ */
304
+ update(
305
+ id: string,
306
+ params?: ShippingRateUpdateParams,
307
+ options?: RequestOptions
308
+ ): Promise<Stripe.Response<Stripe.ShippingRate>>;
309
+
310
+ /**
311
+ * Returns a list of your shipping rates.
312
+ */
313
+ list(
314
+ params?: ShippingRateListParams,
315
+ options?: RequestOptions
316
+ ): ApiListPromise<Stripe.ShippingRate>;
317
+ list(options?: RequestOptions): ApiListPromise<Stripe.ShippingRate>;
318
+ }
319
+ }
320
+ }
@@ -81,6 +81,7 @@
81
81
  ///<reference path='./SKUs.d.ts' />
82
82
  ///<reference path='./SetupAttempts.d.ts' />
83
83
  ///<reference path='./SetupIntents.d.ts' />
84
+ ///<reference path='./ShippingRates.d.ts' />
84
85
  ///<reference path='./Sigma/ScheduledQueryRuns.d.ts' />
85
86
  ///<reference path='./SourceMandateNotifications.d.ts' />
86
87
  ///<reference path='./SourceTransactions.d.ts' />
@@ -154,6 +155,7 @@ declare module 'stripe' {
154
155
  reviews: Stripe.ReviewsResource;
155
156
  setupAttempts: Stripe.SetupAttemptsResource;
156
157
  setupIntents: Stripe.SetupIntentsResource;
158
+ shippingRates: Stripe.ShippingRatesResource;
157
159
  skus: Stripe.SkusResource;
158
160
  sources: Stripe.SourcesResource;
159
161
  subscriptions: Stripe.SubscriptionsResource;