#du-stripe-import
1 messages · Page 1 of 1 (latest)
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.
- remarkable_unicorn_49527, 9 hours ago, 2 messages
@ionic granite hello! Can you explain what you are trying to do in details please?
we are using stripe for our payments
and on our pages we are importing stripe js libraries
using
import { loadStripe } from '@stripe/stripe-js'
can i caht here ?
yes
but now , thisi is static import and it leads to some js initialization calls as soon as sthe application loads
like
du-stripe-import
but some of our customers dont want these calls , so we want to dynamically import these libraries instead of importing them statically for all
So you are asking how to dynamically load Stripe.js specifically?
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
any code example we can see to check the use case
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
there's also an example folder: https://github.com/stripe/stripe-js/tree/master/examples
so you mean to say we can add this script tag
<!-- Somewhere in your site's <head> -->
<script src="https://js.stripe.com/v3" async></script>
based on wher we want it ?
no
this is an npm package that you build your code with and then you can dynamically import and run loadStripe when needed
can we use this - @stripe/stripe-js/pure
pure form , it says it gets called only when we call the loadStripe
yes that should work
and waht about the other elemts
like
import { Elements } from '@stripe/react-stripe-js'
we are also using this
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