1

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);
          });
ApriOri
  • 2,618
  • 29
  • 48

1 Answers1

2

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?

Shevie
  • 21
  • 3