@paypercut/checkout-js 1.2.18 → 1.3.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/README.md +1000 -1227
- package/dist/index.cjs +11121 -217
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +408 -2
- package/dist/index.mjs +11121 -218
- package/dist/index.mjs.map +1 -1
- package/dist/paypercut-checkout.iife.min.js +1 -1
- package/dist/paypercut-checkout.iife.min.js.map +1 -1
- package/licenses/Basis-Theory-Apache-2.0.txt +202 -0
- package/licenses/Geist-OFL-1.1.txt +92 -0
- package/package.json +15 -4
package/dist/index.d.ts
CHANGED
|
@@ -480,13 +480,419 @@ interface ExpressCheckoutStatic {
|
|
|
480
480
|
new (options: ExpressCheckoutOptions): ExpressCheckoutInstance;
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
+
/** Options used to initialise the Paypercut browser client. */
|
|
484
|
+
interface PaypercutOptions {
|
|
485
|
+
/** Public browser credential. The value is opaque; Paycore resolves its account and livemode. */
|
|
486
|
+
publishableKey: string;
|
|
487
|
+
/** Internal builds only. Production builds ignore this override. */
|
|
488
|
+
hostedCheckoutUrl?: string;
|
|
489
|
+
/** Internal builds only. Production builds ignore this override. */
|
|
490
|
+
apiUrl?: string;
|
|
491
|
+
/** Internal builds only. Ignored by production builds. */
|
|
492
|
+
developerAssistant?: boolean;
|
|
493
|
+
}
|
|
494
|
+
/** Browser-side intent prepared by one Elements group. */
|
|
495
|
+
type PaypercutElementsMode = 'payment' | 'setup' | 'subscription';
|
|
496
|
+
/** Lifecycle policy for Appearance updates after an Element has mounted. */
|
|
497
|
+
type PaypercutElementsAppearanceUpdates = 'locked' | 'remount';
|
|
498
|
+
/** Initial configuration shared by the Elements group. */
|
|
499
|
+
interface PaypercutElementsOptions {
|
|
500
|
+
mode: PaypercutElementsMode;
|
|
501
|
+
/** Amount in minor units. */
|
|
502
|
+
amount: number;
|
|
503
|
+
/** ISO 4217 alphabetic currency code. */
|
|
504
|
+
currency: string;
|
|
505
|
+
/**
|
|
506
|
+
* Declares how a card prepared by this Elements group is expected to be
|
|
507
|
+
* reused. Omit in payment mode for one-time use. Setup and subscription
|
|
508
|
+
* modes always resolve to off_session.
|
|
509
|
+
*
|
|
510
|
+
* This does not create or confirm a SetupIntent or PaymentIntent.
|
|
511
|
+
*/
|
|
512
|
+
setupFutureUsage?: PaypercutSetupFutureUsage;
|
|
513
|
+
locale?: Locale | string;
|
|
514
|
+
/**
|
|
515
|
+
* Controls mounted Appearance changes. Defaults to `locked`. Use `remount`
|
|
516
|
+
* only for integration previews; it temporarily makes payment fields
|
|
517
|
+
* unavailable and clears entered secure-field data.
|
|
518
|
+
*/
|
|
519
|
+
appearanceUpdates?: PaypercutElementsAppearanceUpdates;
|
|
520
|
+
appearance?: PaypercutElementsAppearance;
|
|
521
|
+
}
|
|
522
|
+
/** Visual configuration shared by every component in one Elements group. */
|
|
523
|
+
type PaypercutElementsAppearanceVariableName = 'colorPrimary' | 'colorPrimaryText' | 'colorBackground' | 'colorSurface' | 'colorText' | 'colorTextSecondary' | 'colorTextPlaceholder' | 'colorDanger' | 'colorSuccess' | 'colorWarning' | 'colorBorder' | 'colorFocus' | 'colorMuted' | 'fontFamily' | 'fontSizeBase' | 'fontWeightNormal' | 'fontWeightMedium' | 'lineHeight' | 'spacingUnit' | 'gridColumnSpacing' | 'gridRowSpacing' | 'labelSpacing' | 'borderRadius' | 'buttonBorderRadius' | 'buttonExpressCheckoutBorderRadius' | 'buttonPadding';
|
|
524
|
+
type PaypercutElementsAppearanceVariables = Partial<Record<PaypercutElementsAppearanceVariableName, string>>;
|
|
525
|
+
type PaypercutElementsAppearanceRuleSelector = '.Input' | '.Input--invalid' | '.Input:focus' | '.Label' | '.Error' | '.Text' | '.WalletButton' | '.WalletButton--applePay' | '.WalletButton--googlePay' | '.ActionShell';
|
|
526
|
+
type PaypercutElementsAppearanceRuleProperty = 'backgroundColor' | 'borderColor' | 'borderRadius' | 'borderStyle' | 'borderWidth' | 'borderTopColor' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderTopStyle' | 'borderTopWidth' | 'borderRightColor' | 'borderRightStyle' | 'borderRightWidth' | 'borderBottomColor' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderBottomStyle' | 'borderBottomWidth' | 'borderLeftColor' | 'borderLeftStyle' | 'borderLeftWidth' | 'boxShadow' | 'color' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'letterSpacing' | 'lineHeight' | 'opacity' | 'outline' | 'outlineOffset' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'textDecoration' | 'textShadow' | 'textTransform' | 'transition';
|
|
527
|
+
type PaypercutElementsAppearanceRules = Partial<Record<PaypercutElementsAppearanceRuleSelector, Partial<Record<PaypercutElementsAppearanceRuleProperty, string>>>>;
|
|
528
|
+
interface PaypercutElementsAppearance {
|
|
529
|
+
/** Light is the default. */
|
|
530
|
+
theme?: 'light' | 'dark';
|
|
531
|
+
/** Condensed keeps all card fields on one line; spaced renders separate secure inputs. */
|
|
532
|
+
inputs?: 'condensed' | 'spaced';
|
|
533
|
+
/**
|
|
534
|
+
* Auto places labels above spaced inputs and uses in-field labels for condensed inputs.
|
|
535
|
+
*/
|
|
536
|
+
labels?: 'auto' | 'above' | 'floating';
|
|
537
|
+
/** Fine-grained visual variables layered on top of the selected theme. */
|
|
538
|
+
variables?: PaypercutElementsAppearanceVariables;
|
|
539
|
+
/** Semantic, allow-listed component rules. Arbitrary CSS selectors are rejected. */
|
|
540
|
+
rules?: PaypercutElementsAppearanceRules;
|
|
541
|
+
/** Disable non-essential transitions and animations inside every Elements frame. */
|
|
542
|
+
disableAnimations?: boolean;
|
|
543
|
+
}
|
|
544
|
+
/** Mutable configuration for an existing Elements group. */
|
|
545
|
+
interface PaypercutElementsUpdateOptions {
|
|
546
|
+
/** Updated amount in minor units. Currency remains immutable for the lifetime of the group. */
|
|
547
|
+
amount?: number;
|
|
548
|
+
/**
|
|
549
|
+
* Partial Appearance update. Accepted before the first mount. After mounting,
|
|
550
|
+
* the default locked policy skips it while still applying independent fields.
|
|
551
|
+
*/
|
|
552
|
+
appearance?: PaypercutElementsAppearance;
|
|
553
|
+
}
|
|
554
|
+
interface ElementsResizeEvent {
|
|
555
|
+
height: number;
|
|
556
|
+
}
|
|
557
|
+
/** Stable error codes emitted by the current Paypercut Elements implementation. */
|
|
558
|
+
type KnownElementsErrorCode = 'elements_payment_details_incomplete' | 'elements_payment_details_invalid' | 'elements_payment_method_creation_failed' | 'elements_destroyed' | 'elements_not_mounted' | 'elements_not_ready' | 'elements_reinitialized' | 'elements_initialization_invalid' | 'elements_locale_invalid' | 'elements_controller_failed' | 'elements_component_configuration_invalid' | 'elements_component_connect_failed' | 'elements_component_attach_failed' | 'elements_component_initialization_timeout' | 'elements_component_not_ready' | 'elements_provider_initialization_failed' | 'elements_provider_update_failed' | 'elements_session_expired' | 'elements_session_binding_mismatch' | 'elements_session_verification_failed' | 'elements_submission_in_progress' | 'elements_submit_in_progress' | 'elements_submit_required' | 'elements_test_preset_in_progress' | 'elements_submission_failed' | 'elements_submit_failed' | 'elements_submit_indeterminate' | 'elements_submit_invalid_response' | 'elements_submit_timeout' | 'elements_action_canceled' | 'elements_action_channel_unavailable' | 'elements_action_challenge_failed' | 'elements_action_in_progress' | 'elements_action_timeout' | 'elements_action_shell_timeout' | 'elements_client_secret_invalid' | 'elements_checkout_confirmation_failed' | 'elements_checkout_status_failed' | 'elements_checkout_status_invalid' | 'elements_next_action_invalid' | 'elements_next_action_loop' | 'elements_next_action_unsupported' | 'elements_payment_confirmation_failed' | 'elements_three_ds_authentication_failed' | 'elements_three_ds_challenge_failed' | 'elements_three_ds_challenge_invalid' | 'elements_three_ds_decoupled_not_supported' | 'elements_three_ds_provider_session_failed' | 'elements_three_ds_scope_mismatch' | 'elements_card_field_duplicate' | 'elements_card_fields_incomplete' | 'elements_tokenization_duplicate' | 'elements_tokenization_timeout' | 'elements_component_conflict' | 'elements_capability_unsupported' | 'elements_apple_pay_start_failed' | 'elements_apple_pay_unavailable' | 'elements_google_pay_failed' | 'elements_google_pay_request_invalid' | 'elements_google_pay_unavailable';
|
|
559
|
+
/**
|
|
560
|
+
* Elements error code. The open string member permits newer hosted components
|
|
561
|
+
* to add codes without requiring a synchronous merchant SDK upgrade.
|
|
562
|
+
*/
|
|
563
|
+
type ElementsErrorCode = KnownElementsErrorCode | (string & Record<never, never>);
|
|
564
|
+
interface ElementsErrorEvent {
|
|
565
|
+
code: ElementsErrorCode;
|
|
566
|
+
message: string;
|
|
567
|
+
recoverable?: boolean;
|
|
568
|
+
}
|
|
569
|
+
/** Server-consumable Payment Method produced without creating a Checkout Session. */
|
|
570
|
+
interface DeferredPaymentReference {
|
|
571
|
+
type: 'payment_method';
|
|
572
|
+
/** Opaque Payment Method identifier. */
|
|
573
|
+
id: string;
|
|
574
|
+
}
|
|
575
|
+
/** Intended reuse context shared by every Payment Method created from one Elements group. */
|
|
576
|
+
type PaypercutSetupFutureUsage = 'on_session' | 'off_session';
|
|
577
|
+
/** Billing address associated with the Payment Method being created. */
|
|
578
|
+
interface PaypercutBillingAddress {
|
|
579
|
+
line1?: string;
|
|
580
|
+
line2?: string;
|
|
581
|
+
city?: string;
|
|
582
|
+
state?: string;
|
|
583
|
+
postal_code?: string;
|
|
584
|
+
/** ISO 3166-1 alpha-2 country code. */
|
|
585
|
+
country?: string;
|
|
586
|
+
}
|
|
587
|
+
/** Billing identity associated with one Payment Method creation attempt. */
|
|
588
|
+
interface PaypercutBillingDetails {
|
|
589
|
+
name?: string;
|
|
590
|
+
email?: string;
|
|
591
|
+
phone?: string;
|
|
592
|
+
address?: PaypercutBillingAddress;
|
|
593
|
+
}
|
|
594
|
+
interface PaypercutCreatePaymentMethodParams {
|
|
595
|
+
billing_details: PaypercutBillingDetails;
|
|
596
|
+
}
|
|
597
|
+
/** Input for creating a Payment Method from one validated Elements group. */
|
|
598
|
+
interface PaypercutCreatePaymentMethodOptions {
|
|
599
|
+
elements: PaypercutElements;
|
|
600
|
+
/** Payment Method-owned billing details. They are frozen into the submission identity. */
|
|
601
|
+
params?: PaypercutCreatePaymentMethodParams;
|
|
602
|
+
}
|
|
603
|
+
/** Input for resuming a server-started payment through its opaque client capability. */
|
|
604
|
+
interface PaypercutConfirmPaymentOptions {
|
|
605
|
+
clientSecret: string;
|
|
606
|
+
}
|
|
607
|
+
/** Authoritative Checkout Session state returned by payment confirmation. */
|
|
608
|
+
interface PaypercutConfirmPaymentResult {
|
|
609
|
+
checkoutSession: {
|
|
610
|
+
id: string;
|
|
611
|
+
status: 'active' | 'completed' | 'expired' | 'canceled';
|
|
612
|
+
paymentStatus: 'failed' | 'no_payment_required' | 'paid' | 'processing' | 'unpaid';
|
|
613
|
+
paymentObjectStatus: 'canceled' | 'expired' | 'processing' | 'requires_action' | 'requires_capture' | 'requires_confirmation' | 'requires_payment_method' | 'succeeded' | null;
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
/** Typed rejection returned by Elements validation or Payment Method creation. */
|
|
617
|
+
interface ElementsSubmitError extends Error {
|
|
618
|
+
code: ElementsErrorCode;
|
|
619
|
+
recoverable: boolean;
|
|
620
|
+
}
|
|
621
|
+
type CardElementEventName = 'ready' | 'resize' | 'error';
|
|
622
|
+
/** Card-only surface coordinated by one hidden Elements controller. */
|
|
623
|
+
interface CardElement {
|
|
624
|
+
mount(target: string | HTMLElement): void;
|
|
625
|
+
on(event: 'ready', handler: () => void): () => void;
|
|
626
|
+
on(event: 'resize', handler: (event: ElementsResizeEvent) => void): () => void;
|
|
627
|
+
on(event: 'error', handler: (event: ElementsErrorEvent) => void): () => void;
|
|
628
|
+
on(event: CardElementEventName, handler: ((event: ElementsResizeEvent | ElementsErrorEvent) => void) | (() => void)): () => void;
|
|
629
|
+
destroy(): void;
|
|
630
|
+
}
|
|
631
|
+
type CardFieldElementType = 'cardNumber' | 'cardExpiry' | 'cardCvc';
|
|
632
|
+
type CardFieldElementEventName = 'ready' | 'change' | 'focus' | 'blur' | 'error';
|
|
633
|
+
/** PCI-safe state emitted by a split card field. Raw field values never enter this event. */
|
|
634
|
+
interface CardFieldChangeEvent {
|
|
635
|
+
complete: boolean;
|
|
636
|
+
empty: boolean;
|
|
637
|
+
/** Present only for the card-number field after the provider detects a brand. */
|
|
638
|
+
brand?: string;
|
|
639
|
+
error?: {
|
|
640
|
+
type: 'incomplete' | 'invalid';
|
|
641
|
+
message: string;
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
/** Shared lifecycle for a Paypercut-hosted secure card field. */
|
|
645
|
+
interface CardFieldElement {
|
|
646
|
+
readonly type: CardFieldElementType;
|
|
647
|
+
mount(target: string | HTMLElement): void;
|
|
648
|
+
clear(): void;
|
|
649
|
+
focus(): void;
|
|
650
|
+
blur(): void;
|
|
651
|
+
on(event: 'ready', handler: () => void): () => void;
|
|
652
|
+
on(event: 'change', handler: (event: CardFieldChangeEvent) => void): () => void;
|
|
653
|
+
on(event: 'focus' | 'blur', handler: () => void): () => void;
|
|
654
|
+
on(event: 'error', handler: (event: ElementsErrorEvent) => void): () => void;
|
|
655
|
+
destroy(): void;
|
|
656
|
+
}
|
|
657
|
+
/** Creation options for the split card-number field. */
|
|
658
|
+
interface CardNumberElementOptions {
|
|
659
|
+
/**
|
|
660
|
+
* Show Paypercut's accepted-card, detected-brand, and invalid-card badges.
|
|
661
|
+
* Defaults to true. Set to false to remove the adornment and reclaim its space.
|
|
662
|
+
*/
|
|
663
|
+
showIcon?: boolean;
|
|
664
|
+
}
|
|
665
|
+
interface CardNumberElement extends CardFieldElement {
|
|
666
|
+
readonly type: 'cardNumber';
|
|
667
|
+
}
|
|
668
|
+
interface CardExpiryElement extends CardFieldElement {
|
|
669
|
+
readonly type: 'cardExpiry';
|
|
670
|
+
}
|
|
671
|
+
interface CardCvcElement extends CardFieldElement {
|
|
672
|
+
readonly type: 'cardCvc';
|
|
673
|
+
}
|
|
674
|
+
/** Wallets currently implemented by the Express Checkout Element. */
|
|
675
|
+
type ExpressCheckoutWallet = 'apple_pay' | 'google_pay';
|
|
676
|
+
/** Browser-safe display data for a wallet-backed Payment Method. */
|
|
677
|
+
interface ExpressCheckoutPaymentMethodPreview {
|
|
678
|
+
type: 'card';
|
|
679
|
+
brand: string;
|
|
680
|
+
displayBrand: string;
|
|
681
|
+
last4: string;
|
|
682
|
+
expMonth?: number;
|
|
683
|
+
expYear?: number;
|
|
684
|
+
wallet: ExpressCheckoutWallet;
|
|
685
|
+
}
|
|
686
|
+
/** Controls whether a wallet is considered when the hosted component checks availability. */
|
|
687
|
+
type ExpressCheckoutPaymentMethodVisibility = 'auto' | 'always' | 'never';
|
|
688
|
+
interface ExpressCheckoutElementOptions {
|
|
689
|
+
paymentMethods?: {
|
|
690
|
+
applePay?: ExpressCheckoutPaymentMethodVisibility;
|
|
691
|
+
googlePay?: ExpressCheckoutPaymentMethodVisibility;
|
|
692
|
+
};
|
|
693
|
+
layout?: {
|
|
694
|
+
maxColumns?: number;
|
|
695
|
+
maxRows?: number;
|
|
696
|
+
overflow?: 'auto' | 'never';
|
|
697
|
+
};
|
|
698
|
+
buttonType?: {
|
|
699
|
+
applePay?: 'plain' | 'buy' | 'check-out' | 'donate' | 'book' | 'subscribe';
|
|
700
|
+
googlePay?: 'plain' | 'pay' | 'buy' | 'checkout' | 'donate' | 'book' | 'subscribe';
|
|
701
|
+
};
|
|
702
|
+
buttonTheme?: {
|
|
703
|
+
applePay?: 'black' | 'white' | 'white-outline';
|
|
704
|
+
googlePay?: 'black' | 'white';
|
|
705
|
+
};
|
|
706
|
+
/** Button height in CSS pixels. */
|
|
707
|
+
buttonHeight?: number;
|
|
708
|
+
/** Corner radius shared by every provider button, in CSS pixels. Defaults to 4. */
|
|
709
|
+
buttonRadius?: number;
|
|
710
|
+
emailRequired?: boolean;
|
|
711
|
+
phoneNumberRequired?: boolean;
|
|
712
|
+
billingAddressRequired?: boolean;
|
|
713
|
+
shippingAddressRequired?: boolean;
|
|
714
|
+
allowedShippingCountries?: string[];
|
|
715
|
+
lineItems?: ExpressCheckoutLineItem[];
|
|
716
|
+
/** Initial rates shown by wallets that require rates before their sheet opens. */
|
|
717
|
+
shippingRates?: ExpressCheckoutShippingRate[];
|
|
718
|
+
}
|
|
719
|
+
interface ExpressCheckoutLineItem {
|
|
720
|
+
name: string;
|
|
721
|
+
amount: number;
|
|
722
|
+
}
|
|
723
|
+
/** One merchant shipping choice. Amount is expressed in minor currency units. */
|
|
724
|
+
interface ExpressCheckoutShippingRate {
|
|
725
|
+
id: string;
|
|
726
|
+
displayName: string;
|
|
727
|
+
amount: number;
|
|
728
|
+
/** Optional detailed shipping note returned by some providers. */
|
|
729
|
+
detail?: string;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Redacted shipping address supplied while the wallet sheet is open. Wallets
|
|
733
|
+
* may omit fields until the customer authorizes the payment.
|
|
734
|
+
*/
|
|
735
|
+
interface ExpressCheckoutShippingAddress {
|
|
736
|
+
recipient?: string;
|
|
737
|
+
addressLine?: string[];
|
|
738
|
+
city?: string;
|
|
739
|
+
state?: string;
|
|
740
|
+
postalCode?: string;
|
|
741
|
+
country?: string;
|
|
742
|
+
}
|
|
743
|
+
interface ExpressCheckoutAddress {
|
|
744
|
+
/** @deprecated The contact name belongs on billingDetails or shippingAddress. */
|
|
745
|
+
name?: string;
|
|
746
|
+
line1?: string;
|
|
747
|
+
line2?: string;
|
|
748
|
+
city?: string;
|
|
749
|
+
state?: string;
|
|
750
|
+
postalCode?: string;
|
|
751
|
+
country?: string;
|
|
752
|
+
}
|
|
753
|
+
/** Final, unredacted shipping details returned after wallet authorization. */
|
|
754
|
+
interface ExpressCheckoutShippingDetails {
|
|
755
|
+
name?: string;
|
|
756
|
+
address?: ExpressCheckoutAddress;
|
|
757
|
+
}
|
|
758
|
+
interface ExpressCheckoutBillingDetails {
|
|
759
|
+
name?: string;
|
|
760
|
+
email?: string;
|
|
761
|
+
phone?: string;
|
|
762
|
+
address?: ExpressCheckoutAddress;
|
|
763
|
+
}
|
|
764
|
+
interface ExpressCheckoutAvailablePaymentMethodsChangeEvent {
|
|
765
|
+
availablePaymentMethods: {
|
|
766
|
+
applePay: boolean;
|
|
767
|
+
googlePay: boolean;
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
interface ExpressCheckoutConfirmEvent {
|
|
771
|
+
wallet: ExpressCheckoutWallet;
|
|
772
|
+
paymentMethod: DeferredPaymentReference;
|
|
773
|
+
paymentMethodPreview?: ExpressCheckoutPaymentMethodPreview;
|
|
774
|
+
billingDetails?: ExpressCheckoutBillingDetails;
|
|
775
|
+
shippingAddress?: ExpressCheckoutShippingDetails;
|
|
776
|
+
/** The final wallet-selected shipping rate, when shipping collection is enabled. */
|
|
777
|
+
shippingRate?: ExpressCheckoutShippingRate;
|
|
778
|
+
/** Complete the native wallet after the merchant accepts the prepared method or checkout. */
|
|
779
|
+
complete(): void;
|
|
780
|
+
/** Fail the native wallet after the merchant rejects preparation, payment, or order creation. */
|
|
781
|
+
paymentFailed(error?: {
|
|
782
|
+
code?: string;
|
|
783
|
+
message?: string;
|
|
784
|
+
}): void;
|
|
785
|
+
}
|
|
786
|
+
interface ExpressCheckoutCancelEvent {
|
|
787
|
+
wallet: ExpressCheckoutWallet;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Emitted before a wallet attempt is allowed to continue. Call exactly one of
|
|
791
|
+
* resolve() or reject(). When no click listener is registered, the Element
|
|
792
|
+
* continues automatically.
|
|
793
|
+
*/
|
|
794
|
+
interface ExpressCheckoutClickEvent {
|
|
795
|
+
wallet: ExpressCheckoutWallet;
|
|
796
|
+
resolve(options?: ExpressCheckoutClickResolveOptions): void;
|
|
797
|
+
reject(): void;
|
|
798
|
+
}
|
|
799
|
+
/** Current checkout details supplied immediately before a wallet is opened. */
|
|
800
|
+
interface ExpressCheckoutClickResolveOptions {
|
|
801
|
+
lineItems?: ExpressCheckoutLineItem[];
|
|
802
|
+
emailRequired?: boolean;
|
|
803
|
+
phoneNumberRequired?: boolean;
|
|
804
|
+
billingAddressRequired?: boolean;
|
|
805
|
+
shippingAddressRequired?: boolean;
|
|
806
|
+
allowedShippingCountries?: string[];
|
|
807
|
+
shippingRates?: ExpressCheckoutShippingRate[];
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Mutable checkout data for an already mounted Express Checkout Element.
|
|
811
|
+
*
|
|
812
|
+
* Provider selection, layout, and button styling remain immutable for the
|
|
813
|
+
* lifetime of the Element. Commerce state can be replaced before the next
|
|
814
|
+
* wallet gesture without remounting the secure component.
|
|
815
|
+
*/
|
|
816
|
+
type ExpressCheckoutElementUpdateOptions = ExpressCheckoutClickResolveOptions;
|
|
817
|
+
/** Updated checkout details returned after a wallet address or rate changes. */
|
|
818
|
+
interface ExpressCheckoutShippingUpdate {
|
|
819
|
+
/** Recalculated order total in the group's currency, in minor units. */
|
|
820
|
+
amount?: number;
|
|
821
|
+
lineItems?: ExpressCheckoutLineItem[];
|
|
822
|
+
shippingRates?: ExpressCheckoutShippingRate[];
|
|
823
|
+
}
|
|
824
|
+
interface ExpressCheckoutShippingAddressChangeEvent {
|
|
825
|
+
wallet: ExpressCheckoutWallet;
|
|
826
|
+
address: ExpressCheckoutShippingAddress;
|
|
827
|
+
resolve(update?: ExpressCheckoutShippingUpdate): void;
|
|
828
|
+
reject(): void;
|
|
829
|
+
}
|
|
830
|
+
interface ExpressCheckoutShippingRateChangeEvent {
|
|
831
|
+
wallet: ExpressCheckoutWallet;
|
|
832
|
+
shippingRate: ExpressCheckoutShippingRate;
|
|
833
|
+
resolve(update?: ExpressCheckoutShippingUpdate): void;
|
|
834
|
+
reject(): void;
|
|
835
|
+
}
|
|
836
|
+
type ExpressCheckoutElementEventName = 'ready' | 'resize' | 'error' | 'availablepaymentmethodschange' | 'click' | 'shippingaddresschange' | 'shippingratechange' | 'confirm' | 'cancel';
|
|
837
|
+
/**
|
|
838
|
+
* A reusable wallet surface. The hosted component owns provider availability,
|
|
839
|
+
* native wallet rendering, tokenization, and Payment Method creation.
|
|
840
|
+
*/
|
|
841
|
+
interface ExpressCheckoutElement {
|
|
842
|
+
mount(target: string | HTMLElement): void;
|
|
843
|
+
/** Replace the checkout data used by the next native wallet sheet. */
|
|
844
|
+
update(options: ExpressCheckoutElementUpdateOptions): void;
|
|
845
|
+
on(event: 'ready', handler: (event: ExpressCheckoutAvailablePaymentMethodsChangeEvent) => void): () => void;
|
|
846
|
+
on(event: 'resize', handler: (event: ElementsResizeEvent) => void): () => void;
|
|
847
|
+
on(event: 'error', handler: (event: ElementsErrorEvent) => void): () => void;
|
|
848
|
+
on(event: 'availablepaymentmethodschange', handler: (event: ExpressCheckoutAvailablePaymentMethodsChangeEvent) => void): () => void;
|
|
849
|
+
on(event: 'click', handler: (event: ExpressCheckoutClickEvent) => void): () => void;
|
|
850
|
+
on(event: 'shippingaddresschange', handler: (event: ExpressCheckoutShippingAddressChangeEvent) => void): () => void;
|
|
851
|
+
on(event: 'shippingratechange', handler: (event: ExpressCheckoutShippingRateChangeEvent) => void): () => void;
|
|
852
|
+
on(event: 'confirm', handler: (event: ExpressCheckoutConfirmEvent) => void): () => void;
|
|
853
|
+
on(event: 'cancel', handler: (event: ExpressCheckoutCancelEvent) => void): () => void;
|
|
854
|
+
destroy(): void;
|
|
855
|
+
}
|
|
856
|
+
/** A group owns one controller and all secure Elements created from it. */
|
|
857
|
+
interface PaypercutElements {
|
|
858
|
+
create(type: 'card'): CardElement;
|
|
859
|
+
create(type: 'expressCheckout', options?: ExpressCheckoutElementOptions): ExpressCheckoutElement;
|
|
860
|
+
create(type: 'cardNumber', options?: CardNumberElementOptions): CardNumberElement;
|
|
861
|
+
create(type: 'cardExpiry'): CardExpiryElement;
|
|
862
|
+
create(type: 'cardCvc'): CardCvcElement;
|
|
863
|
+
/** Validate the active payment-method source without creating server-side resources. */
|
|
864
|
+
submit(): Promise<void>;
|
|
865
|
+
/**
|
|
866
|
+
* Update mutable group configuration. Mounted Appearance is locked by default;
|
|
867
|
+
* integrations must explicitly opt into the remount preview lifecycle, which
|
|
868
|
+
* preserves public Element objects while replacing their secure fields.
|
|
869
|
+
*/
|
|
870
|
+
update(options: PaypercutElementsUpdateOptions): void;
|
|
871
|
+
destroy(): void;
|
|
872
|
+
}
|
|
873
|
+
interface PaypercutInstance {
|
|
874
|
+
elements(options: PaypercutElementsOptions): PaypercutElements;
|
|
875
|
+
/** Create an opaque Payment Method from an Elements group owned by this client. */
|
|
876
|
+
createPaymentMethod(options: PaypercutCreatePaymentMethodOptions): Promise<DeferredPaymentReference>;
|
|
877
|
+
/** Complete any required browser action and confirm a server-started payment. */
|
|
878
|
+
confirmPayment(options: PaypercutConfirmPaymentOptions): Promise<PaypercutConfirmPaymentResult>;
|
|
879
|
+
/** Exact advanced alias of confirmPayment; re-entry uses the same authoritative state machine. */
|
|
880
|
+
handleNextAction(options: PaypercutConfirmPaymentOptions): Promise<PaypercutConfirmPaymentResult>;
|
|
881
|
+
}
|
|
882
|
+
interface PaypercutStatic {
|
|
883
|
+
(options: PaypercutOptions): PaypercutInstance;
|
|
884
|
+
version: string;
|
|
885
|
+
}
|
|
886
|
+
|
|
483
887
|
declare const PaypercutExpressCheckout: ExpressCheckoutStatic;
|
|
484
888
|
|
|
889
|
+
declare const Paypercut: PaypercutStatic;
|
|
890
|
+
|
|
485
891
|
/**
|
|
486
892
|
* Factory function that works both as callable and constructable.
|
|
487
893
|
* Always returns a new CheckoutImpl instance - no prototype manipulation needed.
|
|
488
894
|
*/
|
|
489
895
|
declare const PaypercutCheckout: PaypercutCheckoutStatic;
|
|
490
896
|
|
|
491
|
-
export { ExpressSdkEvent, LOCALES, PaymentMethod, PaypercutCheckout, PaypercutExpressCheckout, SdkEvent, UIMode, WalletOption, PaypercutCheckout as default };
|
|
492
|
-
export type { Appearance, AppearanceVariables, ApplePayButtonStyle, CancelPayload, CheckoutInstance, EventName, ExpressBillingDetails, ExpressButtonOptions, ExpressButtonType, ExpressCheckoutInstance, ExpressCheckoutOptions, ExpressCheckoutShippingOption, ExpressCheckoutUpdateOptions, ExpressEventName, ExpressPaymentMethodCreatedEvent, ExpressPaymentMethodFailedEvent, ExpressSessionStartEvent, ExpressShippingAddress, ExpressShippingDetails, ExpressTokenPayload, FormValidationError, GooglePayButtonColor, LineItem, Locale, PaypercutCheckoutOptions, PaypercutCheckoutStatic, ShippingAddressChangeEvent, ShippingOptionChangeEvent, WalletType };
|
|
897
|
+
export { ExpressSdkEvent, LOCALES, PaymentMethod, Paypercut, PaypercutCheckout, PaypercutExpressCheckout, SdkEvent, UIMode, WalletOption, PaypercutCheckout as default };
|
|
898
|
+
export type { Appearance, AppearanceVariables, ApplePayButtonStyle, CancelPayload, CardCvcElement, CardElement, CardElementEventName, CardExpiryElement, CardFieldChangeEvent, CardFieldElement, CardFieldElementEventName, CardFieldElementType, CardNumberElement, CardNumberElementOptions, CheckoutInstance, DeferredPaymentReference, ElementsErrorCode, ElementsErrorEvent, ElementsResizeEvent, ElementsSubmitError, EventName, ExpressBillingDetails, ExpressButtonOptions, ExpressButtonType, ExpressCheckoutAddress, ExpressCheckoutAvailablePaymentMethodsChangeEvent, ExpressCheckoutBillingDetails, ExpressCheckoutCancelEvent, ExpressCheckoutClickEvent, ExpressCheckoutConfirmEvent, ExpressCheckoutElement, ExpressCheckoutElementEventName, ExpressCheckoutElementOptions, ExpressCheckoutInstance, ExpressCheckoutLineItem, ExpressCheckoutOptions, ExpressCheckoutPaymentMethodVisibility, ExpressCheckoutShippingOption, ExpressCheckoutUpdateOptions, ExpressCheckoutWallet, ExpressEventName, ExpressPaymentMethodCreatedEvent, ExpressPaymentMethodFailedEvent, ExpressSessionStartEvent, ExpressShippingAddress, ExpressShippingDetails, ExpressTokenPayload, FormValidationError, GooglePayButtonColor, KnownElementsErrorCode, LineItem, Locale, PaypercutBillingAddress, PaypercutBillingDetails, PaypercutCheckoutOptions, PaypercutCheckoutStatic, PaypercutConfirmPaymentOptions, PaypercutConfirmPaymentResult, PaypercutCreatePaymentMethodOptions, PaypercutCreatePaymentMethodParams, PaypercutElements, PaypercutElementsAppearance, PaypercutElementsAppearanceRuleProperty, PaypercutElementsAppearanceRuleSelector, PaypercutElementsAppearanceRules, PaypercutElementsAppearanceUpdates, PaypercutElementsAppearanceVariableName, PaypercutElementsAppearanceVariables, PaypercutElementsMode, PaypercutElementsOptions, PaypercutElementsUpdateOptions, PaypercutInstance, PaypercutOptions, PaypercutSetupFutureUsage, PaypercutStatic, ShippingAddressChangeEvent, ShippingOptionChangeEvent, WalletType };
|