#zombie-lord_api

1 messages ยท Page 1 of 1 (latest)

sharp flameBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1318680739318857779

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

worn plankBOT
silk jacinth
#

Hi there ๐Ÿ‘‹ can you share which line of your code is throwing that error? Is it when you're trying to create an instance of stripe in your client-side JS?

viscid mantle
#

I have this code that runs when the page is loaded:

this.$helpers.loadScript("https://checkout.stripe.com/v3/checkout.js").then(() => {
  this.stripe = Stripe(this.$store.getters.getStripePublishableKey);
})

loadScript is a function that fetches the script and creates a script tag on the document.

#

My previous code, with the original version of checkout, works. So I don't think the problem is the loadScript function:/

#
this.$helpers.loadScript("https://checkout.stripe.com/v3/checkout.js").then(() => {
      this.stripeCheckout = StripeCheckout.configure({
        key: this.$store.getters.getStripePublishableKey,
        image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
        locale: 'auto',
        allowRememberMe: false,
        panelLabel: 'Save Payment Details',
        token: function(token) {
          context.updatePaymentDetails(token)
        }
      })
    })
#

My ultimate goal is to render Stripe Checkout inside a modal, using a session ID I fetch from the server. The server-side session ID fetching works fine.

silk jacinth
#

Hm, it sounds to me like our script hasn't finished loading before you're trying to create an instance of Stripe.

Looking at the import code you shared:

  this.stripe = Stripe(this.$store.getters.getStripePublishableKey);
})```
I'm thinking you're importing the wrong file. Does the error subside if you import `https://js.stripe.com/v3` instead? Or are you importing stripe-js another way?
viscid mantle
#

Yeah, I had the wrong URL. Looks like https://js.stripe.com/v3 is the correct URL after all. But now I'm running into a different issue!

silk jacinth
#

Sweet! Glad we're partway there. Are you comfortable working through the new issue, or do you have questions about that?

viscid mantle
#

Never mind, I got it working

#

I'm sure I'll run into more issues but we can close this thread!