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

emirk's avatar

Laravel 5.1, stripe: You cannot use a Stripe token more than once

Hello there, I have a problem with subscribing to a stripe plan, the message I get:

You cannot use a Stripe token more than once: tokenxxx

What could cause a problem?

public function upgradeSilver() {

        $bid = Session::get('builderId');

        $token = $_POST['stripeToken'];

        try {

            $user = \App\User::find($bid);

            if (!$user->onPlan('silver')) {

                $user->subscription('silver')->create($token);
                $charge = \Stripe\Charge::create(array(
                    "amount"        => 4000, // amount in cents, again
                    "currency"      => "gbp",
                    "source"        => $token,
                    "description"   => "Silver package charge")
                );

                $update = \App\User::where('id', '=', $bid)->update([
                    'quotes_left' => $user->quotes_left + 20
                ]);

                return Redirect::route('builders-packages')->with('success', 'You have successfully ordered a Silver package. Thank you!');
            
            } else {
                return Redirect::route('builders-packages')->with('error', 'You are already subscribed');
            }
            
            
        } catch(\Stripe\Error\Card $e) {
            return Redirect::route('builders-packages');
        }

    }
0 likes
2 replies
JeffreyWay's avatar

Usually, you get that error when you're trying to post to your server multiple times with the same Stripe token. For example, hitting refresh on a POST request. You can't do that. You have to resubmit the previous form, and fetch a fresh token.

emirk's avatar

I am resubmitting the form everytime, fetching the $token key freshly every time...

Please or to participate in this conversation.