Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 4
Registered: ‎04-06-2020

CORS error in getHostedPaymentPageRequest API call using Java script

Getting the below error message while calling the API. I have added all the possible options in the header. Please take a look at the JS code and the error message below and suggest me a solution.

JS Code:

--------------

xhr.open("POST", "https://apitest.authorize.net/xml/v1/request.api");
xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
xhr.setRequestHeader("Access-Control-Allow-Headers", "Origin, Accept, Accept-Encoding, Connection, Content-Type, cache-control, method, X-Requested-With, Access-Control-Request-Method, Access-Control-Request-Headers,Authorization,X-Auth-Token");
xhr.setRequestHeader("Access-Control-Allow-Methods","GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS");
xhr.setRequestHeader("Content-Type", "application/json");
//xhr.setRequestHeader("Access-Control-Allow-Origin", "application/json");
xhr.send(data);

 

Error:

----------

Access to XMLHttpRequest at 'https://apitest.authorize.net/xml/v1/request.api' from origin 'https://****.com' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.

Posts: 492
Topics: 0
Kudos: 99
Blog Posts: 0
Ideas: 0
Solutions: 42
Registered: ‎04-28-2017

Re: CORS error in getHostedPaymentPageRequest API call using Java script

Ensure that the domain with the Access-Control-Allow-Origin header is exactly the same as the one your are calling https://apitest.authorize.net/xml/v1/request.api from. For example www.domain.com is considered to be a diffferent domain than domain.com, as is the port https vs http.

 

If you have a public URL that you are https://apitest.authorize.net/xml/v1/request.api from, we could inspect it for you.

Powered by NexWebSites.com -
Certified Authorize.net developers
Member
Posts: 4
Registered: ‎04-06-2020

Re: CORS error in getHostedPaymentPageRequest API call using Java script

Thanks for your response. It is resolved after removing all the headers.

Member
Posts: 1
Registered: ‎07-02-2020

Re: CORS error in getHostedPaymentPageRequest API call using Java script

Getting a Telegram assembling to that size is certainly not a basic achievement and do you anytime need 200,000 people in your social event? To help you with guiding your social occasion to the right size, Telegram offers both treadtopic Telegram Public Group and Telegram Private Groups.

Member
Posts: 1
Registered: ‎08-06-2020

Re: CORS error in getHostedPaymentPageRequest API call using Java script

know we are entertaining with some whatsapp group links not to verified to here just close your eyes and click here you may land in the page it will help you

Member
Posts: 1
Registered: ‎08-06-2020

Re: CORS error in getHostedPaymentPageRequest API call using Java script

for its you need a good tech news so lets clcik it and get good js code definder

Member
Posts: 3
Registered: ‎07-06-2020

Re: CORS error in getHostedPaymentPageRequest API call using Java script

Thanks a lot for solution!

Member
Posts: 1
Registered: ‎05-12-2021

Re: CORS error in getHostedPaymentPageRequest API call using Java script

remove Header I will be fixed.

 

You Can Connect us with Whatsapp Group Link

Member
Posts: 1
Registered: ‎06-02-2021

Re: CORS error in getHostedPaymentPageRequest API call using Java script

"Learn all about CORS, the difference between simple and preflighted requests

and how to add CORS support to an existing Node Express app! "