@tjnapster555 Store the payment status against the order. Could be as simple as a boolean column called paid. Fetch the order before creating the Stripe charge. If the order’s already been paid, redirect back with an error message.
$order = Order::findOrFail($orderId);
if ($order->paid()) {
return redirect()->back()->withError('Order has already been paid.');
}
StripeCharge::create([
// attributes...
]);
$order->markAsPaid();
I’d also recommend Cashier for using Stripe in Laravel. It has a nice charge() method that makes code a bit nicer:
$charge = $user->charge($amount, $options);
$order->update([
'paid' => true,
'stripe_charge_id' => $charge->id,
]);