I am trying to contact the barclays payment api, I can send a post request which return the page that I want to redirect the user to using postman.
However, the same request send from an angular 2 app, returns:
XMLHttpRequest cannot load https://test.barclaycardsmartpay.com/hpp/pay.shtml. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.
I feel that the error message is a decoy, because if cors was the issue, then I am not sure why it would be working in postman. Perhaps it is because the API I am trying to reach is accepting SOAP requests and I am trying to do this from localhost, which can not be reached from that API (to give a two way connection?).
In my angular app, my post looks like this:
let paymentPost : iSmartPayment = {
merchantSig: "23XJ9auO4brdZMzPXoe+Lml4H5PfQERgrImns6s4FdQ=",
merchantReference: "abc",
paymentAmount: "1",
currencyCode: "GBP",
shipBeforeDate: "2018-01-01",
skinCode: "neXEF4Y2",
merchantAccount: "GroupEdTest",
sessionValidity: "2018-01-01T00:00:00Z",
merchantReturnData: "http://www.mywebsiteUrl.com.s3-website.eu-west-2.amazonaws.com/#/transactionhistory",
shopperEmail: "sam@gmail.com",
shopperReference: "Sam"
}
return this.http.post('https://test.barclaycardsmartpay.com/hpp/pay.shtml', JSON.stringify(paymentPost)).map((response: Response) => {
console.log('TODO: process response', response);
return response.json();
}).catch(this.handleError);
Note that I have changed some of the values in the post to keep the data confidential.
Any ideas what might be my issue here?