0

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

Community
  • 1
  • 1
user3316523
  • 630
  • 3
  • 10
  • 14
  • look at your console `XMLHttpRequest cannot load https://app.mpowerpayments.com/sandbox-api/v1/direct-card/processcard. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.` – Arun P Johny Sep 22 '14 at 16:34
  • any solution to test this [link](http://mpowerpayments.com/developers/docs/http.html#direct-card).what you suggest – user3316523 Sep 22 '14 at 16:36

0 Answers0