title: Stripe Checkout example running into CORS error from localhost
body: <p>I am trying to integrate Stripe Checkout using the instructions given here <a href="https://stripe.com/docs/payments/accept-a-payment?integration=checkout" rel="noreferrer">https://stripe.com/docs/payments/accept-a-payment?integration=checkout</a> for node.</p>
  <p>I have followed their instructions to a tee and have updated the API key in the example with an actual (test) one from my account.</p>
  <p>I am using React in the frontend and express in the backend. I have enabled cors.</p>
  <p>The request from React to the backend succeeds and a preflight request is kicked off to stripe. The preflight response from stripe is a 403 and the actual request is blocked with a CORS error - <code>PreflightMissingAllowOriginHeader</code></p>
  <h2>Backend Code (minimal)</h2>
  <pre><code>const express = require(&quot;express&quot;);
  const app = express();
  const cors = require(&quot;cors&quot;);
  
  const stripe = require(&quot;stripe&quot;)(
    process.env.STRIPE_SECRET_KEY
  );
  
  app.use(
    cors({
      origin: [&quot;http://localhost:8000&quot;, &quot;https://checkout.stripe.com&quot;],
    })
  );
  
  app.post(&quot;/create-checkout-session&quot;, async (req, res) =&gt; {
    console.log('getting here 1')
    const session = await stripe.checkout.sessions.create({
      payment_method_types: [&quot;card&quot;],
      line_items: [
        {
          price_data: {
            currency: &quot;usd&quot;,
            product_data: {
              name: &quot;T-shirt&quot;,
            },
            unit_amount: 2000,
          },
          quantity: 1,
        },
      ],
      mode: &quot;payment&quot;,
      success_url: &quot;http://localhost:4242/success.html&quot;,
      cancel_url: &quot;http://localhost:4242/cancel.html&quot;,
    });
    
    console.log('getting here 2')
    res.redirect(303, session.url);
  });
  
  app.listen(4242, () =&gt; console.log(`Listening on port ${4242}!`));
  </code></pre>
  <h2>Frontend Code</h2>
  <pre><code>  handleClick = () =&gt; {
      const res = fetch(`${process.env.BACKEND_API_URL}/create-checkout-session`, {
        method: 'POST',
        headers: {
          &quot;Content-Type&quot;: 'text/html'
        }
      })
    }
  </code></pre>