VirtualTerminal UI

Learn how to use the VirtualTerminal UI component on your site or in your app to securely accept payments

Applies to:Developers

The VirtualTerminal UI component lets you embed a payment terminal inside your website or application.

an image of a virtual terminal component window

Usage

This component lets you add a robust virtual terminal tool 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
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="UTF-8">
5</head>
6<body>
7 <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
8</body>
9</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
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="UTF-8">
5</head>
6<body>
7 <div id="pay-component-2"></div>
8 <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
9</body>
10</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
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="UTF-8">
5 <style>
6 #pay-component-2 iframe{
7 border: solid 1px transparent;
8 max-width: 610px;
9 }
10 </style>
11 </head>
12 <body>
13 <button id="btnx"> Click here to show the component</button>
14 <div id="pay-component-2"></div>
15 <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
16 <script>
17 document.getElementById('btnx').addEventListener('click', btnVT);
18 var payabliConfig2 = {
19 type: "vterminal",
20 rootContainer: "pay-component-2",
21 buttonLabelInModal: 'Review & Pay',
22 oneTimePayment: true,
23 entryPoint: "bozeman-aikido",
24 recurringPayment: true,
25 defaultOpen: 'ach',
26 hideComponent: true,
27 token: "o.z8j8aaztW9tUtUg4dlVeYAx+L2MazOFGr0DY8yuK3u79MCYlGK4/q0t5AD1UgLAjXOohnxN8VTZfPswyZcwtChGNn1a8jFMmYWHmLN2cPDW9IrBt1RtrSuu+85HJI+4kML5sIk9SYvULDAU2k0X0E1KFYcPwjmmkUjktrEGtz48XCUM70aKUupkrTh8nL7CXpAXATzVUZ2gEld9jGINwECPPLWmu+cZ4CJb7QMJxnzKFD073+nq/eL+pMth7+u/SkmAWC0+jn8y+Lf6T5Q5PqB6wN7Mvosp8g7U7lbEW2wC0DA92pjblfDHVJOQUkjgT7B1GvryMokLvBjoiaLhKa55iKZE1YDlyqruILkoNF+zGSPS9r17qU6w4ziKhoMdSPzPBJBlLhQhz3MVANXbjfEfJwmtr/JJ1uStUfBFJ710cS1x7goxMJO/cl+q+LVtPy788EKFkgMc5OjfBNCsNL+dBDVbK5CiIJUSbOFzdqdjY/VJ14MEodsHYOwMAjuF4.KRFMeEj0SOur8MLZ362c/UZ/U/Az3CSUkr3/8EVDE6Y=",
28 card: {
29 enabled: true,
30 amex: true,
31 discover: true,
32 visa: true,
33 mastercard: true,
34 jcb: true,
35 diners: true,
36 fallbackAuth: true,
37 },
38 ach: {
39 enabled: true,
40 checking: true,
41 savings: true
42 },
43 customerData: {
44 customerId: 13
45 },
46 functionCallBackSuccess: function (referenceId) {
47 alert(referenceId + ' done!!!');
48 },
49 functionCallBackError: function () {
50 alert('Error');
51 },
52 lineItems: [{
53 name: 'Widgets',
54 type: 'customer',
55 label: 'Widgets',
56 value: '150.00',
57 description: '',
58 quantity: 1,
59 showDescription: false
60 },
61 {
62 name: 'Gadgets',
63 type: 'quantity',
64 label: 'Gadgets',
65 value: '2340.00',
66 description: '',
67 quantity: 2,
68 showDescription: false
69 }
70 ]
71
72 };
73 var paycomponent2 = new PayabliComponent(payabliConfig2);
74
75 function btnVT() {
76 paycomponent2.showModal();
77 }
78 </script>
79 </body>
80 </html>

Response examples

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

1// Response is the same for ACH and card.
2response.responseText:
3"Success"
4
5response.responseData:
6{"authCode":"123456","referenceId":"187-c5892026d9f345ffa63bf909d574fe92","resultCode":1,"resultText":"Approved","avsResponseText":"","cvvResponseText":"","customerId":1636}

Configuration reference

These are the configuration parameters available for the VirtualTerminal 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 VirtualTerminal UI, this value is vterminal. See the Embedded Components Overview for more information on other component types.

rootContainer
stringRequired

Container ID used for the component.

defaultOpen
string

Sets the default payment method that’s shown. Accepted values are: card or ach.

buttonLabelInModal
string

Text label for the action button.

hideComponent
booleanDefaults to false

When true the component is hidden when it’s instanced.

token
stringRequired

API token for authentication.

customCssUrl
string

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

recurringPayment
boolean

When true, enables the recurring payment option in terminal.

oneTimePayment
boolean

When true, enables the one-time payment option in terminal.

lineItems
array of objects

lineItem objects with data related to the line items for the transaction. See lineItem object model for a full reference.

card
objectRequired

cardService object used to configure accepted card types.

enabled
boolean

Enable/disable card option.

amex
boolean

Enable/disable acceptance of American Express cards.

discover
boolean

Enable/disable acceptance of Discover cards.

visa
boolean

Enable/disable acceptance of Visa cards.

mastercard
boolean

Enable/disable acceptance of MasterCard cards.

diners
boolean

Enable/disable acceptance of Diner’s Club cards.

jcb
boolean

Enable/disable acceptance of JCB cards.

inputs
object

Card input fields descriptors. This object applies only to the EmbeddedMethod UI component.

cardHolderName
object

Optional, but strongly recommended. Descriptor object for input field.

cardNumber
objectRequired

Descriptor object for input field.

cardExpirationDate
objectRequired

Descriptor object for input field.

cardCvv
objectRequired

Descriptor object for input field.

cardZipcode
object

Optional, but strongly recommended. Descriptor object for input field.

ach
objectRequired

achService object used to configure accepted ACH types.

enabled
boolean

Enable/disable ACH option.

checking
boolean

Enable/disable acceptance of Checking account.

savings
boolean

Enable/disable acceptance of Savings account.

inputs
object

ACH input field descriptors. This only applies to the EmbeddedMethod UI component.

achAccountHolderName
objectRequired

Required. Descriptor object for input field.

achAccountType
objectRequired

Required. Descriptor object for input field.

achRouting
objectRequired

Required. Descriptor object for input field. Use the confirm input descriptor to add matching validation to this field. See Style Individual Fields for more.

achAccount
objectRequired

Required. Descriptor object for input field. Use the confirm input descriptor to add matching validation to this field. See Style Individual Fields for more.

paymentMethod
objectRequired

paymentMethod object with data related to the payment method. Required when saving a payment method or executing a payment. Can be passed to the component via payabliExec method. See paymentMethod Object for a full reference.

customerData
objectRequired

Customer Object with data related to customer. Can be passed to the component via payabliExec method. Required when saving a payment method. Which fields are required depends on whether the paypoint has custom identifiers. If you aren’t using custom identifiers, then you must include at least one of these values: firstname and lastname, email, or customerId. See customerData (payorData) Object for a full reference.

paymentDetails
objectRequired

paymentDetails object with data related to the payment. Required when running a payment. Can be passed to the component via payabliExec method. See paymentDetails Object for a full reference.

fallbackAuth
boolean | nullDefaults to false

When true, if tokenization fails, Payabli will attempt an authorization transaction to request a permanent token for the card. If the authorization is successful, the card will be tokenized and the authorization will be voided automatically.

fallbackAuthAmount
number | nullDefaults to 1.00

The amount for the fallbackAuth transaction. Defaults to one dollar.

functionCallBackSuccess
function

The callback function called when the component executes successfully.

functionCallBackError
function

The callback function called when the component receives an error. See functionCallBackError response in the next section for a complete reference.

Response object

The Response object received via callback Success function has the following structure:

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 or saved payment method.