@stripe/stripe-js 3.0.6 → 3.0.7

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