#fabianoarruda

1 messages ยท Page 1 of 1 (latest)

uneven quarryBOT
west sluice
#

Hello ๐Ÿ‘‹
just adding the script tag should work

#

unless your network request to get the script is failing somewhere

cloud mural
#

WHile loading it manually via script tag, do I still need to do
import { loadConnect } from "@stripe/connect-js";

#

?

#

I get this error if I do:

Uncaught TypeError: Failed to resolve module specifier "@stripe/connect-js". Relative references must start with either "/", "./", or "../".
west sluice
#

that seems like react syntax so no you don't need that unless you're running a react app in your rails project

cloud mural
#

No I dont use React. just plain js.

west sluice
#

you should be able to call loadConnect in your js directly once you include the script tag

cloud mural
#

Makes sense, That's exactly what I'm trying. I have inside page head:

<script src="https://connect-js.stripe.com/v0.1/connect.js"></script>

But still getting this error in my js console:

An error occurred:  ReferenceError: loadConnect is not defined
#

Here is my js code (based in the example from Stripe Docs)

west sluice
#

If you inspect the page, are you seeing the script loading successfully?

also if your code is trying to access loadConnect before script was loaded then it is possible that might be causing the error

#

can you add defer to your script tag?

cloud mural
#

Notice that I'm following the "beta" guide, bacause I'm tsting the payouts component

#

Seems to be loaded ok. Still, if I try loadConnect() in js console, I get that error

#

loadConnect is not defined

west sluice
#

can you put a debugger before the line where you access loadConnect and see if the connect.js has been loaded by the time you're accessing it?

cloud mural
#

Tried adding defer, no luck also :/