I use Bluesnap sandbox Payment gateway but i can not get payment_field_token. Solve it
var _authdata = $base64.encode('xxxxxxxxxxx' + ':' + 'xxxxxxxx');
$http.defaults.headers.common['Authorization'] = 'Basic' + _authdata;
$http.defaults.headers.common['Content-Type'] = 'application/json';
$http.defaults.headers.common['Accept'] = 'application/json';
$http.defaults.headers.common['Access-Control-Allow-Origin'] = '*';
console.log("Authenticaltion Data : " + _authdata);
var _headers = {
'Authorization': 'Basic ' + _authdata
}
// console.log("Headers : " + _headers);
console.log(JSON.stringify(_headers));
return $http({
method:'POST',
url: 'https://sandbox.bluesnap.com/services/2/payment-fields-tokens',
headers:_headers
}).
success(function(data, status, headers, config) {
console.log("Success Data : " + data);
}).
error(function(data, status, headers, config) {
console.log("Error Data : " + data);
});
答案 0 :(得分:2)
我无法重新创建示例代码来检查这一点,但我认为问题是您在'基本'后缺少空白: $ http.defaults.headers.common ['授权'] ='基本'+ _authdata;
此外,如果您要设置默认标头,则无需再在标头中再次发送...
如果这没有帮助,请提供完整的演示html吗?