0
I need to make a JSON request to Payu, but show me the message:
Blocked cross-origin request: Same origin policy (Same Origin Policy) prevents reading the remote resource on https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi?test=false&language=en&command=PING&merchant%5BapiLogin%5D=111111&Merchant%5BapiKey%5D=22222222. (Reason: CORS header 'Access-Control-Allow-Origin' is not present).
JS
var data = {
"test": false,
"language": "en",
"command": "PING",
"merchant": {
"apiLogin": "1111111",
"apiKey": "22222222"
}
};
$.ajax({
url: "https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi",
method: 'GET',
dataType:'json',
headers: {
'Content-Type': 'application/json',
},
data: data,
success: function(data) {
console.log('ok');
console.log(data);
}
});
I tried to put the following code in the header, but it’s still the same:
'Access-Control-Allow-Origin': '*'
I’ve looked for other similar questions, but none of them helped.