ajax方法中的paypal请求

时间:2011-05-10 13:54:30

标签: ajax paypal

我正在使用Ajax调用发出paypal请求,但我收到状态为ZERO的错误。标头格式为JSON,数据格式为JSON。 在标题中,我发送用户ID,密码,签名,应用程序ID,IP地址,请求和响应格式,内容类型。 在数据中我发送返回你的,接收者,取消网址,动作类型。

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);
                    }
       });

1 个答案:

答案 0 :(得分:1)

您是否尝试使用Firebug之类的内容查看浏览器与服务器之间的http讨论?这应该可以让你更好地了解出了什么问题。