Level 75
You have amount as integer, so it has to be an integer.
What do you get for this?
dd(Cart::subTotal());
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everyone . What is the solution of this problem. here is my code
Stripe::setApiKey('sk_test_51HvoOvD0N8iA6zau2zVHsTsg3adl5ddxnTIDrB4LjWbvhgwN3dBvwBMaynf7TMzJS6Ozd');
Charge::create([
"amount" => Cart::subTotal(), // error here
"currency" => "usd",
"source" => $request->stripeToken,
"description" => "Test payment from Trustech IT Solutions"
]);
it gives me an error of invalid integer
There is not easy way to convert "2,358.00" to number.
I guess it has to be in cents, so just remove commas and dots from that string
$amount = str_replace([',', '.'], ['', ''], Cart::subTotal());
Please or to participate in this conversation.