Secure Fields (iframes)

Secure Fields allow you to securely collect card data by injecting iframes to your DOM. A separate iframe for both, card number and CVV code is used. Thereby, sensitive data never touches your server and allows you to capture all other related card data such as cardholder name, expiry date, etc. directly by yourself.

Using Secure Fields qualifies you for SAQ A.

Browser compatibility for Secure Fields:



Chrome | Chrome Mobile

>=28 | >=28

Firefox | Firefox Mobile

>=31 | >=31

Internet Explorer | Internet Explorer Mobile

>=9 | >= 9

Safari | Safari Mobile

>=6 | >=6

Opera | Opera Mobile

>=24 | >=22

Blackberry Browser


Android Browser


1. Setup Secure Fields

To get started include the following script on your page.

Secure Fields Script
Minified Version
Secure Fields Script
<script src=""></script>
Minified Version
<script src=""></script>

Please make sure to always load it directly from

2. Create payment form

In order for Secure Fields to insert card number and CVV iframes at the right place, create empty DOM elements and assign them unique IDs. In the example below those are:

  • card-number-placeholder

  • cvv-placeholder

<label for="card-number-placeholder">Card Number</label>
<!-- card number container -->
<div id="card-number-placeholder" style="width: 250px;"></div>
<label for="cvv-placeholder">Cvv</label>
<!-- cvv container -->
<div id="cvv-placeholder" style="width: 90px;"></div>
<button type="button" id="go">Get Token!</button>

In test mode, only test credit cards are allowed.

3. Retrieve a Transaction ID

Start with creating a new Secure Fields instance:

var secureFields = new SecureFields();
// Multiple instances might be created and used independently:
// e.g. var secureFields2 = new SecureFields();

Initialize it with your merchantId and specify which DOM element containers should be used to inject the iframes:

secureFields.initTokenize( "1100007006", {
cardNumber: "card-number-placeholder",
cvv: "cvv-placeholder"

Afterwards submit the form and listen for the success event:

$(function() {
$("#go").click( function() {
secureFields.submit(); // submit the "form"
secureFields.on("success", function(data) {
if(data.transactionId) {
// transmit data.transactionId and the rest
// of the form to your server

Instances can be destroyed if no longer used:


4. Obtain tokens

Once you've transmitted the transactionId to your server (together with the the rest of your form) you can execute a server to server GET Token request to get tokens for card number and CVV code:

Example: Request
Example: Request
-u 'merchantId:password'
"aliasCC": "AAABcHxr-sDssdexyrAAAfyXWIgaAF40",
"aliasCVV": "mVHJkLRrRX-vb9uUzEM40RUN",
"maskedCard": "424242xxxxxx4242"

Please note that this is a server to server API and can not be called from the browser directly. For more details please refer to Token API to see how to get the password.


Please visit our GitHub repository for additional examples of integration versions: Demo Basic: Demo with horizontal fields: Demo with floating labels:

An example of how to implement this behaviour in modern web applications can be found here

In test mode, only test credit cards are allowed.

Please also have a look at Styling, Events and Token API references.

Next up