css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

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

    <p>
        <label>Full name</label>
        <input type="text">
    </p>
	
		<p>
        <label for="cc-number">Card number</label>
        <!-- Here is the card container -->
        <span class="input-container" id="card-container"></span>
    </p>

    <p>
        <label>Card expiry</label>
        <!-- Here is the expiry container -->
        <span class="input-container" id="expiry-container"></span>
    </p>

    <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>
            
          
!
            
              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;
    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;	
}
            
          
!
            
              // 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 = dalenys.hostedFields({
    // SDK api key
    key: {
        id: "970c4f7c-c62e-40d2-8084-b61781326c81",
        value: "lr3*{F/4?nLnTq.t"
    },
		// Manages each hosted-field container
    fields: {
        'card': {
            id: 'card-container',
            style: style
        },
        'expiry': {
            id: 'expiry-container',
            placeholder: 'MM/YY',
            style: style
        },
        'cryptogram': {
            id: 'cvv-container',
            style: style
        }
    }
});

// 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.dalenysForm.submit();
        } else {
            alert(result.execCode+': '+result.message);
        }
    });
    return false;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console