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

ldev's avatar
Level 6

Laravel Cashier/Stripe Elements - integration error

Would appreciate some help.

I'm using Laravel Cashier for the first time and I'm continually encountering an error implementing the Stripe.js library.

Whenever I request the view in the browser I receive the following console error in dev tools:

"Uncaught IntegrationError: card Element didn't mount normally".

This is the view (a near duplicate of what's found in the Laravel Cashier documentation):


@extends('layout')
@section('content')
    <form id="payment-form">
        <input id="card-holder-name" type="text">

        <!-- Stripe Elements Placeholder -->
        <div id="card-element"></div>

        <button id="card-button" data-secret="{{ $intent->client_secret }}">
            Update Payment
        </button>
    </form>

    @push('scripts')
        <script src="https://js.stripe.com/v3/"></script>

        <script>
            const stripe = Stripe('{{ env('STRIPE_KEY') }}');

            const elements = stripe.elements();
            const cardElement = elements.create('card');

            cardElement.mount('#card-element');

            const cardHolderName = document.getElementById('card-holder-name');
            const cardButton = document.getElementById('card-button');
            const clientSecret = cardButton.dataset.secret;

            cardButton.addEventListener('click', async (e) => {
                const { setupIntent, error } = await stripe.confirmCardSetup(
                    clientSecret, {
                        payment_method: {
                            card: cardElement,
                            billing_details: { name: cardHolderName.value }
                        }
                    }
                );

                if (error) {
                    // Display "error.message" to the user...
                } else {
                    // The card has been verified successfully...
                }
            });
        </script>
    @endpush
@endsection

I'm wondering if it's a conflict with Vue?

0 likes
2 replies
MohamedTammam's avatar

Make sure that the scripts not in the head but in the end of the body tag or at least after the stripe element.

1 like
ldev's avatar
Level 6

@MohamedTammam Thanks. Stack('scripts') is right before the closing body tag, but it still returns the same error in dev tools.

The card element renders on the page but whenever it's submitted it doesn't send the payment details. The logs in Stripe show a 200 response, which includes "status": "requires_payment_method"

However, as per the Laravel docs it's supposed to return an identifier for the payment.

I'm tempted to start a fresh Laravel app just so I can see if it's a conflict with my installation/dependencies and to get a better feel for a working implementation of Stripe/Cashier (which I've never seen, as this is the first time I've ever integrated Stripe.js or used Cashier).

Please or to participate in this conversation.