stripe 8.195.0 → 8.196.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,14 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 8.196.0 - 2022-01-12
4
+ * [#1328](https://github.com/stripe/stripe-node/pull/1328) API Updates
5
+ * Add support for `customer_creation` on `CheckoutSessionCreateParams` and `Checkout.Session`
6
+ * Add support for `fpx` and `grabpay` on `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentIntentConfirmParams.payment_method_options`, and `PaymentIntent.payment_method_options`
7
+ * [#1315](https://github.com/stripe/stripe-node/pull/1315) API Updates
8
+ * Add support for `mandate_options` on `SubscriptionCreateParams.payment_settings.payment_method_options.card`, `SubscriptionUpdateParams.payment_settings.payment_method_options.card`, and `Subscription.payment_settings.payment_method_options.card`
9
+ * [#1327](https://github.com/stripe/stripe-node/pull/1327) Remove DOM type references.
10
+ * [#1325](https://github.com/stripe/stripe-node/pull/1325) Add comment documenting makeRequest#headers type.
11
+
3
12
  ## 8.195.0 - 2021-12-22
4
13
  * [#1314](https://github.com/stripe/stripe-node/pull/1314) API Updates
5
14
  * Add support for `au_becs_debit` on `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentIntentConfirmParams.payment_method_options`, and `PaymentIntent.payment_method_options`
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.195.0
1
+ 8.196.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "8.195.0",
3
+ "version": "8.196.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -442,7 +442,7 @@ declare module 'stripe' {
442
442
 
443
443
  interface Product {
444
444
  /**
445
- * The list of prices IDs that a subscription can be updated to.
445
+ * The list of price IDs for the product that a subscription can be updated to.
446
446
  */
447
447
  prices: Array<string>;
448
448
 
@@ -678,7 +678,7 @@ declare module 'stripe' {
678
678
 
679
679
  interface Product {
680
680
  /**
681
- * The list of prices IDs that a subscription can be updated to.
681
+ * The list of price IDs for the product that a subscription can be updated to.
682
682
  */
683
683
  prices: Array<string>;
684
684
 
@@ -81,6 +81,11 @@ declare module 'stripe' {
81
81
  */
82
82
  customer: string | Stripe.Customer | Stripe.DeletedCustomer | null;
83
83
 
84
+ /**
85
+ * Configure whether a Checkout Session creates a Customer when the Checkout Session completes.
86
+ */
87
+ customer_creation: Session.CustomerCreation | null;
88
+
84
89
  /**
85
90
  * The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode.
86
91
  */
@@ -289,6 +294,8 @@ declare module 'stripe' {
289
294
  promotions: 'auto' | null;
290
295
  }
291
296
 
297
+ type CustomerCreation = 'always' | 'if_required';
298
+
292
299
  interface CustomerDetails {
293
300
  /**
294
301
  * The email associated with the Customer, if one exists, on the Checkout Session at the time of checkout or at time of session expiry.
@@ -914,7 +921,7 @@ declare module 'stripe' {
914
921
  * ID of an existing Customer, if one exists. In `payment` mode, the customer's most recent card
915
922
  * payment method will be used to prefill the email, name, card details, and billing address
916
923
  * on the Checkout page. In `subscription` mode, the customer's [default payment method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method)
917
- * will be used if it's a card, and otherwise the most recent card will be used. A valid billing address is required for Checkout to prefill the customer's card details.
924
+ * will be used if it's a card, and otherwise the most recent card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer's card details.
918
925
  *
919
926
  * If the Customer already has a valid [email](https://stripe.com/docs/api/customers/object#customer_object-email) set, the email will be prefilled and not editable in Checkout.
920
927
  * If the Customer does not have a valid `email`, Checkout will set the email entered during the session on the Customer.
@@ -925,6 +932,18 @@ declare module 'stripe' {
925
932
  */
926
933
  customer?: string;
927
934
 
935
+ /**
936
+ * Configure whether a Checkout Session creates a [Customer](https://stripe.com/docs/api/customers) during Session confirmation.
937
+ *
938
+ * When a Customer is not created, you can still retrieve email, address, and other customer data entered in Checkout
939
+ * with [customer_details](https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-customer_details).
940
+ *
941
+ * Sessions that do not create Customers will instead create [Guest Customers](https://support.stripe.com/questions/guest-customer-faq) in the Dashboard.
942
+ *
943
+ * Can only be set in `payment` and `setup` mode.
944
+ */
945
+ customer_creation?: SessionCreateParams.CustomerCreation;
946
+
928
947
  /**
929
948
  * If provided, this value will be used when the Customer object is created.
930
949
  * If not provided, customers will be asked to enter their email address.
@@ -1089,6 +1108,8 @@ declare module 'stripe' {
1089
1108
  promotions?: 'auto';
1090
1109
  }
1091
1110
 
1111
+ type CustomerCreation = 'always' | 'if_required';
1112
+
1092
1113
  interface CustomerUpdate {
1093
1114
  /**
1094
1115
  * Describes whether Checkout saves the billing address onto `customer.address`.
@@ -1383,9 +1404,12 @@ declare module 'stripe' {
1383
1404
  * customer that their payment details will be saved and used for future
1384
1405
  * payments.
1385
1406
  *
1386
- * For both values, Checkout will attach the payment method to either the
1387
- * provided Customer for the session, or a new Customer created by Checkout
1388
- * if one has not been provided.
1407
+ * If a Customer has been provided or Checkout creates a new Customer,
1408
+ * Checkout will attach the payment method to the Customer.
1409
+ *
1410
+ * If Checkout does not create a Customer, the payment method is not attached
1411
+ * to a Customer. To reuse the payment method, you can retrieve it from the
1412
+ * Checkout Session's PaymentIntent.
1389
1413
  *
1390
1414
  * When processing card payments, Checkout also uses `setup_future_usage`
1391
1415
  * to dynamically optimize your payment flow and comply with regional
@@ -183,7 +183,7 @@ declare module 'stripe' {
183
183
  customer_details?: InvoiceLineItemListUpcomingParams.CustomerDetails;
184
184
 
185
185
  /**
186
- * The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead.
186
+ * The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. This only works for coupons directly applied to the invoice. To apply a coupon to a subscription, you must use the `coupon` parameter instead. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead.
187
187
  */
188
188
  discounts?: Stripe.Emptyable<
189
189
  Array<InvoiceLineItemListUpcomingParams.Discount>
@@ -1414,7 +1414,7 @@ declare module 'stripe' {
1414
1414
  customer_details?: InvoiceRetrieveUpcomingParams.CustomerDetails;
1415
1415
 
1416
1416
  /**
1417
- * The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead.
1417
+ * The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. This only works for coupons directly applied to the invoice. To apply a coupon to a subscription, you must use the `coupon` parameter instead. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead.
1418
1418
  */
1419
1419
  discounts?: Stripe.Emptyable<
1420
1420
  Array<InvoiceRetrieveUpcomingParams.Discount>
@@ -526,8 +526,12 @@ declare module 'stripe' {
526
526
 
527
527
  card_present?: PaymentMethodOptions.CardPresent;
528
528
 
529
+ fpx?: PaymentMethodOptions.Fpx;
530
+
529
531
  giropay?: PaymentMethodOptions.Giropay;
530
532
 
533
+ grabpay?: PaymentMethodOptions.Grabpay;
534
+
531
535
  ideal?: PaymentMethodOptions.Ideal;
532
536
 
533
537
  interac_present?: PaymentMethodOptions.InteracPresent;
@@ -720,8 +724,12 @@ declare module 'stripe' {
720
724
 
721
725
  interface CardPresent {}
722
726
 
727
+ interface Fpx {}
728
+
723
729
  interface Giropay {}
724
730
 
731
+ interface Grabpay {}
732
+
725
733
  interface Ideal {}
726
734
 
727
735
  interface InteracPresent {}
@@ -1518,11 +1526,21 @@ declare module 'stripe' {
1518
1526
  */
1519
1527
  card_present?: Stripe.Emptyable<PaymentMethodOptions.CardPresent>;
1520
1528
 
1529
+ /**
1530
+ * If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
1531
+ */
1532
+ fpx?: Stripe.Emptyable<PaymentMethodOptions.Fpx>;
1533
+
1521
1534
  /**
1522
1535
  * If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
1523
1536
  */
1524
1537
  giropay?: Stripe.Emptyable<PaymentMethodOptions.Giropay>;
1525
1538
 
1539
+ /**
1540
+ * If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
1541
+ */
1542
+ grabpay?: Stripe.Emptyable<PaymentMethodOptions.Grabpay>;
1543
+
1526
1544
  /**
1527
1545
  * If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
1528
1546
  */
@@ -1738,8 +1756,12 @@ declare module 'stripe' {
1738
1756
 
1739
1757
  interface CardPresent {}
1740
1758
 
1759
+ interface Fpx {}
1760
+
1741
1761
  interface Giropay {}
1742
1762
 
1763
+ interface Grabpay {}
1764
+
1743
1765
  interface Ideal {}
1744
1766
 
1745
1767
  interface InteracPresent {}
@@ -2469,11 +2491,21 @@ declare module 'stripe' {
2469
2491
  */
2470
2492
  card_present?: Stripe.Emptyable<PaymentMethodOptions.CardPresent>;
2471
2493
 
2494
+ /**
2495
+ * If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
2496
+ */
2497
+ fpx?: Stripe.Emptyable<PaymentMethodOptions.Fpx>;
2498
+
2472
2499
  /**
2473
2500
  * If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
2474
2501
  */
2475
2502
  giropay?: Stripe.Emptyable<PaymentMethodOptions.Giropay>;
2476
2503
 
2504
+ /**
2505
+ * If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
2506
+ */
2507
+ grabpay?: Stripe.Emptyable<PaymentMethodOptions.Grabpay>;
2508
+
2477
2509
  /**
2478
2510
  * If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
2479
2511
  */
@@ -2689,8 +2721,12 @@ declare module 'stripe' {
2689
2721
 
2690
2722
  interface CardPresent {}
2691
2723
 
2724
+ interface Fpx {}
2725
+
2692
2726
  interface Giropay {}
2693
2727
 
2728
+ interface Grabpay {}
2729
+
2694
2730
  interface Ideal {}
2695
2731
 
2696
2732
  interface InteracPresent {}
@@ -3534,11 +3570,21 @@ declare module 'stripe' {
3534
3570
  */
3535
3571
  card_present?: Stripe.Emptyable<PaymentMethodOptions.CardPresent>;
3536
3572
 
3573
+ /**
3574
+ * If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
3575
+ */
3576
+ fpx?: Stripe.Emptyable<PaymentMethodOptions.Fpx>;
3577
+
3537
3578
  /**
3538
3579
  * If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
3539
3580
  */
3540
3581
  giropay?: Stripe.Emptyable<PaymentMethodOptions.Giropay>;
3541
3582
 
3583
+ /**
3584
+ * If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
3585
+ */
3586
+ grabpay?: Stripe.Emptyable<PaymentMethodOptions.Grabpay>;
3587
+
3542
3588
  /**
3543
3589
  * If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
3544
3590
  */
@@ -3754,8 +3800,12 @@ declare module 'stripe' {
3754
3800
 
3755
3801
  interface CardPresent {}
3756
3802
 
3803
+ interface Fpx {}
3804
+
3757
3805
  interface Giropay {}
3758
3806
 
3807
+ interface Grabpay {}
3808
+
3759
3809
  interface Ideal {}
3760
3810
 
3761
3811
  interface InteracPresent {}
@@ -297,6 +297,8 @@ declare module 'stripe' {
297
297
  }
298
298
 
299
299
  interface Card {
300
+ mandate_options?: Card.MandateOptions;
301
+
300
302
  /**
301
303
  * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
302
304
  */
@@ -304,6 +306,27 @@ declare module 'stripe' {
304
306
  }
305
307
 
306
308
  namespace Card {
309
+ interface MandateOptions {
310
+ /**
311
+ * Amount to be charged for future payments.
312
+ */
313
+ amount: number | null;
314
+
315
+ /**
316
+ * One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param.
317
+ */
318
+ amount_type: MandateOptions.AmountType | null;
319
+
320
+ /**
321
+ * A description of the mandate or subscription that is meant to be displayed to the customer.
322
+ */
323
+ description: string | null;
324
+ }
325
+
326
+ namespace MandateOptions {
327
+ type AmountType = 'fixed' | 'maximum';
328
+ }
329
+
307
330
  type RequestThreeDSecure = 'any' | 'automatic';
308
331
  }
309
332
  }
@@ -798,6 +821,11 @@ declare module 'stripe' {
798
821
  }
799
822
 
800
823
  interface Card {
824
+ /**
825
+ * Configuration options for setting up an eMandate for cards issued in India.
826
+ */
827
+ mandate_options?: Card.MandateOptions;
828
+
801
829
  /**
802
830
  * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
803
831
  */
@@ -805,6 +833,27 @@ declare module 'stripe' {
805
833
  }
806
834
 
807
835
  namespace Card {
836
+ interface MandateOptions {
837
+ /**
838
+ * Amount to be charged for future payments.
839
+ */
840
+ amount?: number;
841
+
842
+ /**
843
+ * One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param.
844
+ */
845
+ amount_type?: MandateOptions.AmountType;
846
+
847
+ /**
848
+ * A description of the mandate or subscription that is meant to be displayed to the customer.
849
+ */
850
+ description?: string;
851
+ }
852
+
853
+ namespace MandateOptions {
854
+ type AmountType = 'fixed' | 'maximum';
855
+ }
856
+
808
857
  type RequestThreeDSecure = 'any' | 'automatic';
809
858
  }
810
859
  }
@@ -1304,6 +1353,11 @@ declare module 'stripe' {
1304
1353
  }
1305
1354
 
1306
1355
  interface Card {
1356
+ /**
1357
+ * Configuration options for setting up an eMandate for cards issued in India.
1358
+ */
1359
+ mandate_options?: Card.MandateOptions;
1360
+
1307
1361
  /**
1308
1362
  * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
1309
1363
  */
@@ -1311,6 +1365,27 @@ declare module 'stripe' {
1311
1365
  }
1312
1366
 
1313
1367
  namespace Card {
1368
+ interface MandateOptions {
1369
+ /**
1370
+ * Amount to be charged for future payments.
1371
+ */
1372
+ amount?: number;
1373
+
1374
+ /**
1375
+ * One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param.
1376
+ */
1377
+ amount_type?: MandateOptions.AmountType;
1378
+
1379
+ /**
1380
+ * A description of the mandate or subscription that is meant to be displayed to the customer.
1381
+ */
1382
+ description?: string;
1383
+ }
1384
+
1385
+ namespace MandateOptions {
1386
+ type AmountType = 'fixed' | 'maximum';
1387
+ }
1388
+
1314
1389
  type RequestThreeDSecure = 'any' | 'automatic';
1315
1390
  }
1316
1391
  }
@@ -47,7 +47,13 @@ declare module 'stripe' {
47
47
  * defaults to the `crypto.subtle` object in the global scope.
48
48
  */
49
49
  export const createSubtleCryptoProvider: (
50
- subtleCrypto?: WindowOrWorkerGlobalScope['crypto']['subtle']
50
+ /**
51
+ * The SubtleCrypto type cannot be specified without pulling in DOM types.
52
+ * This corresponds to WindowOrWorkerGlobalScope['crypto']['subtle'] for
53
+ * applications which pull in DOM types.
54
+ */
55
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
+ subtleCrypto?: any
51
57
  ) => CryptoProvider;
52
58
  }
53
59
  }
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference lib="dom" />
3
2
 
4
3
  import {IncomingMessage} from 'http';
5
4
  declare module 'stripe' {
@@ -19,6 +18,11 @@ declare module 'stripe' {
19
18
  port: string | number,
20
19
  path: string,
21
20
  method: 'GET' | 'POST' | 'PUT' | 'DELETE',
21
+ // object is used here as this is implementation-specific. This is
22
+ // generally {[key: string]: string}, but various underlying clients
23
+ // support other types as well. As examples:
24
+ // - Node supports {[key: string]: string | number | string[]}.
25
+ // - Fetch supports a Headers object.
22
26
  headers: object,
23
27
  requestData: string | null,
24
28
  protocol: Stripe.HttpProtocol,
@@ -71,11 +75,24 @@ declare module 'stripe' {
71
75
  * passed, will default to the default `fetch` function in the global scope.
72
76
  */
73
77
  export const createFetchHttpClient: (
74
- fetchFn?: WindowOrWorkerGlobalScope['fetch']
78
+ /** When specified, interface should match the Web Fetch API function. */
79
+ fetchFn?: Function
75
80
  ) => HttpClient<
76
81
  HttpClientResponse<
77
- ReturnType<WindowOrWorkerGlobalScope['fetch']>,
78
- ReadableStream<Uint8Array>
82
+ /**
83
+ * The response type cannot be specified without pulling in DOM types.
84
+ * This corresponds to ReturnType<WindowOrWorkerGlobalScope['fetch']>
85
+ * for applications which pull in DOM types.
86
+ */
87
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
+ any,
89
+ /**
90
+ * The stream type cannot be specified without pulling in DOM types.
91
+ * This corresponds to ReadableStream<Uint8Array> for applications which
92
+ * pull in DOM types.
93
+ */
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
+ any
79
96
  >
80
97
  >;
81
98
  }
@@ -228,7 +228,7 @@ async (): Promise<void> => {
228
228
 
229
229
  // Test FetchHttpClient request processing.
230
230
  async (): Promise<void> => {
231
- const client = Stripe.createFetchHttpClient(window.fetch);
231
+ const client = Stripe.createFetchHttpClient();
232
232
 
233
233
  const response = await client.makeRequest(
234
234
  'api.stripe.com',
@@ -244,7 +244,7 @@ async (): Promise<void> => {
244
244
  80000
245
245
  );
246
246
 
247
- const stream: ReadableStream = response.toStream(() => {
247
+ const stream = response.toStream(() => {
248
248
  return;
249
249
  });
250
250