I have seen and read many posts on Cross-Origin Request Blocked but none of them make much sense to me.
I am integrating Amazon Pay into a Sitecore/MVC site and all was going well. However on the page I am rendering the button I have started to see an error. If I open the developer tools in either Chrome of Firefox and then load the page I see this is red:
GET https://payments-uk-sandbox.amazon.com/merchantAc…tus?countryOfEstablishment=UK&ledgerCurrency=GBP 200 OK 66ms Widgets.js (line 43)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://payments-uk-sandbox.amazon.com/merchantAccount/AAAJJFJJJFJJF/accountStatus?countryOfEstablishment=UK&ledgerCurrency=GBP . (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
From what I am reading and the way I am understanding it the problem is on the Amazon side. That would make sense as I wasn’t getting this error yesterday and I have not changed any code on my page.
Can someone tell me if I have this right? Is there anything I can do on my end?
The error you are encountering, “Cross-Origin Request Blocked,” typically occurs when you make a request from one domain to another domain, and the browser enforces the Same Origin Policy. This policy restricts requests to only be made to the same domain by default, for security reasons.
In this case, it seems that the issue is on the Amazon Pay side, as the error message indicates that the response from the Amazon Pay server is missing the required CORS (Cross-Origin Resource Sharing) headers. These headers need to be set by the server to allow cross-origin requests from your domain.
As an integrator, there isn’t much you can do on your end to resolve this issue since it involves the configuration of the Amazon Pay server. You may want to double-check your integration code to ensure that you are using the correct URLs and parameters.
To resolve this problem, I recommend reaching out to the Amazon Pay support team or their developer forums for further assistance. They will be able to provide you with specific guidance and troubleshooting steps to address the CORS issue and ensure successful integration with your Sitecore/MVC site.