How to pass Javascript Object to PHP with Ajax in WordPress

Solution:

You have an issue on your PHP, try this:

function my_action()
{
    global $wpdb; // this is how you get access to the database

    $whatever = $_POST['whatever'];
    $whatever = json_decode($whatever);
    $amount = intval($whatever['amount']); 

    echo $amount;

    wp_die(); 
}