UNPKG

@adyen/adyen-web

Version:

[![npm](https://img.shields.io/npm/v/@adyen/adyen-web.svg)](https://www.npmjs.com/package/@adyen/adyen-web)

144 lines (143 loc) 6.12 kB
/// <reference types="applepayjs" /> import { UIElementProps } from '../types'; declare global { interface Window { ApplePaySession: ApplePaySession; } } type Initiative = 'web' | 'messaging'; export type ApplePayButtonType = 'plain' | 'buy' | 'donate' | 'check-out' | 'book' | 'subscribe' | 'add-money' | 'contribute' | 'order' | 'reload' | 'rent' | 'support' | 'tip' | 'top-up'; export type OnAuthorizedCallback = (resolve: (result?: ApplePayJS.ApplePayPaymentAuthorizationResult) => void, reject: (result?: ApplePayJS.ApplePayPaymentAuthorizationResult) => void, event: ApplePayJS.ApplePayPaymentAuthorizedEvent) => void; export interface ApplePayElementProps extends UIElementProps { /** * Used for analytics * @defaultValue false */ isExpress?: boolean; /** * Used for analytics */ expressPage?: 'cart' | 'minicart' | 'pdp' | 'checkout'; /** * The Apple Pay version number your website supports. * @default highest supported version by the shopper device * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_on_the_web_version_history Apple Pay on the Web Version History} */ version?: number; /** * The merchant’s two-letter ISO 3166 country code. */ countryCode: string; /** * Part of the 'ApplePayLineItem' object, which sets the label of the payment request * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaylineitem ApplePayLineItem docs} */ totalPriceLabel?: string; /** * @default 'final' */ totalPriceStatus?: ApplePayJS.ApplePayLineItemType; /** * ApplePay configuration sent by the /paymentMethods response */ configuration?: { merchantName?: string; merchantId?: string; }; clientKey?: string; initiative?: Initiative; /** * A set of line items that explain recurring payments and/or additional charges. */ lineItems?: ApplePayJS.ApplePayLineItem[]; /** * The payment capabilities supported by the merchant. * The value must at least contain ApplePayMerchantCapability.supports3DS. * @default ['supports3DS'] */ merchantCapabilities?: ApplePayJS.ApplePayMerchantCapability[]; /** * A set of shipping method objects that describe the available shipping methods. */ shippingMethods?: ApplePayJS.ApplePayShippingMethod[]; /** * How the items are to be shipped. */ shippingType?: ApplePayJS.ApplePayShippingType; /** * A list of ISO 3166 country codes for limiting payments to cards from specific countries. */ supportedCountries?: string[]; /** * The payment networks supported by the merchant. */ supportedNetworks?: string[]; /** * ApplePayRecurringPaymentRequest - Represents a request to set up a recurring payment, typically a subscription. * {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepayrecurringpaymentrequest} */ recurringPaymentRequest?: ApplePayJS.ApplePayRecurringPaymentRequest; /** * The billing information that you require from the user in order to process the transaction. */ requiredBillingContactFields?: ApplePayJS.ApplePayContactField[]; /** * The shipping information that you require from the user in order to fulfill the order. */ requiredShippingContactFields?: ApplePayJS.ApplePayContactField[]; /** * Billing contact information for the user. */ billingContact?: ApplePayJS.ApplePayPaymentContact; /** * Shipping contact information for the user. */ shippingContact?: ApplePayJS.ApplePayPaymentContact; /** * Optional user-defined data. */ applicationData?: string; onClick?: (resolve: any, reject: any) => void; onAuthorized?: OnAuthorizedCallback; onValidateMerchant?: (resolve: any, reject: any, validationURL: string) => void; /** * {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778013-onpaymentmethodselected} * @param resolve(ApplePayPaymentMethodUpdate update) Completes the selection of a payment method with an update. * @param reject() Completes the selection of a payment method with no update. * @param event The event parameter contains the paymentMethod attribute. */ onPaymentMethodSelected?: (resolve: any, reject: any, event: ApplePayJS.ApplePayPaymentMethodSelectedEvent) => void; /** * {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected} * @param resolve(ApplePayShippingContactUpdate update) Completes the selection of a shipping contact with an update. * @param reject() Completes the selection of a shipping contact with no update. * @param event The event parameter contains the shippingContact attribute. */ onShippingContactSelected?: (resolve: any, reject: any, event: ApplePayJS.ApplePayShippingContactSelectedEvent) => void; /** * {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778028-onshippingmethodselected} * @param resolve(ApplePayShippingMethodUpdate update) Completes the selection of a shipping method with an update. * @param reject() Completes the selection of a shipping method with no update. * @param event The event parameter contains the shippingMethod attribute. */ onShippingMethodSelected?: (resolve: any, reject: any, event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => void; buttonColor?: 'black' | 'white' | 'white-with-line'; buttonType?: ApplePayButtonType; /** * Show or hide the Apple Pay button */ showPayButton?: boolean; } export interface ApplePayElementData { paymentMethod: { type: string; applePayToken: string; }; } export interface ApplePaySessionRequest { displayName: string; domainName: string; initiative: Initiative; merchantIdentifier: string; } export {};