我想要的例子複製該如何引導How-to guide但我總是收到此錯誤:流星的Http寶帳戶自適應
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": "[email protected]",
"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: "[email protected]",
preferredLanguageCode: "en_AU",
registrationType: "Web",
requestEnvelope:{
errorLanguage: "en_US"
}
}
}
},
function(error,result){
alert(error);
alert(result.statuscode);
})
我也注意到,我需要在countryCode之後添加一個}:「AU」,因爲這是地址參數應該停止的地方。 –