<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
</head>
<body>
<div id="cardData"></div>
<button class="button" id="submitButton" onclick='submitFrame()'>Submit</button>
<!-- By default payframe.js will always remain up to date with the latest version of the payframe. If you are after a specific version please set this to payframe-1.1.js and so on. -->
<script src='https://securetest.merchantwarrior.com/payframe/payframe.js'></script>
</body>
</html>
var method = 'getPayframeToken'; // change this to getPayframeToken for payment payframe
var threeDS = true; // this will only work with the getPayframeToken method
var style = {
fontFamily: 'Open Sans, sans-serif',
fontSrc: ['https://fonts.googleapis.com/css?family=Open+Sans'],
};
var accessToken = "xxxxxx";
var submitURL = 'https://base.merchantwarrior.com/payframe/';
payframeObject = {
accessToken: accessToken,
payframeDivId: 'cardData',
src: 'https://securetest.merchantwarrior.com/payframe/',
submitUrl: submitURL,
style: style,
method: method,
};
var mwPayframe = new payframe(payframeObject);
mwPayframe.mwCallback = function() {
//Example of success and error scenarios below
if (threeDS) {
processResponseEvent(method, arguments, tdsCheck);
} else {
processResponseEvent(method, arguments);
}
};
function submitFrame() {
// Disable the button to stop double submissions
button.setAttribute('disabled', 'disabled');
button.innerHTML = "Please wait.."
button.style.opacity = '0.5';
button.filter = 'alpha(opacity=50)'; // IE8 fallback
mwPayframe.submitPayframe(this)
}
function resetFrame(error_only) {
if (threeDS && !error_only) {
tdsCheck.destroy();
mwPayframe.deploy();
} else if (!error_only) {
mwPayframe.reset();
}
// Enable the button
button.removeAttribute('disabled');
button.innerHTML = 'Submit';
button.style.opacity = '1';
}
mwPayframe.loading = function() {
var mwIframe = document.getElementById("mwIframe");
var cardDiv = document.getElementById("cardData");
// Hide the payframe during load operations
mwIframe.style.visibility = 'hidden';
// Assign the parent div the same dimensions as the payframe
var height = mwIframe.height;
var width = mwIframe.width;
cardDiv.style.height = height;
cardDiv.style.width = width;
// Place a loading animation in the center of the payframe
cardDiv.style.background =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.