Skip to navigation

ExpressCheckout UI

Learn how to use the ExpressCheckout UI component on your site or in your app to securely accept digital wallet payments
Applies to:Developers

The ExpressCheckout component lets you embed an express checkout for digital wallets inside your website or application.

an image of an ExpressCheckout component rendered on a site

Usage

This component lets you add a robust low-code way to accept payments from a digital wallet to your pages or apps.

See Library URLs for important information about embedded components library URLs.

Step 1: Include the Payabli component

Add the script to the <body> element of your HTML.

Sandbox
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
</body>
</html>

You need to include <meta charset="UTF-8"> in the <head> element of your HTML to prevent problems with special characters such as ‘á’ or ‘ñ’.

Step 2: Define the component container

Add the container to your HTML. This <div> tag is where the page renders the component. The ID is the identifier for rootContainer in your component configuration.

Sandbox
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="pay-component-2"></div>
<script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
</body>
</html>

Step 3: Configure the component

Define the component configuration in a script block immediately after component.js and create an instance of the component. See the Configuration section for a full reference of options.

Full configuration example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="express-checkout-component"></div>
<script type="text/javascript" src="https://embedded-component-sandbox.payabli.com/component.js">
//Use the correct version for your environment
</script>
<script>
var token = ""; // Input your Public Organization API Token here:
var entryPoint = ""; // Input your paypoint entryName here:
var expressCheckoutConfig = {
token: token,
type: "expressCheckout",
entryPoint: entryPoint,
rootContainer: "express-checkout-component",
//customCssUrl: "your url to a custom css file",
expressCheckout: {
amount: 100,
fee: 0.01,
currency: "USD",
supportedNetworks: ["visa"],
columns: 1,
applePay: {
enabled: true,
buttonStyle: "black-outline",
buttonType: "plain",
language: "en-US",
},
requiredShippingContactFields: true,
appearance: {
buttonHeight: 50, // optional
buttonBorderRadius: 10, // optional
padding: {
x: 10, // optional
y: 10, // optional
},
},
},
customerData: {
customerNumber: "00001",
firstName: "John",
lastName: "Doe",
billingEmail: "johndoe@email.com"
},
functionCallBackReady: function(data) {
console.log('Apple Pay ready: ', data)
},
functionCallBackSuccess: function(data) {
console.log('Apple Pay Success: ', data)
},
functionCallBackError: function(data) {
console.log('Apple Pay Error: ', data)
},
functionCallBackCancel: function(data) {
console.log('Apple Pay Cancel: ', data)
},
}
new PayabliComponent(payabliConfig0);
</script>
</body>
</html>

Step 4: Style the component

Information about styling embedded components is available in Embedded Components Overview.

Configuration reference

These are the configuration parameters available for the ExpressCheckout component.

The component accepts only the data below. If you need to pass more data than what’s supported, consider using the temporary token flow.

type
stringRequired

This value determines the type of embedded component to render.
Accepted values are: methodEmbedded, methodLightbox, vterminal, or expressCheckout.
For the ExpressCheckout UI, this value is expressCheckout. See the Embedded Components Overview for more information on other component types.

rootContainer
stringRequired

Container ID used for the component.

token
stringRequired

API token for authentication. This should be a public API token, as described here.

entryPoint
stringRequired

When the API token belongs to an organization, the entrypoint name identifies the target paypoint (merchant).

customCssUrl
string

Complete URL of a custom CSS stylesheet to use with the component.

expressCheckout
objectRequired

Configuration for the express checkout functionality.

amount
numberRequired

The amount for the transaction.

fee
numberRequired

The fee for the transaction.

currency
stringRequired

The currency for the transaction.

columns
objectDefaults to 1

Define the number of columns to use for digital wallet display.

supportedNetworks
string[]Required

Card networks to accept payments from. Suggested options:

  • amex
  • visa
  • discover
  • masterCard
  • jcb
applePay
objectRequired
enabled
booleanRequired

When true, Apple Pay is enabled.

buttonStyle
enumDefaults to black

The Apple Pay button style. Supported options:

  • “black”: Default black button.
  • “white-outline”: White button with an outline.
  • “white”: Solid white button.
buttonType
enumDefaults to plain

The text on Apple Pay button. Supported options:

Button TypeDescriptionText on Apple Pay Button
"plain"An Apple Pay button with the Apple Pay logo only, useful when an additional call to action isn’t needed.Apple Pay logo only (no text)
"buy"Use this button for product purchases.Buy with Apple Pay logo
"donate"Used by approved nonprofits. Lets people make donations.Donate with Apple Pay logo
"check-out"Use this button for purchase experiences that include other payment buttons that start with “Check out”.Check Out with Apple Pay logo
"book"Use this button for booking appointments, flights, or other experiences.Book with Apple Pay logo
"continue"Use this button for general purchases.Continue with Apple Pay logo
"top-up"Use this button for adding money to an account, or payment system.Top Up with Apple Pay logo
"order"Use this button for placing orders for items.Order with Apple Pay logo
"rent"Use this button for renting items such as equipment or cars.Rent with Apple Pay logo
"support"Use this button for helping people give money to projects, causes, organizations, and other entities.Support with Apple Pay logo
"contribute"Use this button to help people give money to projects, causes, organizations, and other entities.Contribute with Apple Pay logo
"tip"Use this button to let people tip for goods or services.Tip with Apple Pay logo
"pay"Use this button for general purchases.Pay with Apple Pay logo
language
enumDefaults to en-us

The Apple Pay button locale. Supported options:

  • en-US: English (US)
  • ar-AB: Arabic
  • ca-ES: Catalan
  • zh-CN: Chinese (China)
  • zh-HK: Chinese (Hong Kong)
  • zh-TW: Chinese (Taiwan)
  • hr-HR: Croatian
  • cs-CZ: Czech
  • da-DK: Danish
  • de-DE: German
  • nl-NL: Dutch
  • en-AU: English (Australia)
  • en-GB: English (UK)
  • fi-FI: Finnish
  • fr-CA: French (Canada)
  • fr-FR: French (France)
  • el-GR: Greek
  • he-IL: Hebrew
  • hi-IN: Hindi
  • hu-HU: Hungarian
  • id-ID: Indonesian
  • it-IT: Italian
  • ja-JP: Japanese
  • ko-KR: Korean
  • ms-MY: Malay
  • nb-NO: Norwegian
  • pl-PL: Polish
  • pt-BR: Portuguese (Brazil)
  • pt-PT: Portuguese (Portugal)
  • ro-RO: Romanian
  • ru-RU: Russian
  • sk-SK: Slovak
  • es-MX: Spanish (Mexico)
  • es-ES: Spanish (Spain)
  • sv-SE: Swedish
  • th-TH: Thai
  • tr-TR: Turkish
  • uk-UA: Ukrainian
  • vi-VN: Vietnamese
requiredShippingContactFields
boolean

When this field is true, the following fields ["postalAddress", "name", "phoneticName", "phone", "email"] are required. They will be sent with the payment and can be read through the callbacks.

appearance
object
buttonHeight
numberDefaults to 44

Height of the button.

buttonBorderRadius
numberDefaults to 4

Border radius of the button.

padding
object
x
numberDefaults to 8

Horizontal padding.

y
numberDefaults to 11

Vertical padding.

customerData
objectRequired
customerNumber
stringRequired

Customer’s identification number.

firstName
stringRequired

Customer’s first name.

lastName
stringRequired

Customer’s last name.

billingEmail
stringRequired

Customer’s billing email address.

functionCallBackReady
function

Triggered when the ExpressCheckout component is ready to use.

functionCallBackSuccess
function

Triggered upon successful completion of a digital wallet transaction.

functionCallBackError
function

Triggered if an error occurs during the digital wallet transaction.

functionCallBackCancel
function

Triggered if the user cancels the digital wallet transaction.

Response examples

functionCallbackReady response

This response is triggered when the component is ready to use.

{
applePay: true,
googlePay: false
}
applePay
boolean

When true, the component is ready to accept Apple Pay.

googlePay
boolean

Not in use yet.

functionCallbackSuccess response

When a transaction is successfully completed via the ExpressCheckout component, the functionCallBackSuccess response is triggered.

In the response, the referenceId is the transaction ID you can use for other operations.

{
"data": {
"isSuccess": true,
"pageIdentifier": "t.XMzKRgtV6eJrI2Fsn45RLKuRujHi53qDnsizyJXNM7ChdejoRNOdb0Dm7VXQ3H/aBVMu+14IB9sOS1hbZF/kXMKgUY94nspVI+mRSphe8HeSwbr5OxLUSmu0Uuc6RmDzaLUYXn8eDr…",
"responseData": {
"authCode": "",
"avsResponseText": null,
"billingContact": {
"addressLines": [
"9425 SW 172nd Pl"
],
"administrativeArea": "FL",
"country": "United States",
"countryCode": "US",
"familyName": "Martinez",
"givenName": "Fernando",
"locality": "Miami",
"phoneticFamilyName": "",
"phoneticGivenName": "",
"postalCode": "33197",
"subAdministrativeArea": "",
"subLocality": ""
},
"customerId": 6886,
"cvvResponseText": null,
"methodReferenceId": null,
"referenceId": "1148-2305e2cb80eb5969920f2cf9f2565455",
"resultCode": 1,
"resultText": "Approved",
"shippingContact": {
"addressLines": [
"9425 SW 172nd Pl"
],
"administrativeArea": "FL",
"country": "United States",
"countryCode": "US",
"emailAddress": "fernandotest@payabli.com",
"familyName": "Martinez",
"givenName": "Fernando",
"locality": "Miami",
"phoneNumber": "4089752020",
"phoneticFamilyName": "4192412942195",
"phoneticGivenName": "941924129412943",
"postalCode": "33197",
"subAdministrativeArea": "",
"subLocality": ""
}
},
"responseText": "Success"
},
"paymentMethod": "apple_pay"
}
responseText
string

“Success” or “Declined”

responseData
object

Container for response details.

responseData.authCode
string

Authorization code for payments.

responseData.referenceId
string

Identifier for the transaction (for payments) or the stored payment method (for save payment method).

responseData.resultCode
integer

Result of operation. 1 is success, 2 is declined, and 3 is error.

responseData.resultText
string

Message related the result. If the operation was successful, it returns “Added”/“Approved”. If there was an error, it returns error details.

responseData.customerId
integer

ID for the customer owner of payment.

responseData.avsResponseText
string

Text code describing the result for address validation.

responseData.cvvResponseText
string

Text code describing the result for CVV validation.

responseData.methodReferenceId
string

The stored method’s identifier (sometimes referred to as ‘token’) in Payabli. When null, the method wasn’t created, or doesn’t exist, depending on the operation performed.

responseData.billingContact
object

The billing contact information.

addressLines
array

The street portion of the address for the contact. For example: 123 Main Street.

administrativeArea
string

The contact’s state. For example, CA.

country
string

Billing country.

countryCode
string

The contact’s ISO 3166 country code.

emailAddress
string

The contact’s email address.

familyName
string

The contact’s family name, also known as last name.

givenName
string

The contact’s given name, also known as first name.

locality
string

The contact’s city. For example, Los Angeles.

phoneticFamilyName
string

Specifies the pronunciation of the contact’s last name.

phoneticGivenName
string

Specifies the pronunciation of the contact’s first name.

postalCode
string

The contact’s postal code.

subAdministrativeArea
string

The contact’s county or other region.

subLocality
string

Additional information associated with the contact’s address.

responseData.shippingContact
object

Shipping address and contact information for the transaction.

addressLines
array

The street portion of the address for the contact. For example: 123 Main Street.

administrativeArea
string

The contact’s state. For example, CA.

country
string

Billing country.

countryCode
string

The contact’s ISO 3166 country code.

emailAddress
string

The contact’s email address.

familyName
string

The contact’s family name, also known as last name.

givenName
string

The contact’s given name, also known as first name.

locality
string

The contact’s city. For example, Los Angeles.

phoneNumber
string

The contact’s phone number.

phoneticFamilyName
string

Specifies the pronunciation of the contact’s last name.

phoneticGivenName
string

Specifies the pronunciation of the contact’s first name.

postalCode
string

The contact’s postal code.

subAdministrativeArea
string

The contact’s county or other region.

subLocality
string

Additional information associated with the contact’s address.

isSuccess
boolean

Boolean indicating whether the operation was successful. A true value indicates success. A false value indicates failure.

pageIdentifier
string

Auxiliary validation used by Payabli in payment pages and components.

paymentMethod
string

The payment method used. Possible values include “apple_pay”, “google_pay”, etc.

functionCallBackError response

This response is triggered if an error occurs during the transaction.

{
"paymentMethod": "apple_pay", // apple_pay, google_pay etc
"error": {
"isSuccess": false
"pageIdentifier": null,
"responseCode": 5005,
"responseData": {
"explanation": string,
"todoAction": string
},
"responseText": string,
roomId: null
}
}
paymentMethod
string

The payment method used. Possible values include “apple_pay”, “google_pay”, etc.

error
object

Container for error details when an error occurs.

isSuccess
boolean

Indicates whether the operation was successful. In error cases, this will be false.

pageIdentifier
string

Auxiliary validation used by Payabli in payment pages and components.

responseCode
number

The error code. For example, 5005. See API responseCode and resultCode Reference for a full list of error codes.

responseData
object

Additional details about the error.

explanation
string

A detailed explanation of the error.

todoAction
string

Suggested action to resolve the error.

responseText
string

A brief description of the error.

roomId
number

Internal field used by Payabli.

functionCallBackCancel response

This response is triggered when the user cancels the transaction while the modal is shown.

{
data: {
isTrusted: true
},
paymentMethod: "apple_pay"
}
data
object

Container for response data.

isTrusted
boolean

In this field, true indicates that the event was triggered by a user action, such as a user manually canceling the payment process.

paymentMethod
string

The digital wallet method used. Currently, only apple_pay is supported.

Combine components

If you want to accept digital wallet payments along with card or ACH payments, you can load both the EmbeddedMethod UI and ExpressCheckout UI components on the same webpage. You can also use updateConfig to switch between component configurations on your page.

The code example renders the components in this image:

an image of an ExpressCheckout component rendered on a site
ExpressCheckout, ACH, and Card example
<body>
<div>
<div id="embeddedComponentStyle">
<h4>Pay your order</h4>
<div id='containerExpressCheckout' class="hidden">
<div id='express-checkout-component'></div>
<div style='display: flex; gap: 0.5rem; align-items:center' class="my-2">
<hr style='height:1px;width:35%' />
<small style='width:100%; text-align: center'>or pay with card or bank account</small>
<hr style='height:1px;width:35%' />
</div>
</div>
<div class="tabs">
<ul class="nav nav-tabs" id="tabs" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="card-tab" data-bs-toggle="tab"
data-bs-target="#pay-component-card-cont" role="tab" aria-controls="pay-component-card-cont"
aria-selected="true">Payment Card</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="bank-tab" data-bs-toggle="tab" data-bs-target="#pay-component-ach-cont"
role="tab" aria-controls="pay-component-ach-cont" aria-selected="false">Bank Debit</a>
</li>
</ul>
</div>
<div class="payment-form tab-content">
<div class="tab-pane fade show active" id="pay-component-card-cont" role="tabpanel"
aria-labelledby="pay-component-card-cont">
<div id="pay-component-card">
</div>
<button id="btn-pay" class="mt-20">
<img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAPxJREFUSEvtldGNwjAMhr9/AnQTAJNwbMAG9CZATAC3ARvABjACN8mVDW4DI6Mg9VqStEWVeMAvjSrb3x8ndsTApoHz0wpgZgtgBXwGQWfgW5J/k5YFmNkBWEayOGSbIiQBQfkxJFgDp7AugE1Yz1M7yQG8BDNgLWlXVWpmrtwhP5LupWtsJgewEPEh6a8GmAC//k9SNE8rQCyBmd0EDAbI3aAbPOXURmEO0gCYmR/YHvAad7ES+KrfqEcAdxx3yVzxLSVNq7GPAPeb04tRP/A3oNm5taZ7l+g1S+RTc9SrCeAi6d8EiI0Kf8W6dvMFKLKjoqfyaFj2TX4WeAX0MmsZ8nx06AAAAABJRU5ErkJggg==" />
Save Payment
</button>
</div>
</div>
</div>
</div>
<script src="https://embedded-component-sandbox.payabli.com/component.js" data-test>>"></script>
<script>
var token =
"<API TOKEN";
var entryPoint = "7f1a381696";
var customCssUrl = "https://embedded-component-sandbox.payabli.com/customForm.css";
var payabliConfigCard = { // The config for the EmbeddedMethodUI component that accepts ACH
type: "methodEmbedded",
rootContainer: "pay-component-card",
defaultOpen: "card",
token: token,
customCssUrl: customCssUrl,
entryPoint: entryPoint,
card: {
enabled: true,
amex: false,
discover: true,
visa: true,
mastercard: true,
inputs: {
//here we are customizing the input fields
cardHolderName: {
label: "NAME ON CARD",
placeholder: "",
floating: false,
value: "John Doe",
size: 12,
row: 0,
order: 0
},
cardNumber: {
label: "CARD NUMBER",
placeholder: "1234 1234 1234 1234",
floating: false,
size: 6,
row: 1,
order: 0
},
cardExpirationDate: {
label: "EXPIRATION DATE",
placeholder: "MM/YY",
floating: false,
size: 6,
row: 1,
order: 1
},
cardCvv: {
label: "CVV/CVC",
placeholder: "CVV/CVC",
floating: false,
size: 6,
row: 2,
order: 0
},
cardZipcode: {
label: "ZIP/POSTAL CODE",
placeholder: "Zip/Postal Code",
floating: false,
size: 6,
row: 2,
order: 1,
country: ["us", "ca"],
}
}
},
ach: {
enabled: false
},
customerData: {
customerNumber: "00001",
firstName: "John",
lastName: "Doeee",
billingEmail: "johndoe@email.com"
},
functionCallBackSuccess: function (response) {
alert("card success");
// paycomponentCard.removeListener();
paycomponentCard.payabliExec("reinit");
},
functionCallBackReady: function (data) { },
functionCallBackError: function (errors) {
alert("Error!");
console.log(errors);
}
};
var payabliConfigACH = { // The config for the EmbeddedMethodUI component that accepts ACH
type: "methodEmbedded",
entryPoint: entryPoint,
rootContainer: "pay-component-card",
defaultOpen: "ach",
token: token,
customCssUrl: customCssUrl,
customerData: {
customerNumber: "00001",
firstName: "John",
lastName: "Doe",
billingEmail: "johndoe@email.com"
},
card: {
enabled: false
},
ach: {
enabled: true,
checking: true,
savings: true,
inputs: {
achAccountHolderName: {
label: "ACCOUNTHOLDER NAME",
floating: false,
size: 6,
row: 0,
order: 0
},
achAccountType: {
label: "ACCOUNT TYPE",
floating: false,
size: 6,
row: 0,
order: 1
},
achRouting: {
label: "ROUTING NUMBER",
floating: false,
size: 6,
row: 1,
order: 0,
confirm: true // Confirm routing number
},
achAccount: {
label: "ACCOUNT NUMBER",
floating: false,
size: 6,
row: 1,
order: 1,
confirm: true // Confirm account number
}
}
},
functionCallBackSuccess: function (response) {
alert("ach");
// paycomponentCard.payabliExec('reinit');
},
functionCallBackError: function (errors) {
console.log(errors);
},
functionCallBackReady: function (data) {
}
};
var expressCheckoutConfig = { //The ExpressCheckout config
token: token,
type: "expressCheckout",
entryPoint: entryPoint,
rootContainer: "express-checkout-component",
//customCssUrl: "your url to a custom css file",
expressCheckout: {
amount: 100,
fee: 0.01,
currency: "USD",
supportedNetworks: ["visa"],
columns: 1,
applePay: {
enabled: true,
buttonStyle: "black-outline",
buttonType: "plain",
language: "en-US",
},
requiredShippingContactFields: true,
appearance: {
buttonHeight: 50, // optional
buttonBorderRadius: 10, // optional
padding: {
x: 10, // optional
y: 10, // optional
},
},
},
customerData: {
customerNumber: "00001",
firstName: "John",
lastName: "Doe",
billingEmail: "johndoe@email.com"
},
functionCallBackReady: function (data) {
console.log('Express Checkout ready: ', data)
const container = document.querySelector("#containerExpressCheckout");
console.log(container)
container.classList.remove("hidden");
},
functionCallBackSuccess: function (data) {
console.log('Express Checkout Success: ', data)
},
functionCallBackError: function (data) {
console.log('Express Checkout Error: ', data)
},
functionCallBackCancel: function (data) {
console.log('Express Checkout Cancel: ', data)
},
}
var paycomponentCard = new PayabliComponent(payabliConfigCard);
new PayabliComponent(expressCheckoutConfig)
function executeActionCard() {
paycomponentCard.payabliExec("pay", {
paymentDetails: {
totalAmount: 100,
serviceFee: 0,
categories: [
{
label: "payment",
amount: 100,
qty: 1
}
]
}
});
}
let cardTab = document.getElementById("card-tab");
let bankTab = document.getElementById("bank-tab");
let payBtn = document.getElementById("btn-pay");
cardTab.addEventListener("click", function () { // using updateConfig to switch between components
paycomponentCard.updateConfig(payabliConfigCard);
});
bankTab.addEventListener("click", function () {
paycomponentCard.updateConfig(payabliConfigACH);
});
payBtn.addEventListener("click", () => {
paycomponentCard.payabliExec("pay", {
paymentDetails: {
totalAmount: 100,
serviceFee: 0,
categories: [
{
label: "payment",
amount: 100,
qty: 1
}
]
}
});
});
</script>
</script>
</body>
</html>