stripe 8.181.0 → 8.185.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,26 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 8.185.0 - 2021-11-01
4
+ * [#1282](https://github.com/stripe/stripe-node/pull/1282) API Updates
5
+ * Change type of `AccountUpdateParams.individual.full_name_aliases`, `AccountCreateParams.individual.full_name_aliases`, `PersonCreateParams.full_name_aliases`, `PersonUpdateParams.full_name_aliases`, `TokenCreateParams.account.individual.full_name_aliases`, and `TokenCreateParams.person.full_name_aliases` from `array(string)` to `emptyStringable(array(string))`
6
+ * Add support for new values `en-BE`, `en-ES`, and `en-IT` on enums `PaymentIntentCreateParams.payment_method_options.klarna.preferred_locale`, `PaymentIntentUpdateParams.payment_method_options.klarna.preferred_locale`, and `PaymentIntentConfirmParams.payment_method_options.klarna.preferred_locale`
7
+
8
+ ## 8.184.0 - 2021-10-20
9
+ * [#1276](https://github.com/stripe/stripe-node/pull/1276) API Updates
10
+ * Change `Account.controller.type` to be required
11
+ * Add support for `buyer_id` on `Charge.payment_method_details.alipay`
12
+ * [#1273](https://github.com/stripe/stripe-node/pull/1273) Add typed createFetchHttpClient function.
13
+
14
+ ## 8.183.0 - 2021-10-15
15
+ * [#1272](https://github.com/stripe/stripe-node/pull/1272) API Updates
16
+ * Change type of `UsageRecordCreateParams.timestamp` from `integer` to `literal('now') | integer`
17
+ * Change `UsageRecordCreateParams.timestamp` to be optional
18
+
19
+ ## 8.182.0 - 2021-10-14
20
+ * [#1271](https://github.com/stripe/stripe-node/pull/1271) API Updates
21
+ * Change `Charge.payment_method_details.klarna.payment_method_category`, `Charge.payment_method_details.klarna.preferred_locale`, `Checkout.Session.customer_details.phone`, and `PaymentMethod.klarna.dob` to be required
22
+ * Add support for new value `klarna` on enum `CheckoutSessionCreateParams.payment_method_types[]`
23
+
3
24
  ## 8.181.0 - 2021-10-11
4
25
  * [#1269](https://github.com/stripe/stripe-node/pull/1269) API Updates
5
26
  * Add support for `payment_method_category` and `preferred_locale` on `Charge.payment_method_details.klarna`
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.181.0
1
+ 8.185.0
package/lib/stripe.js CHANGED
@@ -142,6 +142,18 @@ Stripe.createNodeHttpClient = (agent) => {
142
142
  return new NodeHttpClient(agent);
143
143
  };
144
144
 
145
+ /**
146
+ * Creates an HTTP client for issuing Stripe API requests which uses the Web
147
+ * Fetch API.
148
+ *
149
+ * A fetch function can optionally be passed in as a parameter. If none is
150
+ * passed, will default to the default `fetch` function in the global scope.
151
+ */
152
+ Stripe.createFetchHttpClient = (fetchFn) => {
153
+ const {FetchHttpClient} = require('./net/FetchHttpClient');
154
+ return new FetchHttpClient(fetchFn);
155
+ };
156
+
145
157
  Stripe.prototype = {
146
158
  /**
147
159
  * @deprecated will be removed in a future major version. Use the config object instead:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "8.181.0",
3
+ "version": "8.185.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -536,7 +536,7 @@ declare module 'stripe' {
536
536
  /**
537
537
  * The controller type. Can be `application`, if a Connect application controls the account, or `account`, if the account controls itself.
538
538
  */
539
- type?: Controller.Type;
539
+ type: Controller.Type;
540
540
  }
541
541
 
542
542
  namespace Controller {
@@ -1720,7 +1720,7 @@ declare module 'stripe' {
1720
1720
  /**
1721
1721
  * A list of alternate names or aliases that the individual is known by.
1722
1722
  */
1723
- full_name_aliases?: Array<string>;
1723
+ full_name_aliases?: Stripe.Emptyable<Array<string>>;
1724
1724
 
1725
1725
  /**
1726
1726
  * The individual's gender (International regulations require either "male" or "female").
@@ -2719,7 +2719,7 @@ declare module 'stripe' {
2719
2719
  /**
2720
2720
  * A list of alternate names or aliases that the individual is known by.
2721
2721
  */
2722
- full_name_aliases?: Array<string>;
2722
+ full_name_aliases?: Stripe.Emptyable<Array<string>>;
2723
2723
 
2724
2724
  /**
2725
2725
  * The individual's gender (International regulations require either "male" or "female").
@@ -543,6 +543,11 @@ declare module 'stripe' {
543
543
  }
544
544
 
545
545
  interface Alipay {
546
+ /**
547
+ * Uniquely identifies this particular Alipay account. You can use this attribute to check whether two Alipay accounts are the same.
548
+ */
549
+ buyer_id?: string;
550
+
546
551
  /**
547
552
  * Uniquely identifies this particular Alipay account. You can use this attribute to check whether two Alipay accounts are the same.
548
553
  */
@@ -648,7 +653,7 @@ declare module 'stripe' {
648
653
 
649
654
  interface Boleto {
650
655
  /**
651
- * Uniquely identifies this customer tax_id (CNPJ or CPF)
656
+ * The tax ID of the customer (CPF for individuals consumers or CNPJ for businesses consumers)
652
657
  */
653
658
  tax_id: string;
654
659
  }
@@ -1409,13 +1414,13 @@ declare module 'stripe' {
1409
1414
  * The Klarna payment method used for this transaction.
1410
1415
  * Can be one of `pay_later`, `pay_now`, `pay_with_financing`, or `pay_in_installments`
1411
1416
  */
1412
- payment_method_category?: string | null;
1417
+ payment_method_category: string | null;
1413
1418
 
1414
1419
  /**
1415
1420
  * Preferred language of the Klarna authorization page that the customer is redirected to.
1416
- * Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `it-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `fr-FR`, or `en-FR`
1421
+ * Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `en-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `en-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `it-IT`, `en-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `fr-FR`, or `en-FR`
1417
1422
  */
1418
- preferred_locale?: string | null;
1423
+ preferred_locale: string | null;
1419
1424
  }
1420
1425
 
1421
1426
  interface Multibanco {
@@ -284,7 +284,7 @@ declare module 'stripe' {
284
284
  /**
285
285
  * The customer's phone number at the time of checkout
286
286
  */
287
- phone?: string | null;
287
+ phone: string | null;
288
288
 
289
289
  /**
290
290
  * The customer's tax exempt status at time of checkout.
@@ -842,8 +842,8 @@ declare module 'stripe' {
842
842
  /**
843
843
  * The URL to which Stripe should send customers when payment or setup
844
844
  * is complete.
845
- * If you'd like access to the Checkout Session for the successful
846
- * payment, read more about it in the guide on [fulfilling orders](https://stripe.com/docs/payments/checkout/fulfill-orders).
845
+ * If you'd like to use information from the successful Checkout Session on your page,
846
+ * read the guide on [customizing your success page](https://stripe.com/docs/payments/checkout/custom-success-page).
847
847
  */
848
848
  success_url: string;
849
849
 
@@ -1158,7 +1158,7 @@ declare module 'stripe' {
1158
1158
  enabled: boolean;
1159
1159
 
1160
1160
  /**
1161
- * The maximum quantity the customer can purchase for the Checkout Session. By default this value is 99.
1161
+ * The maximum quantity the customer can purchase for the Checkout Session. By default this value is 99. You can specify a value up to 999.
1162
1162
  */
1163
1163
  maximum?: number;
1164
1164
 
@@ -1561,6 +1561,7 @@ declare module 'stripe' {
1561
1561
  | 'giropay'
1562
1562
  | 'grabpay'
1563
1563
  | 'ideal'
1564
+ | 'klarna'
1564
1565
  | 'oxxo'
1565
1566
  | 'p24'
1566
1567
  | 'sepa_debit'
@@ -1193,7 +1193,7 @@ declare module 'stripe' {
1193
1193
 
1194
1194
  interface Boleto {
1195
1195
  /**
1196
- * Uniquely identifies this customer tax_id (CNPJ or CPF)
1196
+ * The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
1197
1197
  */
1198
1198
  tax_id: string;
1199
1199
  }
@@ -1657,10 +1657,13 @@ declare module 'stripe' {
1657
1657
  | 'de-AT'
1658
1658
  | 'de-DE'
1659
1659
  | 'en-AT'
1660
+ | 'en-BE'
1660
1661
  | 'en-DE'
1661
1662
  | 'en-DK'
1663
+ | 'en-ES'
1662
1664
  | 'en-FI'
1663
1665
  | 'en-GB'
1666
+ | 'en-IT'
1664
1667
  | 'en-NL'
1665
1668
  | 'en-NO'
1666
1669
  | 'en-SE'
@@ -2102,7 +2105,7 @@ declare module 'stripe' {
2102
2105
 
2103
2106
  interface Boleto {
2104
2107
  /**
2105
- * Uniquely identifies this customer tax_id (CNPJ or CPF)
2108
+ * The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
2106
2109
  */
2107
2110
  tax_id: string;
2108
2111
  }
@@ -2566,10 +2569,13 @@ declare module 'stripe' {
2566
2569
  | 'de-AT'
2567
2570
  | 'de-DE'
2568
2571
  | 'en-AT'
2572
+ | 'en-BE'
2569
2573
  | 'en-DE'
2570
2574
  | 'en-DK'
2575
+ | 'en-ES'
2571
2576
  | 'en-FI'
2572
2577
  | 'en-GB'
2578
+ | 'en-IT'
2573
2579
  | 'en-NL'
2574
2580
  | 'en-NO'
2575
2581
  | 'en-SE'
@@ -3125,7 +3131,7 @@ declare module 'stripe' {
3125
3131
 
3126
3132
  interface Boleto {
3127
3133
  /**
3128
- * Uniquely identifies this customer tax_id (CNPJ or CPF)
3134
+ * The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
3129
3135
  */
3130
3136
  tax_id: string;
3131
3137
  }
@@ -3589,10 +3595,13 @@ declare module 'stripe' {
3589
3595
  | 'de-AT'
3590
3596
  | 'de-DE'
3591
3597
  | 'en-AT'
3598
+ | 'en-BE'
3592
3599
  | 'en-DE'
3593
3600
  | 'en-DK'
3601
+ | 'en-ES'
3594
3602
  | 'en-FI'
3595
3603
  | 'en-GB'
3604
+ | 'en-IT'
3596
3605
  | 'en-NL'
3597
3606
  | 'en-NO'
3598
3607
  | 'en-SE'
@@ -513,7 +513,7 @@ declare module 'stripe' {
513
513
  /**
514
514
  * The customer's date of birth, if provided.
515
515
  */
516
- dob?: Klarna.Dob | null;
516
+ dob: Klarna.Dob | null;
517
517
  }
518
518
 
519
519
  namespace Klarna {
@@ -862,7 +862,7 @@ declare module 'stripe' {
862
862
 
863
863
  interface Boleto {
864
864
  /**
865
- * Uniquely identifies this customer tax_id (CNPJ or CPF)
865
+ * The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
866
866
  */
867
867
  tax_id: string;
868
868
  }
@@ -1301,7 +1301,7 @@ declare module 'stripe' {
1301
1301
  ): Promise<Stripe.Response<Stripe.PaymentMethod>>;
1302
1302
 
1303
1303
  /**
1304
- * Returns a list of PaymentMethods for a given Customer
1304
+ * Returns a list of PaymentMethods. For listing a customer's payment methods, you should use [List a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list)
1305
1305
  */
1306
1306
  list(
1307
1307
  params: PaymentMethodListParams,
@@ -632,7 +632,7 @@ declare module 'stripe' {
632
632
  /**
633
633
  * A list of alternate names or aliases that the person is known by.
634
634
  */
635
- full_name_aliases?: Array<string>;
635
+ full_name_aliases?: Stripe.Emptyable<Array<string>>;
636
636
 
637
637
  /**
638
638
  * The person's gender (International regulations require either "male" or "female").
@@ -899,7 +899,7 @@ declare module 'stripe' {
899
899
  /**
900
900
  * A list of alternate names or aliases that the person is known by.
901
901
  */
902
- full_name_aliases?: Array<string>;
902
+ full_name_aliases?: Stripe.Emptyable<Array<string>>;
903
903
 
904
904
  /**
905
905
  * The person's gender (International regulations require either "male" or "female").
@@ -44,7 +44,7 @@ declare module 'stripe' {
44
44
  livemode: boolean;
45
45
 
46
46
  /**
47
- * A lookup key used to retrieve prices dynamically from a static string.
47
+ * A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
48
48
  */
49
49
  lookup_key: string | null;
50
50
 
@@ -238,7 +238,7 @@ declare module 'stripe' {
238
238
  expand?: Array<string>;
239
239
 
240
240
  /**
241
- * A lookup key used to retrieve prices dynamically from a static string.
241
+ * A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
242
242
  */
243
243
  lookup_key?: string;
244
244
 
@@ -451,7 +451,7 @@ declare module 'stripe' {
451
451
  expand?: Array<string>;
452
452
 
453
453
  /**
454
- * A lookup key used to retrieve prices dynamically from a static string.
454
+ * A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
455
455
  */
456
456
  lookup_key?: string;
457
457
 
@@ -13,7 +13,7 @@ declare module 'stripe' {
13
13
  object: 'terminal.connection_token';
14
14
 
15
15
  /**
16
- * The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/readers/fleet-management#connection-tokens).
16
+ * The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/fleet/locations#connection-tokens).
17
17
  */
18
18
  location?: string;
19
19
 
@@ -30,7 +30,7 @@ declare module 'stripe' {
30
30
  expand?: Array<string>;
31
31
 
32
32
  /**
33
- * The id of the location that this connection token is scoped to. If specified the connection token will only be usable with readers assigned to that location, otherwise the connection token will be usable with all readers. Note that location scoping only applies to internet-connected readers. For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/readers/fleet-management#connection-tokens).
33
+ * The id of the location that this connection token is scoped to. If specified the connection token will only be usable with readers assigned to that location, otherwise the connection token will be usable with all readers. Note that location scoping only applies to internet-connected readers. For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/fleet/locations#connection-tokens).
34
34
  */
35
35
  location?: string;
36
36
  }
@@ -306,7 +306,7 @@ declare module 'stripe' {
306
306
  /**
307
307
  * A list of alternate names or aliases that the individual is known by.
308
308
  */
309
- full_name_aliases?: Array<string>;
309
+ full_name_aliases?: Stripe.Emptyable<Array<string>>;
310
310
 
311
311
  /**
312
312
  * The individual's gender (International regulations require either "male" or "female").
@@ -553,7 +553,7 @@ declare module 'stripe' {
553
553
  /**
554
554
  * A list of alternate names or aliases that the person is known by.
555
555
  */
556
- full_name_aliases?: Array<string>;
556
+ full_name_aliases?: Stripe.Emptyable<Array<string>>;
557
557
 
558
558
  /**
559
559
  * The person's gender (International regulations require either "male" or "female").
@@ -43,11 +43,6 @@ declare module 'stripe' {
43
43
  */
44
44
  quantity: number;
45
45
 
46
- /**
47
- * The timestamp for the usage event. This timestamp must be within the current billing period of the subscription of the provided `subscription_item`.
48
- */
49
- timestamp: number;
50
-
51
46
  /**
52
47
  * Valid values are `increment` (default) or `set`. When using `increment` the specified `quantity` will be added to the usage at the specified timestamp. The `set` action will overwrite the usage quantity at that timestamp. If the subscription has [billing thresholds](https://stripe.com/docs/api/subscriptions/object#subscription_object-billing_thresholds), `increment` is the only allowed value.
53
48
  */
@@ -57,6 +52,11 @@ declare module 'stripe' {
57
52
  * Specifies which fields in the response should be expanded.
58
53
  */
59
54
  expand?: Array<string>;
55
+
56
+ /**
57
+ * The timestamp for the usage event. This timestamp must be within the current billing period of the subscription of the provided `subscription_item`, and must not be in the future. When passing `"now"`, Stripe records usage for the current time. Default is `"now"` if a value is not provided.
58
+ */
59
+ timestamp?: 'now' | number;
60
60
  }
61
61
 
62
62
  namespace UsageRecordCreateParams {
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference lib="dom" />
2
3
 
3
4
  import {IncomingMessage} from 'http';
4
5
  declare module 'stripe' {
@@ -61,5 +62,21 @@ declare module 'stripe' {
61
62
  ) => HttpClient<
62
63
  HttpClientResponse<IncomingMessage, Stripe.StripeStreamResponse>
63
64
  >;
65
+
66
+ /**
67
+ * Creates an HTTP client for issuing Stripe API requests which uses the Web
68
+ * Fetch API.
69
+ *
70
+ * A fetch function can optionally be passed in as a parameter. If none is
71
+ * passed, will default to the default `fetch` function in the global scope.
72
+ */
73
+ export const createFetchHttpClient: (
74
+ fetchFn?: WindowOrWorkerGlobalScope['fetch']
75
+ ) => HttpClient<
76
+ HttpClientResponse<
77
+ ReturnType<WindowOrWorkerGlobalScope['fetch']>,
78
+ ReadableStream<Uint8Array>
79
+ >
80
+ >;
64
81
  }
65
82
  }
@@ -222,3 +222,30 @@ async (): Promise<void> => {
222
222
 
223
223
  const jsonResponse: object = await response.toJSON();
224
224
  };
225
+
226
+ // Test FetchHttpClient request processing.
227
+ async (): Promise<void> => {
228
+ const client = Stripe.createFetchHttpClient(window.fetch);
229
+
230
+ const response = await client.makeRequest(
231
+ 'api.stripe.com',
232
+ '443',
233
+ '/test',
234
+ 'POST',
235
+ {
236
+ 'Stripe-Account': 'account',
237
+ 'Content-Length': 123,
238
+ },
239
+ 'requestdata',
240
+ 'https',
241
+ 80000
242
+ );
243
+
244
+ const stream: ReadableStream = response.toStream(() => {
245
+ return;
246
+ });
247
+
248
+ const results = await stream.getReader().read();
249
+
250
+ const jsonResponse: object = await response.toJSON();
251
+ };