Skip to main content

Get started

Although each Element (cards, Apple Pay, Google Pay, PayPal, etc) has its own signature, they follow a similar implementation.

Create the Element

Mount the Element to your DOM

When the mount(containerId) method of the Element is called, the Element will be inserted in the specified div. For instance, the call below will insert the Element into the div with the id #element-container.

HTML

JavaScript

You can use the unmount method to reset the Element to its initial state.

Card Form Element

The cardForm element is a secure card tokenization form.
The Card Form configuration is defined as shown below:

Card form functions

Card form exposes the following functions

Card List Element

The cardList element is a radio button list of the customer’s saved instruments.
The Card Form configuration is defined as shown below:

Payment Button Element

The cardButton element is the card payment authorization button. The cardButtoncan collect the content of the cardForm and cardList Elements. So, it would typically be used:
  • alone if there are no payment instruments to decide.
  • with a cardForm if the user will provide a new card.
  • with a cardList if the user will pick an existing instrument.
  • with both cardForm and cardList if the customer can provide a new card or use an existing instrument.
The Payment Button configuration is defined as shown below:

onAuthorizeFailed() errors

callback receives the object describing the error that happened
TypeScript

Failure reasons explanation

VALIDATION_FAILED: onPaymentButtonClicked wasn’t resolved to true AUTHORIZATION_ERROR: authorization failed, no technical reason. Details are in the message (different for 3DS) AUTHENTICATION_ERROR: token used in SDK is invalid UNKNOWN_ERROR: all other errors

onPaymentButtonClicked() event

Callback receives the object, containing:
TypeScript

Payment Button functions

Payment Button exposes the following functions

Google Pay Element

The googlePayButton element is an authorization button for Google Pay.
The Google Pay button configuration is defined as shown below:

Google Pay availability

Payrails client provides the method to check if Google Pay is available in the current browser/client session. This is only necessary if one needs to know in advance if the payment method is supported. The GooglePayButton element otherwise has this logic encapsulated and will not render if the browser is not supported.c

Apple Pay Element

The applePayButton element is an authorization button for Apple Pay.
The Apple Pay button configuration is defined as shown below:

Apple Pay availability

Payrails client provides the method to check if Apple Pay is available in the current browser/client session. This is only necessary if one needs to know in advance if to render the element. The ApplePayButton element otherwise has this logic encapsulated and will not render if the browser is not supported.

PayPal Element

The paypalButton element is an authorization button for PayPal.
The PayPal button configuration is defined as shown below:

PayPal FraudNet integration

Payrails SDK provides an easy way to integrate with PayPal FraudNet’s solution.

Generic Redirect Element

The genericRedirectButton element is an authorization button for Generic Redirect payment methods.
The Generic Redirect button configuration is defined as shown below:
Note: not all events are applicable for all generic redirect payment methods.

Style config to match brand guidelines

For the following payment methods, SDK provides look and feel for the button according to the brand guidelines.

Revolut Pay

Generic Redirect functions

Generic Redirect exposes the following functions

Dynamic Element

The dynamicElement element is an embedded form element for different payment methods.
The dynamic element configuration is defined as shown below:

Field types

The Dynamic Element automatically generates different field types based on the JSON schema, supported field types are:
  1. Input Fields
  2. Select Fields
  3. Tab Fields

Field specific styling configuration

Dynamic element functions

Dynamic element exposes the following functions

Lean Element

Lean enables users in the UAE to pay via bank transfer using a checkout dialog powered by the Lean SDK. The payment method is available as both a standalone Element and within the Drop-in integration.
ImportantThe Lean payment button must use the label “Pay by bank with Al Tareq.”

How to Use


Configuration

The Lean Elements configuration is defined as shown below. All properties are optional configure them based on your requirements.

Dialog Customization

The styles.dialog object controls the appearance of the Lean checkout modal.

Event Callbacks

You can read details of event callbacks here.
Last modified on September 30, 2026