Stripe amount not shown

I am encountering the following error when attempting to create a Payment Intent in Stripe Test Mode:

The amount must be greater than or equal to the minimum charge amount allowed for your account and the currency set (https://docs.stripe.com/currencies#minimum-and-maximum-charge-amounts).
If you want to save a Payment Method for future use without an immediate payment, use a Setup Intent instead: https://docs.stripe.com/payments/setup-intents.

In my creeaza_Sesiune.php file, I am attempting to create a Stripe Payment Intent for an order, where the total amount is dynamically calculated by summing up the prices of the products in the cart. However, I am receiving this error message when the Payment Intent is created, even though the amount seems correct according to my var_dump.
I am correctly calculating the total amount in my PHP code before creating the Payment Intent.

The var_dump of the amount variable shows the correct value that I expect to charge. but Stripe takes the amount value as 0 and my payment is invalid.
Here is the code i’ve hidden the api key for security purposes :

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
session_start();
include("connection.php");
require 'vendor/autoload.php';
use StripeStripe;
use StripeWebhookEndpoint;
global $pdo;

class StripeService
{
    private $apiKey = 'sk_test_your_key_here';
    
    public function __construct()
    {
        StripeStripe::setApiKey($this->apiKey);
    }

    public function createPaymentIntent($orderReferenceId, $amount, $currency, $email, $customerDetailsArray, $notes, $metadata, $products)
    {
        try {
            $paymentIntent = StripePaymentIntent::create([
                'currency' => $currency,
                'amount' => intval($amount * 100), 
                'payment_method_types' => ['card'],
            ]);

            $output = array(
                "status" => "success",
                "response" => array('orderHash' => $orderReferenceId, 'clientSecret' => $paymentIntent->client_secret)
            );

        } catch (Exception $e) {
            $output = array(
                'status' => 'error',
                'response' => $e->getMessage()
            );
        }

        header('Content-Type: application/json');
        echo json_encode($output);
    }

    public function getToken()
    {
        $token = "";
        $alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        $alphabet .= "abcdefghijklmnopqrstuvwxyz";
        $alphabet .= "0123456789";
        $max = strlen($alphabet) - 1;
        for ($i = 0; $i < 17; $i++) {
            $token .= $alphabet[mt_rand(0, $max)];
        }
        return $token;
    }
}

$stripeService = new StripeService();

$orderReferenceId = $stripeService->getToken();

$amount = 0;

$id_partner = $_SESSION['id_partner'];
$status_order = "in_cart"; 
$sql = "SELECT p.name, p.price AS price, c.quantity AS quantity 
        FROM cart_orders c 
        JOIN products p ON c.product_code = p.product_code 
        WHERE c.id_partner = ? AND c.status_order = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$id_partner, $status_order]);
$products = $stmt->fetchAll(PDO::FETCH_OBJ);

foreach ($products as $product) {
    $amount += $product->price * $product->quantity;
}

$currency = 'RON'; 
$email = isset($_POST['email']) && !empty($_POST['email']) ? $_POST['email'] : '';
$customer_name = isset($_POST['name']) && !empty($_POST['name']) ? $_POST['name'] : '';
$address = isset($_POST['address']) && !empty($_POST['address']) ? $_POST['address'] : '';
$country = isset($_POST['country']) && !empty($_POST['country']) ? $_POST['country'] : 'RO';
$postal_code = isset($_POST['postalCode']) && !empty($_POST['postalCode']) ? $_POST['postalCode'] : '';
$description = isset($_POST['description']) && !empty($_POST['description']) ? $_POST['description'] : '';

$customerDetails = [
    "name" => $customer_name,
    "address" => $address,
    "postalCode" => $postal_code,
    "country" => $country,
];

$metadata = [
    "id_partner" => $id_partner,
    "client_name" => $customer_name,
    "client_email" => $email
];

$stripeService->createPaymentIntent($orderReferenceId, $amount, $currency, $email, $customerDetails, $description, $metadata, $products);
?>

Despite the fact that I confirmed the correct value for amount (via var_dump() and echo), I received an error message from Stripe:

The amount must be greater than or equal to the minimum charge amount allowed for your account and the currency set (https://docs.stripe.com/currencies#minimum-and-maximum-charge-amounts).
If you want to save a Payment Method for future use without an immediate payment, use a Setup Intent instead: https://docs.stripe.com/payments/setup-intents.

Additionally, I ensured that the database was correctly populated, and there were no null values in any relevant fields (product prices, quantities, etc.). Everything in the database looked fine, with proper values for the products in the cart.