Customize your Web Unified Checkout

1. Layouts

Choose a layout that fits well with your UI pattern. There are two types of layout options as listed below. The layout defaults to accordion if not explicitly specified.

1.1 Accordion Layout

The accordion layout displays payment methods vertically using an accordion. To use this layout, set the value for layout to accordion. You also have the option to specify other properties, such as those shown in the following example:
var paymentElementOptions = {
  layout: {
    type: 'accordion',
    defaultCollapsed: false,
    radios: true,
    spacedAccordionItems: false
  },
}
or
var paymentElementOptions = {
  layout: 'accordion'
}

<PaymentElement id="payment-element" options={paymentElementOptions} />

1.2 Tabs Layout

The tabs layout displays payment methods horizontally using tabs. To use this layout, set the value for layout to tabs. You also have the option to specify other properties, such as tabs or collapsed:
var paymentElementOptions = {
  layout: 'tabs'
}

<PaymentElement id="payment-element" options={paymentElementOptions} />

2. Wallets

The wallet customization feature lets users configure payment options like Apple Pay, Google Pay, PayPal, and Klarna. It includes a walletReturnUrl for post-payment redirects and a style property to customize the wallet’s appearance, offering flexibility for seamless integration:
var paymentElementOptions = {
  wallets: {
    walletReturnUrl: `${window.location.origin}`,
    applePay: "auto",
    googlePay: "auto",
    payPal: "auto",
    klarna: "never",
    style: {
      theme: "dark",
      type: "default",
      height: 55,
      buttonRadius: 4,
    },
  },
}

<PaymentElement id="payment-element" options={paymentElementOptions} />
VariableDescriptionValues
walletReturnUrl: stringDefines the URL to redirect users to after completing a paymentThis will take a URL string as its value
applePay: showType
googlePay: showType
payPal: showType
klarna: showType
Determines the visibility of Apple Pay, Google Pay, PayPal, and KlarnashowType can take two values:
"auto": Display when supported
"never": Always hidden
style: { theme, type, height, buttonRadius }Configures the wallet’s appearance with the following options:
theme: Sets the theme
type: Defines the style type (e.g., buy)
height: Specifies the height of the wallet
buttonRadius: Adjusts the button corner radius
theme: Can take values as dark, light, or outline
type: Specifies the wallet button style with options including checkout, pay, buy, installment, default, book, donate, order, addmoney, topup, rent, subscribe, reload, support, tip, and contribute

3. Styling Variables

The Styling APIs can be used to blend the Unified Checkout with the rest of your app or website.
VariableDescription
fontFamilyThe font family used throughout Widgets. Widget supports CSS fonts and custom fonts by passing the fonts option; reference to elements consumer
fontSizeBaseThe font size that’s set on the root of the Widget. By default, other font size variables like fontSizeXs or fontSizeSm are scaled from this value using rem units
spacingUnitThe base spacing unit that all other spacing is derived from. Increase or decrease this value to make your layout more or less spacious
borderRadiusThe border radius used for tabs, inputs, and other components in the Widget
colorPrimaryA primary color used throughout the Widget. Set this to your primary brand color
colorBackgroundThe color used for the background of inputs, tabs, and other components in the Widget
colorTextThe default text color used in the Widget
colorDangerA color used to indicate errors or destructive actions in the Widget
fontVariantLigaturesThe font-variant-ligatures setting of text in the Widget
fontVariationSettingsThe font-variation-settings setting of text in the Widget
fontWeightLightThe font weight used for light text
fontWeightNormalThe font weight used for normal text
fontWeightMediumThe font weight used for medium text
fontWeightBoldThe font weight used for bold text
fontLineHeightThe line-height setting of text in the Widget
fontSizeXlThe font size of extra-large text in the Widget. By default this is scaled from var(--fontSizeBase) using rem units
fontSizeLgThe font size of large text in the Widget. By default this is scaled from var(--fontSizeBase) using rem units
fontSizeSmThe font size of small text in the Widget. By default this is scaled from var(--fontSizeBase) using rem units
fontSizeXsThe font size of extra-small text in the Widget. By default this is scaled from var(--fontSizeBase) using rem units
fontSize2XsThe font size of double-extra small text in the Widget. By default this is scaled from var(--fontSizeBase) using rem units
fontSize3XsThe font size of triple-extra small text in the Widget. By default this is scaled from var(--fontSizeBase) using rem units
colorSuccessA color used to indicate positive actions or successful results in the Element
colorWarningA color used to indicate potentially destructive actions in the Element
colorPrimaryTextThe color of text appearing on top of any var(--colorPrimary) background
colorBackgroundTextThe color of text appearing on top of any var(--colorBackground) background
colorSuccessTextThe color of text appearing on top of any var(--colorSuccess) background
colorDangerTextThe color of text appearing on top of any var(--colorDanger) background
colorWarningTextThe color of text appearing on top of any var(--colorWarning) background
colorTextSecondaryThe color used for text of secondary importance. For example, this color is used for the label of a tab that isn’t currently selected
colorTextPlaceholderThe color used for input placeholder text in the Widget

4. Rules

The rules option is a map of CSS-like selectors to CSS properties, allowing granular customization of individual components. After defining your theme and variables, use rules to seamlessly integrate Elements to match the design of your site. The selector for a rule can target any of the public class names in the Element, as well as the supported states, pseudo-classes, and pseudo-elements for each class. For example, the following are valid selectors:
  • .Tab, .Label, .Input, .InputLogo, .SaveWalletDetailsLabel, .OrPayUsingLabel, .TermsTextLabel, .InfoElement, .OrPayUsingLine
  • .Tab:focus
  • .Input--invalid, .Label--invalid, .InputLogo--invalid
  • .Input::placeholder
  • .billing-section, .billing-details-text
  • .Input--empty, .InputLogo--empty
Each class name used in a selector supports an allowlist of CSS properties that you specify using camel case (for example, boxShadow for the box-shadow property).

Supported Class Names

Tabs

Class NameStatesPseudo-ClassesPseudo-Elements
.Tabs--selected:hover, :focus, :active, :disabled
.Tab--selected:hover, :focus, :active, :disabled

Form Inputs

Class NameStatesPseudo-ClassesPseudo-Elements
.Label--empty, --invalid
.Input--empty, --invalid:hover, :focus, :disabled, :autofill::placeholder, ::selection
.Error

Checkbox

Class NameStatesPseudo-ClassesPseudo-Elements
.Checkbox--checked:hover
.CheckboxLabel--checked:hover
.CheckboxInput--checked:hover
Class NameStatesPseudo-ClassesPseudo-Elements
.InputLogo--invalid, --empty:hover

Other Elements

Class NameStatesPseudo-ClassesPseudo-Elements
.SaveWalletDetailsLabel:hover
.OrPayUsingLabel:hover
.OrPayUsingLine:hover
.TermsTextLabel:hover
.InfoElement:hover

Example Usage

const appearance = {
  variables: {
    buttonBackgroundColor: "#FFFFFF",
    buttonTextColor: "#000000",
    // ... along with other variables
  },
  rules: {
    ".TabLabel": {
      overflowWrap: "break-word",
    },
    ".Tab--selected": {
      display: "flex",
      gap: "8px",
      flexDirection: "row",
      justifyContent: "center",
      alignItems: "center",
      padding: "15px 32px",
      background: "linear-gradient(109deg,#f48836,#f4364c)",
      color: "#ffffff",
      fontWeight: "700",
      borderRadius: "25px",
    },
    ".Tab--selected:hover": {
      display: "flex",
      gap: "8px",
      flexDirection: "row",
      justifyContent: "center",
      alignItems: "center",
      padding: "15px 32px",
      background: "linear-gradient(109deg,#f48836,#f4364c)",
      borderRadius: "25px",
      color: "#ffffff !important",
      fontWeight: "700",
    },
  },
};

const elements = hyper.elements({ clientSecret, appearance });

5. Languages

vaultera switch Unified Checkout supports localization in multiple languages. By default, the Unified Checkout SDK will detect the locale of the customer’s browser and display the localized version of the payment sheet if that locale is supported. In case it is not supported, we default to English. To override, you can send locale in hyper.elements(options).

Supported Locales

  • Arabic (ar)
  • Catalan (ca)
  • Chinese (zh)
  • German (de)
  • Dutch (nl)
  • English (en)
  • English GB (en-GB)
  • French Belgium (fr-BE)
  • French (fr)
  • Hebrew (he)
  • Italian (it)
  • Japanese (ja)
  • Polish (pl)
  • Portuguese (pt)
  • Russian (ru)
  • Spanish (es)
  • Swedish (sv)
If you need support for locales other than the ones mentioned above, please contact the vaultera switch team.

6. Confirm Button

The Styling APIs can be used to blend the Confirm Payment Button (handled by SDK) with your app.
VariableDescription
buttonBackgroundColorSets the background color of the payment button
buttonHeightDefine the height of the payment button
buttonWidthSpecify the width of the payment button
buttonBorderRadiusAdjust the border radius of the payment button for rounded corners
buttonBorderColorSets the color of the border surrounding the payment button
buttonTextColorDefine the color of the text displayed on the payment button
buttonTextFontSizeCustomize the font size of the text on the payment button
buttonTextFontWeightSpecify the font weight of the text on the payment button
buttonBorderWidthSpecify the border width of the button

7. More Configurations

Branding

You can decide whether to display the vaultera switch branding using the branding prop:
var paymentElementOptions = {
  // ...
  branding: "never", // choose between "never" and "always"
}

<PaymentElement id="payment-element" options={paymentElementOptions} />

Payment Methods Header Text

Customize the header text for the section displaying available payment methods:
var paymentElementOptions = {
  // ...
  paymentMethodsHeaderText: "Select Payment Method",
}

<PaymentElement id="payment-element" options={paymentElementOptions} />

Saved Payment Methods Header Text

Customize the header text for the section displaying saved payment methods:
var paymentElementOptions = {
  // ...
  savedPaymentMethodsHeaderText: "Saved Payment Methods",
}

<PaymentElement id="payment-element" options={paymentElementOptions} />

Custom Message for Card Terms

We provide a default message for card terms:
By providing your card information, you allow ${company_name} to charge your card for future payments in accordance with their terms.
If you would like to customize this message, you can do so by using the customMessageForCardTerms property:
var paymentElementOptions = {
  // ...
  customMessageForCardTerms: "Custom message for Card terms",
}

<PaymentElement id="payment-element" options={paymentElementOptions} />

Hide Card Nickname Field

The hideCardNicknameField property allows you to hide the card nickname field when saving a card:
var paymentElementOptions = {
  // ...
  hideCardNicknameField: true,  // default - false
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Hide Expired Saved Payment Methods

The hideExpiredPaymentMethods property allows you to control whether expired saved payment methods are hidden or not:
var paymentElementOptions = {
  // ...
  hideExpiredPaymentMethods: false, // default - false
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Show Card Form by Default

The showCardFormByDefault property determines whether the card form is displayed by default or not:
var paymentElementOptions = {
  // ...
  showCardFormByDefault: true,
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Terms

The terms property allows you to configure the display of terms for various payment methods:
var paymentElementOptions = {
  // ...
  terms: {
    auBecsDebit: "always",
    bancontact: "auto",
    card: "never",
    ideal: "auto",
    sepaDebit: "always",
    sofort: "never",
    usBankAccount: "auto",
  },
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Display Saved Payment Methods

The displaySavedPaymentMethods property determines whether saved payment methods are displayed:
var paymentElementOptions = {
  // ...
  displaySavedPaymentMethods: false,
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Display Saved Payment Methods Checkbox

The displaySavedPaymentMethodsCheckbox property determines whether the “Save payment methods” checkbox is displayed:
var paymentElementOptions = {
  // ...
  displaySavedPaymentMethodsCheckbox: false, 
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Payment Method Order

The paymentMethodOrder property allows you to specify the order in which payment methods are displayed:
var paymentElementOptions = {
  // ...
  paymentMethodOrder: ["card", "ideal", "sepaDebit", "sofort"],
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Business

The business property allows you to specify a business name to be attached to the terms. By default, the merchant name will be taken as the business name:
var paymentElementOptions = {
  // ...
  business: {
    name: "Example Business",
  },
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Read Only

The readOnly property puts the SDK into read-only mode, disabling all interactions:
var paymentElementOptions = {
  // ...
  readOnly: true,
};

<PaymentElement id="payment-element" options={paymentElementOptions} />

Show Short Surcharge Message

The showShortSurchargeMessage property allows merchants to display a short message when a surcharge is applied, instead of the default message provided by the SDK. The short message format will be: Fee:
var paymentElementOptions = {
  // ...
  showShortSurchargeMessage: true, // default - false
};

<PaymentElement id="payment-element" options={paymentElementOptions} />
Now you can test the payments on your app and go live!