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

nirpan's avatar

Where is Stripe() function defined in Spark Aurelius?

I am upgrading from Laravel 5.4 to Laravel 5.8 and the Spark from @dev to ~8.0. I am now encountering an issue where the anytime I try to use any Spark feature that tries to use Stripe, it throws the Invalid Stripe Key/Secreterror even though the keys are correct.

I managed to find out where the exception is being thrown from. There is a mixin for creating a card field in the front end with the following code:

module.exports = {
    /**
     * The mixin's data.
     */
    data() {
        return {
            stripe: Spark.stripeKey ? Stripe(Spark.stripeKey) : null
        }
    },


    methods: {
        /**
         * Create a Stripe Card Element.
         */
        createCardElement(container){
            if (!this.stripe) {
                throw "Invalid Stripe Key/Secret";
            }

            var card = this.stripe.elements().create('card', {
                hideIcon: true,
                hidePostalCode: true,
                style: {
                    base: {
                        '::placeholder': {
                            color: '#aab7c4'
                        },
                        fontFamily: 'Whitney, Lato, -apple-system, BlinkMacSystemFont,"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji","Segoe UI Emoji", "Segoe UI Symbol"',
                        color: '#495057',
                        fontSize: '15px'
                    }
                }
            });

            card.mount(container);

            return card;
        }
    },
};

The this.stripe is coming up as undefined even though the keys are properly set and I am trying to find where the Stripe function used to create thethis.stripe object is located but I can't seem to find it anywhere. Is there something obvious I am missing that need to look into?

Thanks

0 likes
1 reply
nirpan's avatar
nirpan
OP
Best Answer
Level 6

Found out where it came from. Should have been obvious for anyone else who might have this issue, the Stripe function is loaded from the <script src="https://js.stripe.com/v[x]/"></script>. My issue was when I upgraded to Spark Aurelius from the older version, some templates had the v2 link rather than the v3 link so I did a find and replace on all the links with the following and it is now working fine:

<script src="https://js.stripe.com/v3/"></script>

Please or to participate in this conversation.