#HarryET-vue

1 messages ยท Page 1 of 1 (latest)

young lynx
#

Hello ๐Ÿ‘‹
are you seeing any failed requests in the network tab?

young lynx
#

is it window.stripe vs window.Stripe? ๐Ÿค”

lime jetty
#

oh no sorry that is a typo, as I have a constant file

#

and I have tried logging stripe to ensure it has the function and it does

#

when I add logs before and after the call to confirmPayment it runs the one before but nothing after

young lynx
#

can you log out the high level stripe object that you're storing on window?

lime jetty
#

Here is both the logged output and the weird error

young lynx
#

hmm let me think

lime jetty
#

Yeah got me too! Nothing like it in the docs, going to try accessing the site through ngrok to see if https helps

#

Okay even a production build doesn't help ๐Ÿ˜ฆ

young lynx
#

Unlikely but are you seeing any attempts made to confirm the PaymentIntent on your Stripe dashboard?

lime jetty
young lynx
lime jetty
#

nope

#

last thing was creation of the subscription

young lynx
#

what do you see when you print out elms.value.elements ?

lime jetty
#

@young lynx

young lynx
#

and the element renders just fine?

lime jetty
#

takes a seccond to load but then sure it works

#

here is the actual code for that:

<template>
  <div>
    <div class="space-y-5">
      <p class="text-sm text-gray-500">
        Since you haven't setup a payment method before, you need to add one to
        your swift account now before we can let you sign in. This can be
        changed in the future through the billing portal and won't be charged
        till after the 14 day free trial!
      </p>
      <form @submit="paymentSubmit" class="space-y-5">
        <div
          v-if="!data && !error"
          class="bg-white flex space-x-2 p-5 rounded-full justify-center items-center"
        >
          <div
            class="bg-brand-600 p-2 w-4 h-4 rounded-full animate-bounce animation-delay-100"
          ></div>
          <div
            class="bg-brand-600 p-2 w-4 h-4 rounded-full animate-bounce animation-delay-200"
          ></div>
          <div
            class="bg-brand-600 p-2 w-4 h-4 rounded-full animate-bounce animation-delay-300"
          ></div>
        </div>
        <div v-if="!data && error"></div>
        <StripeElements
          v-if="data && !error"
          v-slot="{ elements }"
          ref="elms"
          :stripe-key="STRIPE_PK"
          :instance-options="ref({})"
          :elements-options="
            ref({
              clientSecret: data.data.clientSecret,
            })
          "
        >
          <StripeElement
            type="payment"
            ref="payment"
            :elements="elements"
            :options="ref({})"
          />
        </StripeElements>
        <button
          type="submit"
          class="inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-brand-600 text-base font-medium text-white hover:bg-brand-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-brand-500 sm:text-sm"
        >
          Start Free Trial
        </button>
      </form>
    </div>
  </div>
</template>
young lynx
#

are you using any third party packages for StripeElements or is this a component you've written that uses Stripe.js functions underneath?

lime jetty
#

OMG, I am an idiot ๐Ÿ˜

young lynx
#

What was it? ๐Ÿ˜„

lime jetty
#

That library creates its own stripe instace which it uses

#

and gives you access to

#

so it should be:

    const { error } = await elms.value.instance.confirmPayment({
      elements: elms.value.elements,
      confirmParams: {
        return_url: "http://localhost:3000/login/stripe/return",
      },
    });
#

I'll make an issue maybe to that package to make that clearer there, but a quick question any reason stripe dosen't have a Vue3 package and only has official react ones

young lynx
#

yup! I had a theory that I was going to write a long essay about here ๐Ÿ™‚
Glad you figured it out

lime jetty
#

Sorry to waste your time ๐Ÿ˜…

young lynx
#

All good ๐Ÿ™‚ Happy to help
Good luck