The 'number_format()' function you are using is incorrect - number_format() function
I am not sure why you multiply the returned amount '$cartTotal' by 100.
First, test this value to see if it returns anything and that it is a number (check if you have added 'R' or '$' before the number, it will fail), if not catch the zero return and let the user know.
If it has a value, format the number properly -
$formattedAmount = number_format($cartTotal,2,".",",");
'$cartTotal' is the returned number
2 is the decimal counter, in this case '2/00'
The dot '.' is the cents/placemark seperator to show cents following the dot
The comma ',' is the thousand seperator
If I run the following, it returns '1,010.39' -
$cartTotal = 110.3856;
<?php echo $formattedAmount; ?>
Output is 1,010.39
You also need to check what is the requirements for PayFast as they might require a different format as accepted amount, yours need to be in the exact same format.