Cardknox is now Sola
Learn More
LogoLogo
Contact Us
  • Introduction
  • 🔗API
    • Transaction API
      • Credit Card
      • Check (ACH)
      • EBT
      • Gift Card
      • Fraud
    • Customer and Recurring API
    • Reporting API
    • Account Boarding API
      • Account Boarding Merchant Agreement
      • Account Boarding Swagger UI
    • Code Samples
    • Error Codes
  • 📦SDK
    • .NET SDK
      • Transaction Workflow
    • iOS SDK
      • iOS SDK - Technical Guide
      • Workflow
    • Android SDK
      • Android SDK - Technical Guide
  • 🧰 Cardknox Products
    • 3D Secure 2.0
      • Client-Side Integration
        • Client-Side Integration (Non-iFields)
      • Server-Side Integration
    • Account Updater
    • Batch Processing
    • Browser-Based POS systems (BBPOS)
    • CloudIM Developer Guide
    • Deep Linking
      • Deep Linking Integration for Third-Party Websites
    • EBT Online
    • Gateway Emulators
    • iFields
      • Angular iFields
    • Merchant Portal
      • FAQ
    • Mobile App
    • Split Capture
    • Tap to Phone - Android
    • Partner Portal
    • PaymentSITE
      • QR Codes for PaymentSITE
    • Webhooks
  • 📱Mobile Wallets
    • Apple Pay Hosted Checkout
      • Apple Pay Hosted Checkout Initial Setup
      • Apple Pay Prerequisites
      • Apple Pay Hosted Checkout Objects Reference (Request)
      • Apple Pay Hosted Checkout Objects Reference (Response)
      • Apple Pay iFields Integration
      • Apple Pay Hosted Checkout Sample Code
      • Apple Pay Features
      • Set up Apple Pay Merchant ID with Cardknox
    • Click-To-Pay - Hosted Checkout
      • Click-To-Pay Initial Setup
      • Click-To-Pay Sample Code
      • Click-To-Pay iFields Integration
      • Click-To-Pay Objects Reference (Request)
      • Click-To-Pay Objects Reference (Response)
    • Google Pay Hosted Checkout
      • Google Pay Control Object
      • Google Pay Request Objects
      • Google Pay Response Objects
      • Google Pay Sample Code
      • iFields Integration
      • Google Pay FAQ
  • 🔌Plugins
    • Netsuite
      • NetSuite Features and Demo
    • WooCommerce
    • Magento Plugin
    • RMH (Retail Management Hero)
    • RMS (Retail Management Systems)
  • 📖Articles
    • Frequently Asked Questions
    • How to Build POS Integration Flows
    • Card Present Integration Guide
  • Glossary of Terms
Powered by GitBook
On this page
  • Overview
  • Integrate Agreement API using ifields
  • Objects Reference

Was this helpful?

Export as PDF
  1. API
  2. Account Boarding API

Account Boarding Merchant Agreement

Last updated 1 year ago

Was this helpful?

Overview


In order to be boarded every Merchant needs to agree to Go Plus Terms and Conditions. To help Developers integrate Agreement API into their website we are supporting Agreement API through Cardknox iFields.

Integrate Agreement API using ifields

Obtain your iFields xKey from your account settings.

Adding Reference to iFields


Step 1: Check the latest stable iFields version here:

Step 2: Add the ifields.js file after the <head> tag on your website:

<script src=https://cdn.cardknox.com/ifields/**ifields-version-number**/ifields.min.js></script>

Adding iFrame and JavaScript Objects for Merchant Agreement


Step 1: Add the following iFrame JS snippet inside the <body> where Merchant Agreement is desired.

  • Make sure you have an attribute data-ifields-id="agreement" as part of <iframe> tag

<iframe id="agreement" class="agreement" data-ifields-id="agreement" src="https://cdn.cardknox.com/ifields/**ifields-version-number**/agreement.htm"></iframe>

Step 2: Create JavaScript function to handle Agreement API callback

function handleAgreementResponse(response) {
    let msg = null;
    if (!response) {
        msg = "Failed to load token. No Response";
    } else if (response.status !== iStatus.success) {
        msg = "Failed to load token. "+response.statusText || "No Error description available";
    } else if (!response.token) {
        msg = "Failed to load token. No Token available";
    } else {
        msg = response.token;
    }
    setTimeout(() => {alert(msg)}, 10);
}

Step 3: Enable Customer Agreement to get the token

There are two ways to get the token:

  • Asynchronously (a callback will be performed once the customer agrees to Terms and Conditions) Just add enableAgreement call when the document is loaded (autoAgree the parameter is set to true):

document.addEventListener("DOMContentLoaded", function(event) {
    ................ 
    ckCustomerAgreement.enableAgreement({
        iframeField: 'agreement',
        xKey: '<Your ifields xKey>',
        autoAgree: true,
        callbackName: 'handleAgreementResponse'
    });
    ................    
}
  • Synchronously (Explicitly calling getToken function for example on Submit) Add enableAgreement call when the document is loaded (autoAgree the parameter is set to false):

document.addEventListener("DOMContentLoaded", function(event) {
    ................ 
    ckCustomerAgreement.enableAgreement({
        iframeField: 'agreement',
        xKey: '<Your ifields xKey>',
        autoAgree: false
    });
    ................    
}

In your Submit function add the following code:

ckCustomerAgreement.getToken()
    .then(resp => {
        handleAgreementResponse(resp);
    })
    .catch(err => {
        console.error("Agreement Token Error", exMsg(err));
        handleAgreementResponse(err);
    });

Objects Reference


iStatus

const iStatus = {
    success: 100,
    unsupported: -100,
    error: -200
}

Agreement Response

The object holding the response with token from Agreement API.

Name

Type

Description

status

There are 2 possible cases:

  • Agreement was accepted and Token was obtained status=iStatus.success

  • Agreement wasn’t accepted or an error occurred obtaining the token: status=iStatus.error

statusText

String

When status=iStatus.error this field will be populated with the reason

token

String

When status=iStatus.success this field will be populated with token

For response object reference refer here:

🔗
Cardknox Partner Portal
https://cdn.cardknox.com/ifields/versions.htm
Agreement Response
iStatus