[Vuejs]-Why stripe doesn't correctly redirect after payment with vue-stripe

0👍

This is mine works perfectly try to change from successURL.value to just successURL.

refer to this documentation https://docs.vuestripe.com/vue-stripe/stripe-checkout/subscriptions and look on this page exactly to the code they also use just successURL and cancelURL no value.

<template>
  <div>
    <stripe-checkout
      ref="checkoutRef"
      mode="subscription"
      :pk="publishableKey"
      :line-items="lineItems"
      :success-url="successURL"
      :cancel-url="cancelURL"
      @loading="v => loading = v"
    />
    <button @click="submit">Subscribe!</button>
  </div>
</template>

<script>
import { StripeCheckout } from '@vue-stripe/vue-stripe';
export default {
  components: {
    StripeCheckout,
  },
  data () {
    return {
        el:"checkoutRef",
        publishableKey : import.meta.env.VITE_STRIPE_PUBLISHABLE_KEY,
        loading: false,
        lineItems: [
            {
            price: 'price_1LgqdGALkwKTK48qE1lfox5G',
            quantity: 1,
            },
        ],
        successURL: 'https://'+window.location.host+'/success',
        cancelURL: 'https://'+window.location.host+'/cancel',
    };
  },
  methods: {
    submit () {
      this.$refs.checkoutRef.redirectToCheckout();
    },
  },
};
</script>

Leave a comment