Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <form method="post" action="https://mysite.com/payment/process" id="cart" name="be2billForm" onsubmit="return tokenizeHandler()">

    <p>
        <label>Card security code</label>
        <!-- Here is the cryptogram container -->
        <span class="input-container" id="cvv-container"></span>
    </p>

    <p class="submit">
        <input type="submit" value="Pay">
    </p>
    
		<!-- This hidden input will receive the token -->
		<input type="hidden" name="hf-token" id="hf-token">

</form>
            
          
!

CSS

            
              body * {
    font-family: "Open Sans", "Century Gothic", "Calibri", "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1em;
    transition: all 250ms ease-in-out;
}
form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    box-sizing: border-box;
    overflow: hidden;
    padding: 21px;
}
form p,
form p label {
    display: block;
    width: 100%;
}
input[type=text] {
    display: inline-block;
    max-width: 100%;
    height: 2em;
    overflow: hidden;
    box-sizing: border-box;
    margin-top: 7px;
    padding: 5px 7px 3px 7px;
    border: 1px solid rgba(0, 0, 0, .5);
    border-radius: 5px;
    transition: all 250ms ease-in-out;
    width: 250px;
}
.input-container {
    display: inline-block;
    max-width: 100%;
    height: 2em;
    overflow: hidden;
    box-sizing: border-box;
    margin-top: 7px;
    padding: 5px 7px 3px 7px;
    border: 1px solid rgba(0, 0, 0, .5);
    border-radius: 5px;
    transition: all 250ms ease-in-out;
}
#card-container {
    width: 250px;
}
#expiry-container,
#cvv-container {
    width: 91px;
}
label {
    vertical-align: super;
}
p {
    margin-bottom: 14px;
}
.submit {
    margin-top: 35px;
    text-align: center;
}
input[type=submit] {
    width: 100%;
    max-width: 300px;
    padding: 3px 14px 7px 14px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 1);
    border-radius: 5px;
    background: #3e96db;
    font-size: 1.5em;
    font-family: "Titillium Web", Arial, sans-serif;
    font-weight: 600;
    color: white;
    vertical-align: baseline;
    cursor: pointer;
    transition: all 500ms;
}
input[type=submit]:hover {
    background-color: #5db3f5;
}

/* Hosted fields auto set class */
.hosted-fields-invalid-state {
	border: 2px solid red;	
}

.hosted-fields-valid-state {
	border: 2px solid green;	
}
            
          
!

JS

            
              // Define some style properties to apply on hosted-fields inputs 
var style = {
    "input": {
        "font-size": "1em",
    },
    "::placeholder": {
        "font-size": "1em",
        "color": "#777",
        "font-style": "italic"
    }
};

// Initialize the hosted-fields library
var hfields = be2bill.hostedFields({
    // SDK api key
    key: {
        id: "970c4f7c-c62e-40d2-8084-b61781326c81",
        value: "lr3*{F/4?nLnTq.t"
    },
		// Manages each hosted-field container
    fields: {
        'cryptogram': {
            id: 'cvv-container',
            style: style,
            length: 3
        }
    }
});

// Load the hosted-fields library
hfields.load();

// Manage the token creation
function tokenizeHandler() {
    hfields.createToken(function(result) {
        console.log(result);
        if (result.execCode == '0000') {
            // Add token to form request
            document.getElementById('hf-token').value = result.hfToken;
						prompt("Generated token:", result.hfToken); // Displays the generated token for this demo
						// Form submission is disabled for this demo, think to uncomment the line below to make it works in your integration
            //document.be2billForm.submit();
        } else {
            alert(result.execCode+': '+result.message);
        }
    });
    return false;
}
            
          
!
999px

Console