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

manshu's avatar
Level 28

Stripe Subscription Error TokenMismatchException

I am using stripe to to test subscription model. But after posting, im getting the following error.

TokenMismatchException in VerifyCsrfToken.php line 53:

0 likes
5 replies
manshu's avatar
Level 28

Nope. I did that, still same thing. That's my code.

form action="" method="POST" type="hidden" name="_token" value="{{ csrf_token() }}"

cheah2go's avatar

Don't put it inside the opening form tag. Put it in between the opening and closing form tags. The csrf_field() function just creates a hidden input in your form named _token that contains the token.

jasrys's avatar

like so:

<form id="myform">
    {{ csrf_field() }}
    <input name="name">
</form>

1 like
wilsoncooke's avatar

Stripe does not know what to do with the CSRF token you are passing through, you can exclude the CSRF token from being used by adding the URI used to the $except array within the VerifyCSFToken middleware and removing it from the form.

Please or to participate in this conversation.