#du-stripe-import

1 messages · Page 1 of 1 (latest)

scenic cloakBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

weary wadi
#

@ionic granite hello! Can you explain what you are trying to do in details please?

ionic granite
#

we are using stripe for our payments

#

and on our pages we are importing stripe js libraries

#

using

#

import { loadStripe } from '@stripe/stripe-js'

celest gate
#

can i caht here ?

ionic granite
#

but now , thisi is static import and it leads to some js initialization calls as soon as sthe application loads

#

like

weary wadi
#

du-stripe-import

ionic granite
#

but some of our customers dont want these calls , so we want to dynamically import these libraries instead of importing them statically for all

weary wadi
#

So you are asking how to dynamically load Stripe.js specifically?

ionic granite
#

can we somehow resolve this use case

#

yes

weary wadi
#

I'm sorry those are pictures with big red arrow and zero info

#

You're a dev, me too, let's talk as devs. Focus on your exact code, ask your exact question, etc.

#

The lib I shared lets you dynamically load Stripe.js when you need to instead of on page load

ionic granite
#

any code example we can see to check the use case

weary wadi
#

there's example code right there on the readme

#

it's an npm package so that you can load it dynamically when you need to

ionic granite
#

so you mean to say we can add this script tag

#

based on wher we want it ?

weary wadi
#

no

#

this is an npm package that you build your code with and then you can dynamically import and run loadStripe when needed

ionic granite
#

can we use this - @stripe/stripe-js/pure

#

pure form , it says it gets called only when we call the loadStripe

weary wadi
#

yes that should work

ionic granite
#

and waht about the other elemts

#

like

#

import { Elements } from '@stripe/react-stripe-js'

#

we are also using this

weary wadi
#

sorry you're just throwing extremely short sentences with no details. You are a developer, I shared the exact library you need, the next step is to pause and try this on your own. If you are stuck you can then ask a clear question about what you tried that isn't working

ionic granite
#

ok let me try the pure form and get back if that works

#

i just hope the thread is not closed , it got closed last time