UNPKG

airwallex-payment-elements

Version:

[![Version](https://img.shields.io/npm/v/airwallex-payment-elements.svg)](https://www.npmjs.org/package/airwallex-payment-elements) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://git

153 lines (148 loc) 5.42 kB
import { PaymentMethodType, BoxStyle, Appearance, CardNetwork } from './element'; import { Mode, RecurringOptions, Billing, AuthorizationType } from './airwallex'; import { ApplePayHppOrDropInRequestOptions, GooglePayRequestOptions, ContactField, LPMFlows } from './element'; interface WeChatPayFlow { desktopFlow?: LPMFlows; mobileFlow?: LPMFlows; } interface DropinTheme { palette?: { primary?: string; }; } /** * Apply to `dropIn` element type integration, interface used when `createElement` called with type `dropIn` */ export interface DropInElementOptions { /** * The layout of each element stays consistent, but you can modify confirm button, inputs, and more. */ appearance?: Appearance; /** * The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object. */ client_secret: string; /** * The three-letter ISO currency code representing the currency of the Payment Intent or Payment Consent. */ currency: string; /** * When using Payments for Platforms, specify the ID of the connected account associated with the payment if you want to use its information to process the payment. * For example, the statement descriptor displayed on the shopper's credit card or bank statement and the payment methods activated by the connected account. * */ platformConnectedAccount?: string; /** * The checkout mode for the shopper, `'payment'` or `'recurring'`. * @defaultValue `'payment'` */ mode?: Mode; /** * The payment methods your website would like to integrate with * @deprecated use {@link methods} instead */ components?: Array<PaymentMethodType>; /** * The payment methods your website would like to integrate with. */ methods?: Array<PaymentMethodType>; /** * Whether the amount should be captured automatically upon successful payment authorization. * Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later. * @defaultValue `true` */ autoCapture?: boolean; /** * The authorization type for the card payment. * Set it to `pre_auth` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window. * Currently `pre_auth` is only available when the card brand is Visa or Mastercard. `autoCapture` will be automatically set to `false` if you enable `pre_auth`. * @defaultValue `'final_auth'` */ authorizationType?: AuthorizationType; /** * Whether you require the shopper to provide CVC when they checkout with a network tokenized card. */ cvcRequired?: boolean; /** * One or more card networks that you support. */ allowedCardNetworks?: CardNetwork[]; /** * The options for Wechat Pay. */ wechatpay?: WeChatPayFlow; /** * Checkout configuration options for Apple Pay. */ applePayRequestOptions?: ApplePayHppOrDropInRequestOptions; /** * Checkout configuration options for Google Pay. */ googlePayRequestOptions?: GooglePayRequestOptions; /** * Indicate to improve 3DS experience, indicate if the payment form will collect billing info from shopper * @deprecated please use {@link requiredBillingContactFields} instead */ withBilling?: boolean; /** * The billing information that you require from the user in order to process the transaction. */ requiredBillingContactFields?: ContactField[]; /** * Box style for the dropIn element. */ style?: BoxStyle; /** * The container of the authentication form used in 3D Secure authentication. */ authFormContainer?: string; /** * The ID of the Payment Intent you would like to checkout. Required when `mode` is `'payment'`. */ intent_id?: string; /** * The ID of the Customer used in registered user checkout. Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro) * This field is required when `mode` is `'recurring'`. */ customer_id?: string; /** * Options for recurring flow. */ recurringOptions?: RecurringOptions; /** * The two-letter ISO country code of the shopper's country. This is required for `bank_transfer`, `online_banking`, `skrill` or `seven_eleven` payment methods. */ country_code?: string; /** * The shopper's full name. */ shopper_name?: string; /** * The shopper's phone number. */ shopper_phone?: string; /** * The shopper's email address. */ shopper_email?: string; /** * Billing information provided by the merchant. * This option overrides the billing information from the shopper as provided in the input billing fields. Do not set `withBilling` and `requiredBillingContactFields` when you use this option. */ billing?: Billing; /** * Customize DropIn Element style. */ theme?: DropinTheme; /** * Specifies whether the card payment method should be automatically saved for future transactions. * * This parameter is only effective in payment mode when a `customer_id` is provided. * * - If set to `true`, the "Save my card for future payments" checkbox will be preselected by default. * - If set to `false`, the checkbox will remain unchecked, requiring the shopper to manually opt in. * * @defaultValue `true` */ autoSaveCardForFuturePayments?: boolean; }