• User Documentation 
  • Amaryllis Release Notes 
  • For Developers 

  • User Documentation 
  • Amaryllis Release Notes 
  • For Developers 

Heartland - Dev Portal

  • folder icon closed folder iconIntroduction
  • folder icon closed folder iconAuthentication
  • folder icon closed folder iconManagement
    • Getting Started
    • Platform Accounts Management
      • Get Platform Account Configuration
      • Get Platform Account
      • Create Platform Account
      • Update Platform Account
      • Objects Reference
    • Sub-Accounts Management
      • Get Sub-Account Configurations
      • Get Sub-Account
      • Create Sub-Account
      • Update Sub-Account
      • Objects Reference
    • Users Management
      • Get User by User Id
      • Get User by Username
      • Create User
      • Update User
      • Objects Reference
    • Underwriting Management
      • Get Application
      • Get Application Template
      • Get Application Fields Statuses
      • Get Application Status
      • Get Linked Sub-Accounts
      • Get Resubmission
      • UMS IFrame Authentication
      • UMS IFrame
      • UMS IFrame Authentication in Resubmission Mode
      • UMS IFrame in Resubmission Mode
      • Create Application
      • Update Application
      • Update Application Fields Statuses
      • Update Application Status
      • Objects Reference
      • Response Codes
  • folder icon closed folder iconTransactions Processing
    • Getting Started
    • Credit Card Transactions
      • 3D-Secure
      • Authorization
      • Void
      • Capture
      • Charge
      • Refund
      • Credit
      • Verify
      • Chargeback
      • Cancel
    • Update
    • Adjustment
    • Recurring
    • ACH
    • Response
    • Response Codes
    • Objects Reference
  • folder icon closed folder iconTransactions Echo
    • Getting Started
    • Credit Card Transactions
      • Authorization
      • Void
      • Capture
      • Charge
      • Refund
      • Credit
      • Verify
      • Chargeback
      • Cancel
    • Update
    • Adjustment
    • ACH
    • Echo Response
    • Response Codes
    • Objects Reference
  • folder icon closed folder iconTokenization
    • Processing with a Token
      • Getting Started
      • Processing with Tokenization
    • Tokenization iFrame
      • iFrame Integration
      • iFrame Customization
      • iFrame Testing
      • Response Example
    • Tokenization API
      • Getting Started
      • Tokenization Request
      • Tokenization Response
      • Response Codes
  • folder icon closed folder iconPayouts
    • Getting Started
    • Payout Transactions
    • Response
    • Objects Reference
  • folder icon closed folder iconReports
    • Getting Started
    • Reports API
      • Account Balances
      • Payouts
      • Payouts Reconciliation
      • Transaction Details
      • Settlements
      • Account Summary
      • Transactions
      • Transactions Summary
      • Fees Summary
      • Incoming Fees
      • Expected Future Revenue
      • Profitability Analysis
      • Reconciliation Summary
      • Reconciliation Records
      • Chargeback Analysis
      • Tokens
      • Sign-up Summary
    • Status Codes
  • folder icon closed folder iconErrors
  • folder icon closed folder iconResponse Codes
  1. Home
  2. Docs
  3. Heartland – Dev Portal
  4. Tokenization
  5. Tokenization iFrame
  6. iFrame Integration
Updated on June 9, 2023

Heartland - Dev Portal

  • folder icon closed folder iconIntroduction
  • folder icon closed folder iconAuthentication
  • folder icon closed folder iconManagement
    • Getting Started
    • Platform Accounts Management
      • Get Platform Account Configuration
      • Get Platform Account
      • Create Platform Account
      • Update Platform Account
      • Objects Reference
    • Sub-Accounts Management
      • Get Sub-Account Configurations
      • Get Sub-Account
      • Create Sub-Account
      • Update Sub-Account
      • Objects Reference
    • Users Management
      • Get User by User Id
      • Get User by Username
      • Create User
      • Update User
      • Objects Reference
    • Underwriting Management
      • Get Application
      • Get Application Template
      • Get Application Fields Statuses
      • Get Application Status
      • Get Linked Sub-Accounts
      • Get Resubmission
      • UMS IFrame Authentication
      • UMS IFrame
      • UMS IFrame Authentication in Resubmission Mode
      • UMS IFrame in Resubmission Mode
      • Create Application
      • Update Application
      • Update Application Fields Statuses
      • Update Application Status
      • Objects Reference
      • Response Codes
  • folder icon closed folder iconTransactions Processing
    • Getting Started
    • Credit Card Transactions
      • 3D-Secure
      • Authorization
      • Void
      • Capture
      • Charge
      • Refund
      • Credit
      • Verify
      • Chargeback
      • Cancel
    • Update
    • Adjustment
    • Recurring
    • ACH
    • Response
    • Response Codes
    • Objects Reference
  • folder icon closed folder iconTransactions Echo
    • Getting Started
    • Credit Card Transactions
      • Authorization
      • Void
      • Capture
      • Charge
      • Refund
      • Credit
      • Verify
      • Chargeback
      • Cancel
    • Update
    • Adjustment
    • ACH
    • Echo Response
    • Response Codes
    • Objects Reference
  • folder icon closed folder iconTokenization
    • Processing with a Token
      • Getting Started
      • Processing with Tokenization
    • Tokenization iFrame
      • iFrame Integration
      • iFrame Customization
      • iFrame Testing
      • Response Example
    • Tokenization API
      • Getting Started
      • Tokenization Request
      • Tokenization Response
      • Response Codes
  • folder icon closed folder iconPayouts
    • Getting Started
    • Payout Transactions
    • Response
    • Objects Reference
  • folder icon closed folder iconReports
    • Getting Started
    • Reports API
      • Account Balances
      • Payouts
      • Payouts Reconciliation
      • Transaction Details
      • Settlements
      • Account Summary
      • Transactions
      • Transactions Summary
      • Fees Summary
      • Incoming Fees
      • Expected Future Revenue
      • Profitability Analysis
      • Reconciliation Summary
      • Reconciliation Records
      • Chargeback Analysis
      • Tokens
      • Sign-up Summary
    • Status Codes
  • folder icon closed folder iconErrors
  • folder icon closed folder iconResponse Codes

iFrame Integration

Sandbox JavaScript URL: https://sandbox.4levers.com/TokenizationApi/Scripts/fourlevers.js

Production environment JavaScript URL: https://tokens.4levers.com/Scripts/fourlevers.js

Integration Guidelines

1.Add script reference to your application HTML page and provide your personal API key

				
					//add 4levers script reference with specified client api key
<script src= "https://sandbox.4levers.com/TokenizationApi/Scripts/fourlevers.js" data-4levers-key="[client apiKey]"
data-theme= "[css theme name]" >
</script>				
			

2.Add container element to tokenization iFrame with id attribute specified as container

				
					//div container for tokenization iframe
<div id="container">
</div>				
			

3.Create a JavaScript function

4.Call fourlevers.createIframe method to create an iFrame.

				
					$().ready(function () {
//create tokenization iframe on the page inside the element with id='container'
fourlevers.createIframe('container');
});				
			

5.Call fourlevers.fetchTokenizedData method to subscribe for the callback function
to retirve the tokenized data in case of a successful validation or a response status code in case of an arror

				
					fourlevers.fetchTokenizedData(tokenizationComplete);				
			

6.After you receive the tokenized data, call the tokenizationComplete callback function.
Within this function you may implement any custom logic for processing tokenized data
(for example get tokenized data and post it to your server).

Response statuses:
200 – OK
400 – Bad Request or iFrame validation error
500 – Server Error

				
					//tokenization complete callback function
function tokenizationComplete(tokenizationData) {
//check response status (200 - OK, 400 - Bad Request, 500 - Server Error)
if (tokenizationData.status === 200) {
//perform any operation that you need
alert(JSON.stringify(tokenizationData));
$.post('[some client url]', tokenizationData)
.done(function (data) {
});
}
}				
			
				
					<!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:mso="urn:schemas-microsoftcom:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
    <head>
        <title>Tokenization integration sample</title>
        <!-- add 4levers script reference with specified client api key -->
        <script src="https://sandbox.4levers.com/TokenizationApi/Scripts/fourlevers.js" data-4levers-key="[client apiKey]" data-theme='[css theme name]' ></script>
        <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>

        /* iFrame Style*/
                <style>
             label, input, select {
             display: block;
             margin-left: 8px;
             width: 170px;
            }
             .fourlevers-iframe {
             border: none;
             height: 200px;
             width: 450px;
             }
        </style>

    </head>
    <body>
 <!-- customer fields -->
     <form>
         <div>
         <label for="addressLine">Address Line 1</label>
         <input name="addressLine" id="addressLine" type="text" maxlength="50" />
         </div>
         <div>
         <label for="addressLine2">Address Line 2</label>
         <input id="addressLine2" name="addressLine2" type="text" maxlength="50" />
         </div>
         <div>
         <label for="city">City</label>
         <input id="city" name="city" type="text" maxlength="50" />
         </div>
        <div>
        <label for="country">Country</label>
        <select id="country" name="country">
             <option value="1">USA</option>
             <option value="2">Canada</option>
             <option value="3">United Kingdom</option>
        </select>
         </div>
        <div>
         <label for="phone">Phone</label>
         <input id="phone" name="phone" type="tel" maxlength="15" />
         </div>
     </form>
     <!-- div container for tokenization iframe -->
    <div id="container"></div>
     <input type="button" value="submit" onclick=" submitData() " />
     <input type="button" value="reset" onclick="reset()"/>
    <script>
            $().ready(function () {
                 //create tokenization iframe element on the page inside the element with
                id='container'
                 fourlevers.createIframe('container');
             });

             //submit button handler
             function submitData() {
                 //sending iframe data to 4levers to obtain token (if validation passed)
                 //tokenizationComplete - callback function
                 fourlevers.fetchTokenizedData(tokenizationComplete);
             }
              //reset button handler
               function reset() {
             fourlevers.resetIframe();             
             }
             //tokenization complete callback
             function tokenizationComplete(tokenizationData) {
                 //check response status (200 - OK, 400 - Bad Request, 500 - Server Error)
                 if (tokenizationData.status === 200) {
                     //perform any operation that you need
                     alert(JSON.stringify(tokenizationData));
                     $.post('[some client url]', tokenizationData)
                     .done(function (data) {

                     });

                }
             }
    </script>
    </body>
 </html>				
			
Still stuck? How can we help?
Was this page helpful? Yes No

How can we help?

© Amaryllis Payment Solutions, 2022  All rights reserved.