diff --git a/ghost/portal/src/index.js b/ghost/portal/src/index.js index 8e3152f259..ab91624802 100644 --- a/ghost/portal/src/index.js +++ b/ghost/portal/src/index.js @@ -11,6 +11,20 @@ function addRootDiv() { document.body.appendChild(elem); } +function loadStripe() { + // We don't want to load Stripe again if already loaded + if (!window.Stripe) { + // Get the first script element on the page + const ref = document.getElementsByTagName('script')[0]; + // Create a new script element + const script = document.createElement('script'); + // Set the script element `src` + script.src = 'https://js.stripe.com/v3/'; + // Inject the script into the DOM + ref.parentNode.insertBefore(script, ref); + } +} + function handleTokenUrl() { const url = new URL(window.location); if (url.searchParams.get('token')) {