Nov 21, 2017
0
Level 1
exeption: You cannot use a Stripe token more than once....
I am using https://github.com/amsgames/laravel-shop with omypay/stripe extension. When I get to the checkout I always get the following erro: "You cannot use a Stripe token more than once:....................."
My code is as following:
if (!Cart::current()->count) {
throw new Exception('Cannot checkout, no items in cart.');
}
//Set gateway
Shop::setGateway('omnipay');
//Indicate service to use
Shop::gateway()->create('Stripe');
//Initialize service
Shop::gateway()->omnipay->initialize([
'apiKey' => env('STRIPE_SECRET_KEY'),
]);
Shop::gateway()->addOption('source', $request->get('stripeToken'));
//Call checkout
if (Shop::checkout())
{
//Create order
$order = Shop::placeOrder();
//Review payment
if($order->hasFailed)
{
return Shop::exception()->getMessage();
}
else
{
Cart::current()->clear();
return "order placed successfully";
}
}
return Shop::exception()->getMessage();
Please or to participate in this conversation.