@stripe/stripe-js 3.0.6 → 3.0.8

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/pure/index.d.ts CHANGED
@@ -4881,6 +4881,11 @@ interface ConfirmPaymentData extends PaymentIntentConfirmParams {
4881
4881
  * @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_data-billing_details
4882
4882
  */
4883
4883
  billing_details?: PaymentMethodCreateParams.BillingDetails;
4884
+
4885
+ /**
4886
+ * Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature
4887
+ */
4888
+ allow_redisplay?: 'always' | 'limited' | 'unspecified';
4884
4889
  };
4885
4890
 
4886
4891
  /**
@@ -5986,7 +5991,12 @@ interface StripeEmbeddedCheckoutOptions {
5986
5991
  /**
5987
5992
  * The client secret of the [Checkout Session](https://stripe.com/docs/api/checkout/sessions).
5988
5993
  */
5989
- clientSecret: string;
5994
+ clientSecret?: string;
5995
+ /**
5996
+ * A function that returns a Promise which resolves with the client secret of
5997
+ * the [Checkout Session](https://stripe.com/docs/api/checkout/sessions).
5998
+ */
5999
+ fetchClientSecret?: () => Promise<string>;
5990
6000
  /**
5991
6001
  * onComplete is called when the Checkout Session completes successfully.
5992
6002
  * You can use it to unmount Embedded Checkout and render a custom success UI.
@@ -12372,9 +12382,6 @@ interface StripePaymentElementChangeEvent {
12372
12382
  * Contact [Stripe support](https://support.stripe.com/) for more information.
12373
12383
  */
12374
12384
 
12375
- /**
12376
- * StripeCustomCheckoutInitOptions
12377
- */
12378
12385
  interface StripeCustomCheckoutElementsOptions {
12379
12386
  appearance?: Appearance;
12380
12387
  loader?: 'auto' | 'always' | 'never';
@@ -12386,10 +12393,7 @@ interface StripeCustomCheckoutOptions {
12386
12393
  elementsOptions?: StripeCustomCheckoutElementsOptions;
12387
12394
  }
12388
12395
 
12389
- /**
12390
- * StripeCustomCheckoutActions
12391
- */
12392
-
12396
+ /* Custom Checkout types */
12393
12397
  type StripeCustomCheckoutAddress = {
12394
12398
  country: string;
12395
12399
  line1?: string | null;
@@ -12399,72 +12403,50 @@ type StripeCustomCheckoutAddress = {
12399
12403
  state?: string | null;
12400
12404
  };
12401
12405
 
12402
- type StripeCustomCheckoutContact = {
12403
- name?: string | null;
12404
- address: StripeCustomCheckoutAddress;
12406
+ type StripeCustomCheckoutAdjustableQuantity = {
12407
+ maximum: number;
12408
+ minimum: number;
12405
12409
  };
12406
12410
 
12407
- type StripeCustomCheckoutResult =
12408
- | {session: StripeCustomCheckoutSession; error?: undefined}
12409
- | {session?: undefined; error: StripeError};
12411
+ type StripeCustomCheckoutBillingInterval =
12412
+ | 'day'
12413
+ | 'month'
12414
+ | 'week'
12415
+ | 'year';
12410
12416
 
12411
- interface StripeCustomCheckoutActions {
12412
- applyPromotionCode: (
12413
- promotionCode: string
12414
- ) => Promise<StripeCustomCheckoutResult>;
12415
- removePromotionCode: () => Promise<StripeCustomCheckoutResult>;
12416
- updateShippingAddress: (
12417
- shippingAddress: StripeCustomCheckoutContact | null
12418
- ) => Promise<StripeCustomCheckoutResult>;
12419
- updateBillingAddress: (
12420
- billingAddress: StripeCustomCheckoutContact | null
12421
- ) => Promise<StripeCustomCheckoutResult>;
12422
- updatePhoneNumber: (phoneNumber: string) => void;
12423
- updateEmail: (email: string) => void;
12424
- updateLineItemQuantity: (args: {
12425
- lineItem: string;
12426
- quantity: number;
12427
- }) => Promise<StripeCustomCheckoutResult>;
12428
- updateShippingOption: (
12429
- shippingOption: string
12430
- ) => Promise<StripeCustomCheckoutResult>;
12431
- confirm: (args?: {
12432
- return_url?: string;
12433
- }) => Promise<StripeCustomCheckoutResult>;
12434
- }
12417
+ type StripeCustomCheckoutConfirmationRequirement =
12418
+ | 'phoneNumber'
12419
+ | 'shippingAddress'
12420
+ | 'billingAddress'
12421
+ | 'paymentDetails'
12422
+ | 'email';
12435
12423
 
12436
- /**
12437
- * StripeCustomCheckoutSession
12438
- */
12424
+ type StripeCustomCheckoutContact = {
12425
+ name?: string | null;
12426
+ address: StripeCustomCheckoutAddress;
12427
+ };
12439
12428
 
12440
- type StripeCustomCheckoutTaxAmount = {
12441
- amount: number;
12442
- inclusive: boolean;
12443
- displayName: string;
12429
+ type StripeCustomCheckoutDeliveryEstimate = {
12430
+ maximum: StripeCustomCheckoutEstimate | null;
12431
+ minimum: StripeCustomCheckoutEstimate | null;
12444
12432
  };
12445
12433
 
12446
12434
  type StripeCustomCheckoutDiscountAmount = {
12447
12435
  amount: number;
12448
12436
  displayName: string;
12449
12437
  promotionCode: string | null;
12438
+ recurring:
12439
+ | {type: 'forever'}
12440
+ | {type: 'repeating'; durationInMonths: number}
12441
+ | null;
12450
12442
  };
12451
12443
 
12452
- type StripeCustomCheckoutShipping = {
12453
- shippingOption: StripeCustomCheckoutShippingOption;
12454
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
12455
- };
12456
-
12457
- type StripeCustomCheckoutShippingOption = {
12458
- id: string;
12459
- amount: number;
12460
- currency: string;
12461
- displayName: string | null;
12462
- deliveryEstimate: StripeCustomCheckoutDeliveryEstimate | null;
12463
- };
12464
-
12465
- type StripeCustomCheckoutDeliveryEstimate = {
12466
- maximum: StripeCustomCheckoutEstimate | null;
12467
- minimum: StripeCustomCheckoutEstimate | null;
12444
+ type StripeCustomCheckoutDueNext = {
12445
+ amountSubtotal: number;
12446
+ amountDiscount: number;
12447
+ amountTaxInclusive: number;
12448
+ amountTaxExclusive: number;
12449
+ billingCycleAnchor: number | null;
12468
12450
  };
12469
12451
 
12470
12452
  type StripeCustomCheckoutEstimate = {
@@ -12472,16 +12454,23 @@ type StripeCustomCheckoutEstimate = {
12472
12454
  value: number;
12473
12455
  };
12474
12456
 
12475
- type StripeCustomCheckoutBillingInterval =
12476
- | 'day'
12477
- | 'month'
12478
- | 'week'
12479
- | 'year';
12457
+ type StripeCustomCheckoutLastPaymentError = {
12458
+ message: string;
12459
+ };
12460
+
12461
+ type StripeCustomCheckoutTaxAmount = {
12462
+ amount: number;
12463
+ inclusive: boolean;
12464
+ displayName: string;
12465
+ };
12480
12466
 
12481
12467
  type StripeCustomCheckoutLineItem = {
12482
12468
  id: string;
12483
12469
  name: string;
12484
- amount: number;
12470
+ amountDiscount: number;
12471
+ amountSubtotal: number;
12472
+ amountTaxExclusive: number;
12473
+ amountTaxInclusive: number;
12485
12474
  unitAmount: number;
12486
12475
  description: string | null;
12487
12476
  quantity: number;
@@ -12489,45 +12478,87 @@ type StripeCustomCheckoutLineItem = {
12489
12478
  taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
12490
12479
  recurring: {
12491
12480
  interval: StripeCustomCheckoutBillingInterval;
12492
- interval_count: number;
12481
+ intervalCount: number;
12482
+ isProrated: boolean;
12483
+ usageType: 'metered' | 'licensed';
12493
12484
  } | null;
12485
+ adjustableQuantity: StripeCustomCheckoutAdjustableQuantity | null;
12486
+ };
12487
+
12488
+ type StripeCustomCheckoutRecurring = {
12489
+ interval: StripeCustomCheckoutBillingInterval;
12490
+ intervalCount: number;
12491
+ dueNext: StripeCustomCheckoutDueNext;
12492
+ trial: StripeCustomCheckoutTrial | null;
12493
+ };
12494
+
12495
+ type StripeCustomCheckoutShipping = {
12496
+ shippingOption: StripeCustomCheckoutShippingOption;
12497
+ taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
12498
+ };
12499
+
12500
+ type StripeCustomCheckoutShippingOption = {
12501
+ id: string;
12502
+ amount: number;
12503
+ currency: string;
12504
+ displayName: string | null;
12505
+ deliveryEstimate: StripeCustomCheckoutDeliveryEstimate | null;
12494
12506
  };
12495
12507
 
12508
+ type StripeCustomCheckoutStatus =
12509
+ | {type: 'open'}
12510
+ | {type: 'expired'}
12511
+ | {
12512
+ type: 'complete';
12513
+ paymentStatus: 'paid' | 'unpaid' | 'no_payment_required';
12514
+ };
12515
+
12516
+ type StripeCustomCheckoutTaxStatus =
12517
+ | {status: 'ready'}
12518
+ | {status: 'requires_shipping_address'}
12519
+ | {status: 'requires_billing_address'};
12520
+
12496
12521
  type StripeCustomCheckoutTotalSummary = {
12522
+ appliedBalance: number;
12523
+ balanceAppliedToNextInvoice: boolean;
12524
+ discount: number;
12525
+ shippingRate: number;
12497
12526
  subtotal: number;
12498
12527
  taxExclusive: number;
12499
12528
  taxInclusive: number;
12500
- shippingRate: number;
12501
- discount: number;
12502
12529
  total: number;
12503
12530
  };
12504
12531
 
12505
- type StripeCustomCheckoutConfirmationRequirement =
12506
- | 'phoneNumber'
12507
- | 'shippingAddress'
12508
- | 'billingAddress'
12509
- | 'paymentDetails'
12510
- | 'email';
12532
+ type StripeCustomCheckoutTrial = {
12533
+ trialEnd: number;
12534
+ trialPeriodDays: number;
12535
+ };
12511
12536
 
12537
+ /* Custom Checkout session */
12512
12538
  interface StripeCustomCheckoutSession {
12513
- lineItems: Array<StripeCustomCheckoutLineItem>;
12514
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
12515
- discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
12539
+ billingAddress: StripeCustomCheckoutContact | null;
12540
+ canConfirm: boolean;
12541
+ confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
12516
12542
  currency: string;
12543
+ discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
12544
+ email: string | null;
12545
+ lastPaymentError: StripeCustomCheckoutLastPaymentError | null;
12546
+ lineItems: Array<StripeCustomCheckoutLineItem>;
12547
+ phoneNumber: string | null;
12548
+ recurring: StripeCustomCheckoutRecurring | null;
12517
12549
  shipping: StripeCustomCheckoutShipping | null;
12518
- shippingOptions: Array<StripeCustomCheckoutShippingOption>;
12519
12550
  shippingAddress: StripeCustomCheckoutContact | null;
12520
- billingAddress: StripeCustomCheckoutContact | null;
12521
- phoneNumber: string | null;
12522
- email: string | null;
12551
+ shippingOptions: Array<StripeCustomCheckoutShippingOption>;
12552
+ status: StripeCustomCheckoutStatus;
12553
+ tax: StripeCustomCheckoutTaxStatus;
12554
+ taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
12523
12555
  total: StripeCustomCheckoutTotalSummary;
12524
- confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
12525
- canConfirm: boolean;
12526
12556
  }
12527
12557
 
12528
- /**
12529
- * StripeCustomCheckoutElements
12530
- */
12558
+ type StripeCustomCheckoutResult =
12559
+ | {session: StripeCustomCheckoutSession; error?: undefined}
12560
+ | {session?: undefined; error: StripeError};
12561
+
12531
12562
  type StripeCustomCheckoutPaymentElementOptions = {
12532
12563
  layout?: Layout | LayoutObject;
12533
12564
  paymentMethodOrder?: Array<string>;
@@ -12543,13 +12574,177 @@ type StripeCustomCheckoutAddressElementOptions = {
12543
12574
  };
12544
12575
  };
12545
12576
 
12546
- interface StripeCustomCheckoutElementsActions {
12577
+ type StripeCustomCheckoutExpressCheckoutElementOptions = {
12578
+ buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight'];
12579
+ buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme'];
12580
+ buttonType: StripeExpressCheckoutElementOptions['buttonType'];
12581
+ layout: StripeExpressCheckoutElementOptions['layout'];
12582
+ };
12583
+
12584
+ type StripeCustomCheckoutUpdateHandler = (
12585
+ session: StripeCustomCheckoutSession
12586
+ ) => void;
12587
+
12588
+ type StripeCustomCheckoutExpressCheckoutElementConfirmEvent = StripeExpressCheckoutElementConfirmEvent & {
12589
+ confirm: () => Promise<StripeCustomCheckoutResult>;
12590
+ };
12591
+
12592
+ type StripeCustomCheckoutExpressCheckoutElement = StripeElementBase & {
12593
+ /**
12594
+ * Triggered when the element is fully rendered.
12595
+ */
12596
+ on(
12597
+ eventType: 'ready',
12598
+ handler: (event: StripeExpressCheckoutElementReadyEvent) => any
12599
+ ): StripeCustomCheckoutExpressCheckoutElement;
12600
+ once(
12601
+ eventType: 'ready',
12602
+ handler: (event: StripeExpressCheckoutElementReadyEvent) => any
12603
+ ): StripeCustomCheckoutExpressCheckoutElement;
12604
+ off(
12605
+ eventType: 'ready',
12606
+ handler?: (event: StripeExpressCheckoutElementReadyEvent) => any
12607
+ ): StripeCustomCheckoutExpressCheckoutElement;
12608
+
12609
+ /**
12610
+ * Triggered when the element gains focus.
12611
+ */
12612
+ on(
12613
+ eventType: 'focus',
12614
+ handler: (event: {elementType: 'expressCheckout'}) => any
12615
+ ): StripeCustomCheckoutExpressCheckoutElement;
12616
+ once(
12617
+ eventType: 'focus',
12618
+ handler: (event: {elementType: 'expressCheckout'}) => any
12619
+ ): StripeCustomCheckoutExpressCheckoutElement;
12620
+ off(
12621
+ eventType: 'focus',
12622
+ handler?: (event: {elementType: 'expressCheckout'}) => any
12623
+ ): StripeCustomCheckoutExpressCheckoutElement;
12624
+
12625
+ /**
12626
+ * Triggered when the element loses focus.
12627
+ */
12628
+ on(
12629
+ eventType: 'blur',
12630
+ handler: (event: {elementType: 'expressCheckout'}) => any
12631
+ ): StripeCustomCheckoutExpressCheckoutElement;
12632
+ once(
12633
+ eventType: 'blur',
12634
+ handler: (event: {elementType: 'expressCheckout'}) => any
12635
+ ): StripeCustomCheckoutExpressCheckoutElement;
12636
+ off(
12637
+ eventType: 'blur',
12638
+ handler?: (event: {elementType: 'expressCheckout'}) => any
12639
+ ): StripeCustomCheckoutExpressCheckoutElement;
12640
+
12641
+ /**
12642
+ * Triggered when the escape key is pressed within the element.
12643
+ */
12644
+ on(
12645
+ eventType: 'escape',
12646
+ handler: (event: {elementType: 'expressCheckout'}) => any
12647
+ ): StripeCustomCheckoutExpressCheckoutElement;
12648
+ once(
12649
+ eventType: 'escape',
12650
+ handler: (event: {elementType: 'expressCheckout'}) => any
12651
+ ): StripeCustomCheckoutExpressCheckoutElement;
12652
+ off(
12653
+ eventType: 'escape',
12654
+ handler?: (event: {elementType: 'expressCheckout'}) => any
12655
+ ): StripeCustomCheckoutExpressCheckoutElement;
12656
+
12657
+ /**
12658
+ * Triggered when the element fails to load.
12659
+ */
12660
+ on(
12661
+ eventType: 'loaderror',
12662
+ handler: (event: {
12663
+ elementType: 'expressCheckout';
12664
+ error: StripeError;
12665
+ }) => any
12666
+ ): StripeCustomCheckoutExpressCheckoutElement;
12667
+ once(
12668
+ eventType: 'loaderror',
12669
+ handler: (event: {
12670
+ elementType: 'expressCheckout';
12671
+ error: StripeError;
12672
+ }) => any
12673
+ ): StripeCustomCheckoutExpressCheckoutElement;
12674
+ off(
12675
+ eventType: 'loaderror',
12676
+ handler?: (event: {
12677
+ elementType: 'expressCheckout';
12678
+ error: StripeError;
12679
+ }) => any
12680
+ ): StripeCustomCheckoutExpressCheckoutElement;
12681
+
12682
+ /**
12683
+ * Triggered when a buyer authorizes a payment within a supported payment method.
12684
+ */
12685
+ on(
12686
+ eventType: 'confirm',
12687
+ handler: (
12688
+ event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
12689
+ ) => any
12690
+ ): StripeCustomCheckoutExpressCheckoutElement;
12691
+ once(
12692
+ eventType: 'confirm',
12693
+ handler: (
12694
+ event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
12695
+ ) => any
12696
+ ): StripeCustomCheckoutExpressCheckoutElement;
12697
+ off(
12698
+ eventType: 'confirm',
12699
+ handler?: (
12700
+ event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
12701
+ ) => any
12702
+ ): StripeCustomCheckoutExpressCheckoutElement;
12703
+
12704
+ /**
12705
+ * Updates the options the `ExpressCheckoutElement` was initialized with.
12706
+ * Updates are merged into the existing configuration.
12707
+ */
12708
+ update: StripeExpressCheckoutElement['update'];
12709
+ };
12710
+
12711
+ interface StripeCustomCheckout {
12712
+ /* Custom Checkout methods */
12713
+ applyPromotionCode: (
12714
+ promotionCode: string
12715
+ ) => Promise<StripeCustomCheckoutResult>;
12716
+ removePromotionCode: () => Promise<StripeCustomCheckoutResult>;
12717
+ updateShippingAddress: (
12718
+ shippingAddress: StripeCustomCheckoutContact | null
12719
+ ) => Promise<StripeCustomCheckoutResult>;
12720
+ updateBillingAddress: (
12721
+ billingAddress: StripeCustomCheckoutContact | null
12722
+ ) => Promise<StripeCustomCheckoutResult>;
12723
+ updatePhoneNumber: (phoneNumber: string) => void;
12724
+ updateEmail: (email: string) => void;
12725
+ updateLineItemQuantity: (args: {
12726
+ lineItem: string;
12727
+ quantity: number;
12728
+ }) => Promise<StripeCustomCheckoutResult>;
12729
+ updateShippingOption: (
12730
+ shippingOption: string
12731
+ ) => Promise<StripeCustomCheckoutResult>;
12732
+ confirm: (args?: {
12733
+ return_url?: string;
12734
+ }) => Promise<StripeCustomCheckoutResult>;
12735
+ session: () => StripeCustomCheckoutSession;
12736
+ on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
12737
+
12738
+ /* Elements methods */
12547
12739
  changeAppearance: (appearance: Appearance) => void;
12548
12740
  getElement(elementType: 'payment'): StripePaymentElement | null;
12549
12741
  getElement(
12550
12742
  elementType: 'address',
12551
12743
  mode: AddressMode
12552
12744
  ): StripeAddressElement | null;
12745
+ getElement(
12746
+ elementType: 'expressCheckout'
12747
+ ): StripeCustomCheckoutExpressCheckoutElement | null;
12553
12748
  createElement(
12554
12749
  elementType: 'payment',
12555
12750
  options?: StripeCustomCheckoutPaymentElementOptions
@@ -12558,20 +12753,10 @@ interface StripeCustomCheckoutElementsActions {
12558
12753
  elementType: 'address',
12559
12754
  options: StripeCustomCheckoutAddressElementOptions
12560
12755
  ): StripeAddressElement;
12561
- }
12562
-
12563
- /**
12564
- * StripeCustomCheckout
12565
- */
12566
- type StripeCustomCheckoutUpdateHandler = (
12567
- session: StripeCustomCheckoutSession
12568
- ) => void;
12569
-
12570
- interface StripeCustomCheckout
12571
- extends StripeCustomCheckoutActions,
12572
- StripeCustomCheckoutElementsActions {
12573
- session: () => StripeCustomCheckoutSession;
12574
- on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
12756
+ createElement(
12757
+ elementType: 'expressCheckout',
12758
+ options: StripeCustomCheckoutExpressCheckoutElementOptions
12759
+ ): StripeCustomCheckoutExpressCheckoutElement;
12575
12760
  }
12576
12761
 
12577
12762
  declare const loadStripe: (
package/pure/index.js CHANGED
@@ -58,7 +58,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
58
58
 
59
59
  stripe._registerWrapper({
60
60
  name: 'stripe-js',
61
- version: "3.0.6",
61
+ version: "3.0.8",
62
62
  startTime: startTime
63
63
  });
64
64
  };
package/pure/index.mjs CHANGED
@@ -54,7 +54,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
54
54
 
55
55
  stripe._registerWrapper({
56
56
  name: 'stripe-js',
57
- version: "3.0.6",
57
+ version: "3.0.8",
58
58
  startTime: startTime
59
59
  });
60
60
  };