['card'], 'line_items' => [[ 'price_data' => [ 'currency' => 'usd', 'product_data' => [ 'name' => 'Total Order Amount', ], 'unit_amount' => $total_price * 100, // Amount in cents ], 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => 'http://localhost:8080/payment-success.php?session_id={CHECKOUT_SESSION_ID}', 'cancel_url' => 'http://localhost:8080/payment-cancel.php', 'metadata' => [ 'user_id' => $user_id, 'coupon_id' => $coupon_id ] ]); header("Location: " . $checkout_session->url);