i want to test an Restful API that required to set header on ajax call.this is the api link that i want to test.
i have write this code to set header on ajax call.jsfiddle
$(document).ready(function(){
var card = '{ "card_name" : "Alfred Robert Rowe", "card_number" : "4242424242424242", "card_cvc" : "123", "exp_month" : "06", "exp_year" : "2010", "amount" : "300" }';
$.ajax({
url: 'https://app.mpowerpayments.com/sandbox-api/v1/direct-card/processcard',
type: 'POST',
headers: {
"Content-Type":"application/json",
"MP-Master-Key":"dd6f2c90-f075-012f-5b69-00155d866600",
"MP-Private-Key":"test_private_amOI11Gb0SIo6NSLZr1xkfOYSuE",
"MP-Token":"d25e1f4ddc053779d526"
},
data: {data: card},
success: function (e) {
alert(e);
},
error: function (e) { alert(JSON.stringify(e));}
});
});
instead of getting success code i am getting nothing not even the error function alert anything
is this possible to do the in php also something with curl.Please help how can i perform this test