question

Omar Reyes avatar image
Omar Reyes asked georgeono answered

Javascript SDK - No 'Access-Control-Allow-Origin' header is present on the requested resource

I am using the remote-pay-cloud sdk in javascript for my semi-integration project. I copied over the javascript files from this repository https://github.com/clover/remote-pay-...

We uploaded our code that we been testing in localhost to our beta server. We had no problems in localhost but receive the error below when running in our beta server which is under https.

The CORS setting in the dashboard is set to the correct domain because we're able to retrieve an access token.

Any ideas what is wrong?

xmlHttpSupport.js:59 GET https://www.clover.com/v3/merchants/MYMERCHANTID/devices?accesstoken=MYTOKEN XmlHttpSupport.doXmlHttp @ xmlHttpSupport.js:59XmlHttpSupport.getData @ xmlHttpSupport.js:91Clover.initDeviceConnectionInternal @ Clover.js:371Clover.initDeviceConnectionInternal @ Clover.js:431Clover.initDeviceConnection @ Clover.js:232(anonymous function) @ confirmation.php?orderId=11585446&merchantid=MYMERCHANTID&employeeid=MYEMPLOYEEID&clientid=C20…:1767dispatch @ jquery-2.1.4.min.js:3r.handle @ jquery-2.1.4.min.js:3 /admin/confirmation.php?orderId=11585446&merchantid=MYMERCHANTID&employee…lientid=MYEMPLOYEEID#accesstoken=MY_TOKEN:1

XMLHttpRequest cannot load https://www.clover.com/v3/merchants/MYMERCHANTID/devices?accesstoken=MYTOKEN. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://beta.petexec.net' is therefore not allowed access. The response had HTTP status code 401.

Clover Mini
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

georgeono avatar image
georgeono answered

I also had the issue - make sure that the details when creating the listener are correct. If the details ar enot correct, no CORS details are added to the response. Beware that even a missing "www" can make the app not behave as expected. For the sandbox, I am using the following domain: "https://apisandbox.dev.clover.com/".

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community