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

GrahamMorbyDev's avatar

TokenMismatchException in VerifyCsrfToken.php line 68:

So im playing with Cashier trying to set up a subscription form

form looks like

<div>
    <form action="/" method="POST">
       <script
                src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                data-key="pk_test_ylThVfhN9BlO4pdm4evJTeWi"
                data-amount="2181"
                data-name="OG Pokemon"
                data-description="monthly UK"
                data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                data-locale="auto"
                data-currency="gbp">
        </script>
    </form>
</div>

Posts to this route

Route::post('/', function() {
    $token = Input::get('stripeToken');
    Auth::user()->subscription('monthly')->create($token);
    return 'DONE';
});

and get this error

TokenMismatchException in VerifyCsrfToken.php line 68:

any ideas?

Thanks guys

0 likes
3 replies
EventFellows's avatar

Well, are you sure you are including the Laravel CSRF token (correctly)?

This looks like being independant from stripe to me.

GrahamMorbyDev's avatar

Within this form?

I added {{ csrf_field() }} to it and it threw me a new error so that seems legit

Thanks

EventFellows's avatar

The VerifyCsrfToken.php handles the Laravel token and has nothing to do with stripe.

And as your TokenMismatchException is thrown from the respective middleware I can only think of 2 secenarios

  • supplied token is wrong
  • no token supplied

Could check your Chrome Dev Tools to see if the token is there (I believe it is under cookies)

Please or to participate in this conversation.