Mangopay/mangopay2-php-sdk

Did not get response for Card Payment(CORS Policy Error)

Bratati14 opened this issue · 1 comments

Hii

For several weeks I have been stuck on a request that does not work whenever i use Maestro Card and Credit Card for payment(using Sandbox) . Its shows some CORS policy error.
I have send request but did not get any response so i simple print the error and i got this error message which is given below.
Error message
Access to XMLHttpRequest at 'https://api.sandbox.mangopay.com/Redirect/ACSWithValidation?token=1533b02f097c48ef879a3ec3bc236bb7&mgpsecureid=1533b02f097c48ef879a3ec3bc236bb7' (redirected from 'https://admin-test.next-commerce.io/buy-out-page-card') from origin 'https://admin-test.next-commerce.io/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

We have add the below access for our server in server side

**location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' 'https://admin-test.next-commerce.io';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, etc.';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, and any other required headers';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}

# For other HTTP methods and regular requests:
add_header 'Access-Control-Allow-Origin' 'https://admin-test.next-commerce.io';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, etc.';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, and any other required headers';
add_header 'Access-Control-Allow-Credentials' 'true';

}**
But the issues did not resolved till now. please do the necessary steps for resolving the issues in prior.
Please let us know if we missed something.

Looking forward to your return.

Thanks in advance.

Hello,

It's not an SDK issue. If you still have the issue please share your code below.