title: Stripe has problem: Uncaught IntegrationError: stripe.redirectToCheckout: Invalid value for sessionId. You specified 'pi_1Fr...9sCWFtQr'
body: <p>I was trying to use Stripe checkout. I generated session and then it showed up on the dashboard. I then tried to run directocheckout on an html file with hardcoded id. But error<code>Uncaught IntegrationError: stripe.redirectToCheckout: Invalid value for sessionId. You specified 'pi_1FrFbeBNGS...sCWFtQr'.</code> </p>
  
  <p>I tried to define an json object and use session.id but still doesn't work. What is wrong?</p>
  
  <p>Here is my server.js</p>
  
  <pre><code>const express = require("express");
  const app = express();
  const { resolve } = require("path");
  // Copy the .env.example in the root into a .env file in this folder
  const env = require("dotenv").config({ path: "./.env" });
  const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
  
  (async () =&gt; {
      session = await stripe.checkout.sessions.create({
        payment_method_types: ['card'],
        line_items: [{
          name: 'T-shirt',
          description: 'Comfortable cotton t-shirt',
          images: ['https://example.com/t-shirt.png'],
          amount: 500,
          currency: 'usd',
          quantity: 1,
        }],
        success_url: 'https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
        cancel_url: 'https://example.com/cancel',
      });
      console.log(session.id);
      return session;
    })().then(function(session){
        console.log(session.id)
    });
  </code></pre>
  
  <p>here is my index.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
      &lt;script src="https://js.stripe.com/v3/"&gt;&lt;/script&gt;
      &lt;body&gt;
          direct to payment
      &lt;/body&gt;
      &lt;script&gt;
  
          var stripe = Stripe('pk_test_XhC9cMRDNNqdkBVtHwzgYTQa00ov5gDmmN');
          id = 'pi_1FrFEYBNGSiXwN3Wx3FBbawa';
          stripe.redirectToCheckout({
              // Make the id field from the Checkout Session creation API response
              // available to this file, so you can provide it as parameter here
              // instead of the {{CHECKOUT_SESSION_ID}} placeholder.
              sessionId: session.id
          }).then(function (result) {
              // If `redirectToCheckout` fails due to a browser or network
              // error, display the localized error message to your customer
              // using `result.error.message`.
              if (result.error) {
              var displayError = document.getElementById("error-message");
              displayError.textContent = result.error.message;
              }
          });
      &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the full error</p>
  
  <pre><code>Uncaught IntegrationError: stripe.redirectToCheckout: Invalid value for sessionId. You specified 'pi_1FrFbeBNGSiXwN3W9sCWFtQr'.
      at new t (https://js.stripe.com/v3/:1:10765)
      at Eu (https://js.stripe.com/v3/:1:136437)
      at wu (https://js.stripe.com/v3/:1:137398)
      at Ou (https://js.stripe.com/v3/:1:138478)
      at Pu (https://js.stripe.com/v3/:1:138592)
      at e.redirectToCheckout (https://js.stripe.com/v3/:1:139007)
      at file:///Users/MattMachine/sdpp_stripe/client.html:62:16
  t @ (index):1
  Eu @ (index):1
  wu @ (index):1
  Ou @ (index):1
  Pu @ (index):1
  (anonymous) @ (index):1
  (anonymous) @ client.html:62
  </code></pre>