我正在尝试复制此操作指南操作指南中的示例,但我总是收到此错误:
XMLHttpRequest cannot load https://svcs.sandbox.paypal.com/AdaptiveAccounts/CreateAccount. Origin http://my.domain.com is not allowed by Access-Control-Allow-Origin.
任何人都可以为我提供一个工作示例或任何提示吗?谢谢你!
这是我的代码:
Meteor.http.post("https://svcs.sandbox.paypal.com/AdaptiveAccounts/CreateAccount",{
headers: {
"X-PAYPAL-SANDBOX-EMAIL-ADDRESS": "myemail@domain.com",
"X-PAYPAL-SECURITY-USERID": "myuserid",
"X-PAYPAL-SECURITY-PASSWORD": "somepassword",
"X-PAYPAL-SECURITY-SIGNATURE": "thelongsignature",
"X-PAYPAL-APPLICATION-ID": "APP-80W284485P519543T",
"X-PAYPAL-DEVICE-IPADDRESS": "192.0.2.0",
"X-PAYPAL-REQUEST-DATA-FORMAT": "JSON",
"X-PAYPAL-RESPONSE-DATA-FORMAT": "JSON"
},
data: {
accountType: "PERSONAL",
name:{
firstName: "John",
lastName: "Doe"
},
address:{
line1: "123 Main Street",
city: "Sydney",
state: "NSW",
postalCode: "2000",
countryCode: "AU",
citizenshipCountryCode: "AU",
contactPhoneNumber: "12345678",
dateOfBirth: "1990-01-01Z",
createAccountWebOptions:{
returnUrl: "http://my.domain.com/"
},
currencyCode: "AUD",
emailAddress: "anotheremail@somedomain.com",
preferredLanguageCode: "en_AU",
registrationType: "Web",
requestEnvelope:{
errorLanguage: "en_US"
}
}
}
},
function(error,result){
alert(error);
alert(result.statuscode);
})