Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ChrisPercival's avatar

Problem with Vue & Stripe setup

I am using Laraval v5.4.35 & following the lessons for 'How to Accept Payments'.

The issue is ' ReferenceError: StripeCheckout is not defined'.

Here's my code & thanks for any help

Chris

    <button type="submit" class="btn btn-primary" @click.prevent="buy">Subscribe</button>
</form>

export default { data(){ return { stripeEmail: '', stripeToken: '' } },
    created(){
        this.stripe = StripeCheckout.configure({
            key: Gcnvars.stripeKey,
            image: "https://stripe.com/img/documentation/checkout/marketplace.png",
            locale: "auto",
            token: (token) => {
                this.stripeEmail = token.email;
                this.stripeToken = token.id;

                axios.post('/subscription/create', this.$data)
                    .then(response => alert('Complete! Thanks for you payment!'));
            }
        })
    },

    methods: {
        buy() {
            this.stripe.open ({
                name: 'Get Connected.Network',
                description: 'GCN 12mth subscription',
                zipCode: true,
                amount: 8700
            });
        }
    },
}
0 likes
1 reply
mauroavello's avatar

Hi Chris, have you imported StripeCheckout in your app.js file?

You need to install the npm package from Stripe and then on your app.js

import StripeCheckout  from 'npm stripe package name';

Vue.use(StripeCheckout);

I think that should do it

Please or to participate in this conversation.