Embedded Components Overview
Learn how to use Payabli’s embedded components to create customized checkout experiences without handling sensitive payment information yourself
Embedded UI components are a JavaScript-based collection and tokenization system and a full payments API. You can use the embedded components in conjunction with the Payabli API to submit transactions or for other Payabli services that use payment information.
Choose a component
To decide which embedded component to use, consider the functionality you need for your app. Payabli offers embedded components tailored to different use cases:
EmbeddedMethod UI
Capture a payment method or make a sale using any payment method. This is the most flexible component. It’s ideal for tokenizing payment methods or making sales directly from your page.
ExpressCheckout UI
Add acceptance for digital wallet payments like Apple Pay. It can be paired with other components to give your customer a range of options.
VirtualTerminal UI
Embed a virtual terminal tool in your page or app, letting you add secure payment acceptance in a contained environment.
PayMethod UI
Save payment method data without expanding your PCI scope. This component is a modal that opens over content, and is designed only for storing payment methods.
Which component is right for you depends on whether you need to make transactions, save payment method data, or both. For example, if you need to both save a payment method and execute payments, the EmbeddedMethod UI might be the best choice. If you just need to make transactions from your website or app, the VirtualTerminal UI could be the right choice. Overall, the EmbeddedMethod UI is our most popular and flexible option.
You can extend the EmbeddedMethod UI and PayMethod UI components even further by using a flow designed around returning a temporary payment token. See Extend Embedded Components with the Temporary Token Flow for more.
Library URLs
See the component.js Changelog to see the latest changes.
Beginning October 22, 2023 embedded components no longer supports versions older than 1.9.0.
The sandbox and production library URLs are evergreen, meaning that the URL always points to the latest version.
- Sandbox:
https://embedded-component-sandbox.payabli.com/component.js
- Production:
https://embedded-component.payabli.com/component.js
You must add the data-test
configuration variable to your script tag when using the sandbox library. Don’t include data-test when working with the production library.
Usage
Component configuration is covered in the Configuration reference section of the documentation for each component type.
Payabli designed the embedded components for flexibility. Implementation can be as uncomplicated as pasting a single script tag to your checkout page, or you can customize them to interact with your website. The components require loading the component.js library to work.
The component.js
contains the code for the PayabliComponent className
. You can use several instances of the PayabliComponent className
in the same page extending the functionality provided in your application.
Authentication
Authenticate via token
key passed in the embedded component’s configuration. Configuration is covered in the documentation for each component.
PayabliComponent className
The PayabliComponent className
has the following methods:
Shows the component if it’s hidden.
Hides the component.
Replaces the component configuration. See this CodePen for an example.
Triggers an action. Valid actions are method
, pay
, auth
and reinit
. parameters
is an optional structure that lets you dynamically overwrite the matching fields passed via configuration for customerData
and paymentDetail
.
Here’s an example:
Customize component styling
Customize your component by providing a URL to a custom CSS file in the parameter customCssUrl
in the component configuration.
Make the component background transparent
By default, the embedded components have a white background. To make the component’s background transparent, add the following CSS to the stylesheet that’s linked with the customCssUrl
parameter:
Component containers
Each component creates a container for the iframe with a specific ID:
- EmbeddedMethod:
payabliComponentsIframeContainerMethodEmbedded
- PayMethod:
payabliComponentsIframeContainerMethod
- VirtualTerminal:
payabliComponentsIframeContainerEterminal
Component elements
You can also make reference and create custom styles for specific elements inside of the component using these IDs:
ID | Element |
---|---|
cardNumber | Card number input |
cardNumberContainer | Card number container |
cardExpirationDate | Card expiration date input |
cardExpirationDateContainer | Card expiration date container |
cardCvv | Card CVV input |
cardCvvContainer | Card CVV container |
cardZipcode | Card zip code input |
cardZipcodeContainer | Card zip code container |
cardHolderName | Cardholder name input |
cardHolderNameContainer | Cardholder name container |
achAccountType | Bank account type selector |
achAccountTypeContainer | Bank account type container |
achAccountHolderName | Bank account holder input |
achAccountHolderNameContainer | Bank account holder container |
achRouting | Bank routing input |
achRoutingContainer | Bank routing container |
achAccount | Bank account input |
achAccountContainer | Bank account container |
This example targets the card number, expiration date, CVV, zip code, and cardholder name fields. It adds a solid, 1 pixel black border to the fields.
Style individual fields
Components are flexible widgets. You can array the input fields inside of the container and change labels and placeholders. The component doesn’t have a button triggering any action so you need to create one via code.
The internal design of the component is a grid with 3 rows and 12 columns. This feature allows developers to specify size and placement of each input in the grid without any CSS manipulation.
Row 0 | ||||||||||||
Row 1 | Size=2 | Size=3 | Size=5 | Size=1 | Size=1 | |||||||
Row 2 | Size=8 | Size=4 | Size=1 |
You can style inputs in the component configuration using these parameters:
Field/Parameter | Description |
---|---|
label | string. Label for input field. |
placeholder | string. Placeholder for input field. |
floating | boolean. Enable/disable floating label within input field. Default is true |
value | string. Value for input field. |
size | integer. Size of input field in columns (1-12). |
row | integer. Row to place the input within component grid (0-2), 0 being the top row. |
order | integer. Order of input field within the row (0-99+), 0 being the left position. |
confirm | boolean. For |
country | array[string]. For |
Here are examples of different input configurations:
Example without customizations
This is the look of the EmbeddedMethod component without customizations:
Card
ACH
Example with customizations
This is an example of the EmbeddedMethod component with a custom CSS file and using input field descriptors.
See this example in CodePen:
Notice how the functionCallBackReady
is triggered when the input fields are validated in the component showing or hiding the Submit button.
Handling responses and errors
Responses are returned in functionCallBackSuccess
and functionCallBackError
.
This is a general response handling example. Check the response object reference for the embedded component you’re using for other userful data you can access.
Learn more about response codes and errors in the reference doc.
Playground
The Embedded Component Playground lets you experiment with some component types with a live preview in your browser. Learn more about the Playground in the changelog.
Was this page helpful?