ERRORS that i recieved in the console:
=>angular.js:11048 OPTIONS https://connect.squareup.com/v2/locations/xxxxxxxxxxxxx/checkouts 403 (Forbidden)
=>XMLHttpRequest cannot load https://connect.squareup.com/v2/locations/xxxxxxxxxxxxx/checkouts. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 403.
i am receiving this error while connecting Square Checkout from localhost.
Like I said, you need to make the request to the checkout enpoint from the server side, not client side. It looks like you are trying to use AngularJS, which makes requests in the client. Instead you need to make the request with your server. That is why postman works, whereas your browser does not.
What do you mean by connecting?
You'll need to use a server-side language to generate a checkout form.
Actually we post object to this api "https://connect.squareup.com/v2/locations/XXXXXXXXX/checkouts" from our dev browser "http://localhost:9000". We get error
=>angular.js:11048 OPTIONS https://connect.squareup.com/v2/locations/xxxxxxxx
=>XMLHttpRequest cannot load https://connect.squareup.com/v2/locations/xxxxxxxxxxxxx/checkouts. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 403.
But when we tried to post object to the above api using postman application, it returns checkout ID in response.
Like I said, you need to make the request to the checkout enpoint from the server side, not client side. It looks like you are trying to use AngularJS, which makes requests in the client. Instead you need to make the request with your server. That is why postman works, whereas your browser does not.
Square Community