Can not get stripe npm module to work

I have installed the stripe npm module, it shows up under backend/node_modules.

I try to import in on my page with the following code:

import stripe from ‘stripe’;

This causes my page to crash upon loading. onready does not run. No error messages are generated.

If I comment out the import statement, everything starts working again.

I assume I am doing the right thing since I am following the documentation.

Any help?

Silly me, I was trying to use an npm module from front end. Obviously you can only call from backend code.

I tried using the api directly and that worked. Then I noticed their node module and thought I’d try it.

1 Like

Note that you can now use npm packages in your front-end page code, check out this for more info:

As soon as I try to import stripe in frontend (import { Stripe } from “stripe”:wink: I get an Error: Cannot find module ‘http’

Any suggestions?