I am trying to get Encryption Token by calling the bluesnap API endpoint via browser. But request is blocked by CORS policy. How to get that token through browser, since i need to provide an input for user to enter the amount he wished to recharge.
I am calling this API in my react app through axios.
let xmls = `<param-encryption xmlns="http://ws.plimus.com"><parameters><parameter>
<param-key>amount</param-key>
<param-value>220</param-value>
</parameter>
<parameter>
<param-key>currency</param-key>
<param-value>USD</param-value>
</parameter>
<parameter>
<param-key>language</param-key>
<param-value>ENGLISH</param-value>
</parameter>
`
axios.post("https://sandbox.bluesnap.com/services/2/tools/paramencryption",
xmls,
{
headers: {
"Content-Type": "application/xml",
"Authorization": "Basic QVBJXzE1NDQwGTQ0NzIxMTE5ODg2MTc1MzY6TW9udHkxJhJ="
}
}
)
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
By calling this API i should get Encrypted Token