Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS error when attempting to fetch the Google Pay config via paypal.Googlepay().config() #6

Open
jkeys089 opened this issue Jun 1, 2024 · 2 comments

Comments

@jkeys089
Copy link

jkeys089 commented Jun 1, 2024

When running the example we’re getting the following CORS error in the browser:

Access to fetch at 'https://www.sandbox.paypal.com/graphql?GetGooglePayConfig' from origin 'http://localhost:8888' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.

The issue occurs during the paypal.Googlepay().config() call and prevents the button from loading.

I verified via curl that there is no Access-Control-Allow-Origin header on this endpoint:

$> curl -v -X OPTIONS https://www.sandbox.paypal.com/graphql?GetGooglePayConfig 2>&1 | grep -i access
< access-control-expose-headers: Server-Timing

Is there maybe something I'm missing or is it possible the endpoint is not working properly?

@eyyazubi
Copy link

eyyazubi commented Jul 8, 2024

i got the same error @jkeys089 did you solved this?

@jkeys089
Copy link
Author

jkeys089 commented Jul 8, 2024

@eyyazubi we resolved it by using a non-local domain + TLS cert. In our case ngrok was the easiest method since we're already using it to test other services that require non-local domains over HTTPS (e.g. federated auth). However, depending on your dev env there are several other non-commercial options available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants