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 themount(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
unmount method to reset the Element to its initial state.
Card Form Element
ThecardForm element is a secure card tokenization form.
Card form functions
Card form exposes the following functionsCard List Element
ThecardList element is a radio button list of the customer’s saved instruments.
Payment Button Element
ThecardButton 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
cardFormif the user will provide a new card. - with a
cardListif the user will pick an existing instrument. - with both
cardFormandcardListif the customer can provide a new card or use an existing instrument.
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 functionsGoogle Pay Element
ThegooglePayButton element is an authorization button for Google Pay.
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. TheGooglePayButton element otherwise has this logic encapsulated and will not render if the browser is not supported.c
Apple Pay Element
TheapplePayButton element is an authorization button for Apple Pay.
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. TheApplePayButton element otherwise has this logic encapsulated and will not render if the browser is not supported.
PayPal Element
ThepaypalButton element is an authorization button for PayPal.
PayPal FraudNet integration
Payrails SDK provides an easy way to integrate with PayPal FraudNet’s solution.Generic Redirect Element
ThegenericRedirectButton element is an authorization button for Generic Redirect payment methods.
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 functionsDynamic Element
ThedynamicElement element is an embedded form element for different payment methods.
Field types
The Dynamic Element automatically generates different field types based on the JSON schema, supported field types are:- Input Fields
- Select Fields
- Tab Fields
Field specific styling configuration
Dynamic element functions
Dynamic element exposes the following functionsLean 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
Thestyles.dialog object controls the appearance of the Lean checkout modal.