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

GrahamMorbyDev's avatar

Laravel Cashier - No Such token

Hey I'm trying to set up laravel cashier and getting an error of

No such token:

My Form looks like

<div class="col-md-12">
            <form action="/subscribe_process" method="POST">
                <script
                        src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                        data-key="{{ env('STRIPE_PUBLISHABLE_SECRET') }}"
                        data-amount="1999"
                        data-name="Retro Gamer Crate"
                        data-description="Online course about integrating Stripe"
                        data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                        data-locale="auto"
                        data-currency="usd">
                </script>
            </form>
        </div>

and my controller like so

public function subscribe_process(Request $request)
    {

        try {
            Stripe::setApiKey(env('STRIPE_SECRET'));

            $user = User::find(3);

            $customer = Customer::create(array(
                'email' => $request->stripeEmail,
                'source' => $request->stripeToken
            ));

            $user->newSubscription('retrogamercrate', 'prod_DYZ07fQJTO3F4J')->create($request->stripeToken);

            return 'Subscription successful, you get the course!';
        }
        catch (\Exception $ex) {
            return $ex->getMessage();
        }

    }

I have set the plan up in stripe on test data

0 likes
0 replies

Please or to participate in this conversation.