开发者

paypal request in ajax method

I'm making paypal request using Ajax calling but I'm getting error with status ZERO.The header format is JSON and data format is JSON. In header i send user ID,Password,Signature, app ID, IP address, request and response format, content type. In data i send return ur, receiver, cancel url , action type.

var dataObject = {};

  dataObject = {"returnUrl":"http://www.google.com","requestEnvelope":{"errorLanguage":"en_US"},"currencyCode":"USD","receiverList":{"receiver":[{"email":"tigs_87687_56@gmail.com","amount":"10.00"},{"email":"s1305010375_biz@gmail.com","amount":"10.00"开发者_高级运维}]},"cancelUrl":"http://www.igoogle.com","actionType":"PAY"};

var dataHeader = {};
    dataHeader = {"X-PAYPAL-SECURITY-USERID":"1301997553_biz_api1.gmail.com","X-PAYPAL-SECURITY-PASSWORD":"156497560","X-PAYPAL-SECURITY-SIGNATURE":"dfgdstergdfGZ3YxzVAglRLBF8nLVciVZVD7x5t4s7AArl","Content-type":"application/json","X-PAYPAL-DEVICE-IPADDRESS":"127.0.0.1","X-PAYPAL-REQUEST-DATA-FORMAT":"JSON","X-PAYPAL-RESPONSE-DATA-FORMAT":"JSON","X-PAYPAL-APPLICATION-ID":"APP-80W284485P519543T"};

 $.ajax({
    type:'POST',
    url:'https://svcs.sandbox.paypal.com/AdaptivePayments/Pay',//paypal url
    headers: JSON.stringify(dataHeader, null, 8),
    data: JSON.stringify(dataObject, null, 6),
    dataType:'json',
    success:onSuccess,
    error:function(xhr,ajaxOptions){
        alert(xhr.status + " :: "  + xhr.statusText);
                    }
       });


Have you tried viewing the http discussion between your browser and the server using something like Firebug? That should give you a better idea of what's going wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜