Node CORS error


#1

I have created a call to create a payment following the sample https://www.npmjs.com/package/paynow but getting this error. Anyone with a solution.

Access to fetch at 'https://www.paynow.co.zw/interface/initiatetransaction' from origin 'https://my domain' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


#2

Hi there,

You are implementing it incorrectly, it is supposed to go in your NodeJS server, not in the user’s browser. You will notice that a CORS error only ever occurs in a browser. Please move implementation to the server.