The above link suggests that npm packages can be used on the frontend.
As soon as I try to import stripe in frontend (import { Stripe } from “stripe” I get an Error: Cannot find module ‘http’
Any suggestions?
The above link suggests that npm packages can be used on the frontend.
As soon as I try to import stripe in frontend (import { Stripe } from “stripe” I get an Error: Cannot find module ‘http’
Any suggestions?
The Stripe NPM handles payments and won’t work in the frontend. You wouldn’t want it to.
See documentation here - [Prebuilt checkout page | Stripe Documentation](Prebuilt checkout page | Stripe Documentation
This)
This requires stripe to be loaded in both the frontend and the backend. See code in the example checkout.html and server.js
@stefanclark Wix supports adding NPM libraries, but we are unable to provide support for them. You will need to discuss this with Stripe technical support to determine how to get this to work.
You might also want to review the Stripe Payment Processing example which does not use the NPM library.
See the article Connecting Stripe as a Payment Provider which might provide a solution for you.
@yisrael-wix I already have a similar implementation working, however I don’t believe that this method supports Strong Customer Authentication and so I am looking to implement one of the newer integrations to meet the enforcement deadline.
The error which I am getting seems to be a wix issue - and I don’t think I would get any support at this point from Stripe. I have not including any stripe code, except for including/loading the module. The import line works without issue on a backend script file.
@stefanclark What you are trying to do is not possible. Stripe’s npm is meant only for backend use.
On stripe’s example checkout.html
see line 7 ](
<scriptsrc=“https://js.stripe.com/v3/”>) [**<script**](
<scriptsrc=“https://js.stripe.com/v3/”>) [***src***](
<scriptsrc=“https://js.stripe.com/v3/”>) [**="https://js.stripe.com/v3/"**](
<scriptsrc=“https://js.stripe.com/v3/”>) [**></script>**](
<scriptsrc=“https://js.stripe.com/v3/”>) [
This imports the stripe script from a url, this is not the stripe npm.
From Stripe: " Stripe Checkout relies on Stripe.js, Stripe’s foundational JavaScript library for collecting sensitive payment information and advanced fraud detection. Always load Stripe.js from js.stripe.com to remain compliant. Do not include the script in a bundle or host it yourself. "
A script import like this is only possible on custom webpages where you can edit write html, not on wix.
If you are looking for 3d secure implementation see this post
Hi @shantanukumar847 , I think I have got confused between line 26 of the checkout.html " var stripe = Stripe ( “pk_test_xxxxxx” );" which is loading from that Stripe.js file and line 1 of the server.js file which is loading the npm module.
It would seem that as including remote js libraries is not supported on Wix, there will be no way to implement an SCA compatible stripe integration via Corvid?
@stefanclark Did you manage to resolve this or find out if this is possible?