function sofort_ipn()
{
    global $edd_options;
    if (isset($_GET['sofort']) && $_GET['sofort'] == 'ipn') {
        require_once 'library/sofortLib.php';
        $notification = new SofortLib_Notification();
        $notification->getNotification();
        $transactionId = $notification->getTransactionId();
        if ($transactionId) {
            // fetch some information for the transaction id retrieved above
            $transactionData = new SofortLib_TransactionData(trim($edd_options['sofort_config_id']));
            $transactionData->setTransaction($transactionId);
            $transactionData->sendRequest();
            $reason = $transactionData->getReason();
            $payment_id = str_replace('CartId ', '', $reason[0]);
            edd_update_payment_status($payment_id, 'publish');
            edd_insert_payment_note($payment_id, 'Payment Successful. Transaction ID is ' . $transactionId);
        }
        exit;
    }
}