How to integrate stripe into chrome extension with manifest V3

Following are the error while working:

  1. Not working with sr in script tag like following:

    <script src="https://js.stripe.com/v3/" async></script>

  2. After adding it manually now mounting card but not know how to create checkout after form submission with card values.

  3. Following function not working:

    fetch('/create-checkout-session', {
      method: 'POST',
    })
    .then(function (response) {
      console.log('response', response);
      // return response.json();
    })
    .then(function (session) {
      console.log('session', session);
      // return stripe.redirectToCheckout({ sessionId: session.id });
    })
    .then(function (result) {
      console.log('result', result)
      // If `redirectToCheckout` fails due to a browser or network
      // error, you should display the localized error message to your
      // customer using `error.message`.
      // if (result.error) {
      //   alert(result.error.message);
      // }
    });
    

error:

POST chrome-extension://nldmbdiekelgaahflcjkhigmiochfaib/create-checkout-session net::ERR_FILE_NOT_FOUND

Source: Ask Javascript Questions

LEAVE A COMMENT