Connect-E - Standard

This section describes how to add Connect-E to your site with custom styling.

Process Flow

  1. One time token is requested from the Connect-E REST API.
  2. User loads the page with the JavaScript package, and the token is passed in.
  3. iFrame is initialised to collect payment details.
  4. Once the payment form is filled out and the user clicks submit. The execute function is called and a JavaScript promise is returned.
  5. If 3D secure is required, a modal is displayed for the user to enter their details.
  6. The promise resolves with the outcome of the transaction, including status code and auth code.
  7. Confirm the status of the transaction via the Connect-E REST API

Web Payment Example

<div id="demo-payment"></div>
  <div id="errors"></div>
  <button id="testPay" class="btn-primary btn pull-right"
  <div id="demo-result" style="display: none">
      <h5>Payment Complete</h5>
        <dt>Status Code</dt>
        <dd id="status-code"></dd>
        <dt>Auth Code</dt>
        <dd id="auth-code"></dd>
const payConfig = {
   paymentDetails: {
       amount: "100",
       currencyCode: "826",
       paymentToken: /*access token here*/
   containerId: "demo-payment",
   fontCss: [''],
   styles: {
       base: {
           default: {
               color: "black",
               textDecoration: "none",
               fontFamily: "'Do Hyeon', sans-serif",
               boxSizing: "border-box",
               padding: ".375rem .75rem",
               boxShadow: 'none',
               fontSize: '1rem',
               borderRadius: '.25rem',
               lineHeight: '1.5',
               backgroundColor: '#fff',

           focus: {
               color: '#495057',
               borderColor: '#80bdff',
           error: {
               color: "#B00",
               borderColor: "#B00"
           valid: {
               color: "green",
               borderColor: 'green'
           label: {
               display: 'none'
       cv2: {
           container: {
               width: "25%",
               float: "left",
               boxSizing: "border-box"
           default: {
               borderRadius: "0 .25rem .25rem 0"
       expiryDate: {
           container: {
               width: "25%",
               float: "left",
               borderRadius: '0rem',
           default: {
               borderRadius: "0",
               borderRight: "none"

       cardNumber: {
           container: {
               width: "50%",
               float: "left",
           default: {
               borderRadius: ".25rem 0 0 .25rem",
               borderRight: "none"

const connectE = new Connect.ConnectE(payConfig, displayErrors);
const btnTestPay = document.getElementById("testPay");

btnTestPay.onclick = () =>{
   btnTestPay.innerText = 'loading';
   btnTestPay.setAttribute("disabled", "true");
       .then(function(data) {
           document.getElementById("demo-payment").hidden = true;
           document.getElementById("demo-result").hidden = false;
           document.getElementById("status-code").innerText = data.statusCode;
           document.getElementById("auth-code").innerText = data.authCode;
       }).catch(function(data) {
               console.log('Payment Request failed: ' + data);
               btnTestPay.innerText = 'Pay';
               if (typeof data === 'string') {
                   document.getElementById("errors").innerText = data;
               if (data && data.message) {
                   document.getElementById("errors").innerText = data.message;
function displayErrors(errors) {
   const errorsDiv = document.getElementById('errors');
   errorsDiv.innerHTML = '';
   if (errors && errors.length) {
       const list = document.createElement("ul");
       for (const error of errors){
           const item = document.createElement("li");
           item.innerText = error.message;
#demo-payment iframe { width: 100%; }

#demo-result, #demo-payment, #recurring-demo-payment, #recurring-payment { padding: 5px; }

#errors li { color: #B00; }

iframe.threeDs {
    width: 400px;
    height: 400px;
    margin: 100px 0 0 -175px;
    position: fixed;
    top: 0;
    left: 50%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
    background-color: white;

Setup Connect-E Standard


Connect-E can be loaded directly from our servers, this is the recommended way of loading our JavaScript to ensure the latest bug-fixes/patches. Any breaking changes will be released under a different url.
<script src=""></script>


To initialise an instance of connect-E Standard call Connect.ConnectE and pass in the configuration object with an optional reference to a callback to handle validation errors.
const connectE = new Connect.ConnectE(config, displayErrorsCallback, onSubmitTriggered, onBlur);
Parameter Description
required rootConfig
Config containing details of this payment and the styling of the payment form.
An optional callback to display text validation errors. The supplied function is called when there is a validation state change. This function is passed an array of validationError objects.
An optional callback that is called when the submit event on the payment form is fired. This allows the payment to be submitted or extra validation done when the user presses the enter key on the payment form.
function(isValid: boolean)
An optional callback that is called when focus is lost from any field in the form. The parameter isValid will be true when all fields are completed and there are no validation errors.

Validation Error

Property Description
The type of validation error that has occured. This can be one of the following: cardNameRequired, cardNameInvalid, cardNumberRequired, cardNumberInvalid, expiryDateRequired, expiryDateInvalid, expiryDateMustBeInFuture, cv2Required, cv2Invalid
Message detailing the validation error for displaying to the user.

Execute Payment

To execute the payment call executePayment on the object returned from the call to initialise Connect-E. This will consume the access token even if the payment is declined, another token will need to be generated from the REST API and Connect-E will need to be reinitialized if another payment is needed. The promise will be rejected if there is an error returned by the server or if the transaction is already processing. The promise will still be fulfilled if the payment is declined (just with non 0 status code).
        /*handle response here*/
        /*handle failure here*/

When the promise is fulfilled the following object will be passed.

Transaction Result

Property Description
Indicated the status of the transaction. 0 for a successful transaction.
If the transaction was successful, then the auth code is passed out here.
This gives a more detailed description of the status of the transaction.

Status Code

Status Code Result Description
0 Successful The transaction was successful
3 Authorizing The card holder has not completed 3DS, this status will only be seen on the REST API.
4 Referred The card issuer has parked the transaction awaiting contact with the customer before proceeding to authorise or decline the transaction.
5 Declined The transaction was declined by the card issuer or acquiring bank.
20 Duplicate Transaction The transaction which was processed was a duplicate. Ensure each transaction has a unique OrderId.
30 Failed Error executing transaction.
400 Invalid Request The request has failed validation by our servers and the transaction has not been submitted to the gateway. Possible causes for this are invalid transaction type or other data in the request.
401 Issue with Access Token The access token being used is not valid, the transaction has not been submitted to the gateway. This can be caused if the token has already been used or the 30 minute expiry time has elapsed.
404 No Access Token Supplied No access token has been supplied to Connect-E. Transaction has not been submitted to the gateway
500 Internal Server Error There's been an error submitting the transaction, please check the REST API for the status of the transaction.

Additional Info

The user's email address and billing address can be passed as the optional additionalInfo object as defined below. These values will override those set when the access token was created.

Property Description
This email will be checked with the card issuer to provide additional security.
The cardholder's phone number.
billingAddress This address will be checked with the card issuer to provide additional security.
shippingDetails Shipping details for the order.
Map<string, string>
Meta data to be passed at execution time. This will be merged into MetaData passed via the REST API. This can be represented as a JSON object with only string values, other types are not supported.


Property Description
Name order is being shipped to.
address Address order is being shipped to.


Property Description
Customer’s billing address line 1.
Customer’s billing address line 2.
Customer’s billing address line 3.
Customer’s billing address line 4.
Customer’s billing address city.
Customer’s billing address state or county.
Customer’s billing address postcode or zipcode.
Customer’s billing address country code using ISO 3166-1 e.g. United Kingdom: 826.


This section details the fields that can/must be passed to Connect-E Standard when it is initialised

Root Config

Property Description
required string
The id of the div element where the payment details will be displayed.
required paymentDetails
Details of the payment to be made.
array of strings
Array of urls pointing to css files for importing fonts. e.g. ''
styles Object defining custom styles for the payment form.
text Object defining text to override the defaults.
An optional function that is called once the iframe has been loaded and configured.
An optional function that is called if there is an error loading the iframe.

Payment Details

Note that these details must be the same as those passed to the REST API when creating an access token.

Property Description
required string
The amount in the minor unit e.g. "100" for 1.00 GBP.
required string
The three digit ISO-4217 currency code for the currency. eg 826 for the United Kingdom
required string
The access token supplied by the get access token api.
required string
The two-letter ISO 3166 country code, e.g. GB for the United Kingdom. This property is required for Apple Pay.

Styles Config

Property Description
required fieldStyle
Styles to be applied to all fields.
cv2 Styles to override the base styles for the cv2 field.
cardNumber Styles to override the base styles for the card number field.
expiryDate Styles to override the base styles for the expiry date field.
cardName Styles to override the base styles for the card name field.
cardIcon Styles to be applied to the card icon.
form Styles to be applied HTML form element containing all the fields.

Field Style

Property Description
default Styles to be applied when the field is in its initial state.
focus Styles to be applied when the field has focus.
error Styles to be applied when the field has failed validation.
valid Styles to be applied when the field has passed validation.
container Styles to be applied to the div wrapping the label and the input field.
label Styles to be applied to the label.
validationText Styles to be applied to the validation message. Only applicable if text.(cardName|cardNumber|expiryDate|cv2).showValidation is true.
validationIcon Styles to be applied to the validation message icon. Only applicable if text.(cardName|cardNumber|expiryDate|cv2).showValidation is true. E.g., to set the icon colour to purple set this property to { backgroundColor: 'purple' }

Text Config

Property Description
cardName Config to override the default card name placeholder and label text.
cardNumber Config to override the default card number placeholder and label text.
expiryDate Config to override the default cv2 placeholder and label text.
cv2 Config to override the default expiry date placeholder and label text.

Field Text

Property Description
required string
Text to replace the default label text.
required string
Text to replace the default placeholder text. (Empty will be ignored)
Option to show the validation message. Defaults to false if not set.

Update Access Token

It may be useful to update the access token if the current token has been consumed or expired. Updating the token does not refresh the payment form so the user will not have to re-enter their card details. A new access token will need to be obtained from the REST API and passed as an object of payment details to the function.



Validation can be manually triggered by calling validate. This returns a promise, the promise is resolved if the validation passes and rejected if the validation fails. When the promise is rejected an array of validation errors are passed to the function.

   .then(() => { 
        /* Handle validation success */
   .catch(errs => { 
        /* Handle validation errors */