wordpress Shortocode running twice?

Try this way, it’s not the proper way to figure it out but it will solve your problem.

function citrusafterpayment_function()
{
    static $calls = 0;

    if($calls == 0){ $calls++;
       mail('[email protected]','check-in','asd');
       global $wpdb;
       if(isset($_REQUEST['TxStatus']) && $_REQUEST['TxStatus'] != '')
       {
           if($_REQUEST['TxStatus'] == 'CANCELED')
           {
           $return_msg = '<div class="row-fluid"><div class="span12"> <div class="error">You have canceled your transaction.</div></div></div>';
          return $return_msg;
           }
       }  
    }


} 

Edited:

You should pass: $_REQUEST['TxStatus'] in the if statement $TxStatus is not defined in the function.