Error getting payment_field_token in Bluesnap API

半腔热情 提交于 2019-12-11 05:27:24

问题


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

回答1:


I am having trouble recreating a sample code to check this, but I think the problem is that you are missing a blank after 'Basic': $http.defaults.headers.common['Authorization'] = 'Basic' + _authdata;

Also if you're setting the default header, you do not need to send it again in headers...

If this does not help, can you please supply a full demo html?



来源:https://stackoverflow.com/questions/45520926/error-getting-payment-field-token-in-bluesnap-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!