#xerces817

1 messages · Page 1 of 1 (latest)

lone zodiacBOT
lyric whale
#

Hello

vernal shadow
#

Hello - is this a real person or bot?

lyric whale
#

Real person

#

We are real Stripe devs that help developers. We staff this channel 24/5

#

Anyways, can you share your code for how you are importing and initializing Stripe here?

vernal shadow
#

Ok. In terminal, I simply did [npm i stripe]

#

"use strict";
const stripe = require("stripe")(sk_test....);

#

that's at the very top of a .js file

#

from the docs, this should work just fine

lyric whale
#

Yeah that all seems fine. It sounds like something went wrong with your installation or there is some conflicting dependeny that doesn't like your stripe dependency in your package.json

#

Can you try uninstalling and reinstalling and running your server again?

vernal shadow
#

{
"name": "server",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"dependencies": {
"@strapi/plugin-i18n": "4.13.6",
"@strapi/plugin-users-permissions": "4.13.6",
"@strapi/strapi": "4.13.6",
"better-sqlite3": "8.6.0",
"dotenv-webpack": "^8.0.1",
"stripe": "^13.6.0"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "0947ba0b-2fa6-45d2-81f2-9891f916549d"
},
"engines": {
"node": ">=16.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}

#

that's the package.json for the server

#

I'll try uninstalling and reinstalling again

#

I have strapi installed on the server also as you can see

#

It's not setup as a module; e.g., "type": "module"

lyric whale
#

All that looks fine to me but I don't know anything about Strapi

#

Clearly you do have stripe installed as a depedency

vernal shadow
#

I've tried that and I get "Cannot use import statement outside of a module"

#

per that link you shared, I replaced that const stripe statement with import Stripe from "stripe";
const stripe = new Stripe(sk_test..., {
apiVersion: "2023-08-16",
});

lyric whale
#

Hmmm honestly I'm not sure. It should just work by installing Stripe as a dependency and then initializing via const stripe = require("stripe")(sk_test....);

So to me this sounds like something particular to the plugin you are using and you may want to reach out to them

vernal shadow
#

ok

#

Thank you