Hi all,
I am always getting authentication required window.when i call bluesnap sandbox url.I have googled and read some article which says because of CORS the Authentication required message box is appearing. i tried adding the basic authentication in the header itself but no luck .my code is below. any help will be appreciated
my code below
$(document).ready(function() { $('#paymentsubmit').click(function (e) { xmlstring = ""+ "" + "AUTH_ONLY " + "ECOMMERCE " + "DescTest " + "11.00 " + "USD " + "" + "test first name " + "test last name " + "" + "" + "4263982640269299 "+ "837 "+ "02 "+ "2018 "+ ""+ ""; $.ajax({ data: xmlstring, Authorization: "Basic " + btoa("API_14655582321891175640599" + ":" + "Aut0mat!c"), dataType: 'jsonp', xhrFields: { withCredentials: true }, contentType: 'application/xml', bluesnapversion:'2.0', type: 'POST', // beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Basic ' + btoa('API_14655582321891175640599' + ':' + 'Aut0mat!c')); }, url: 'https://sandbox.bluesnap.com/services/2/transactions' }).done(function (data) { alert('Registered Successfully'); }).error(function (jqXHR, textStatus, errorThrown) { alert(jqXHR.responseText || textStatus); }) }); }) Thanks
Dev
Replies
Know the answer? Post it — somebody with the same question will find it here.