我正在尝试学习贝宝付款。我做了一个使用Paypal-Express-Checkout的简单的AngularJS应用程序。正如它在文档中所说的,首先我必须执行SetExpressCheckout调用。贝宝访问控制允许来源
$http.post("https://api-3t.sandbox.paypal.com/nvp", request)
.success(function(data){
console.log(data);
}).error(function(error){
console.log(error);
});
在对象request
中有所有付款细节。 但是当我运行脚本时,http调用的结果是:XMLHttpRequest cannot load https://api-3t.sandbox.paypal.com/nvp. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
我试图搜索这个错误,但是我什么也没找到。我该如何解决?
UPDATE:如果请求来自一个形式不给我任何错误,但如果它来自http.post发挥它给我一个错误
在该[照片](https://www.paypalobjects.com/webstatic/en_US/developer/docs/ec/overview-ec-ecapiflow.gif)总结了快速结账模式。在第一阶段,我必须调用SetExpressCheckout API。我认为无论是来自客户端还是服务器的电话 – Lorenzo
@Lorenzo I都支持我所说的话并不重要。以下是此API功能的文档:https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECGettingStarted/#id084RN060BPF – DeeDee
那么,为什么如果我用表单I调用地址不要给出任何错误?我不明白。 @DeeDee – Lorenzo