public function getUrl()
 {
     $order = $this->getOrder();
     $session = Mage::getSingleton('core/session');
     $amount = number_format($order->getGrandTotal(), 2, '.', '');
     $security = $this->getSecurityKey();
     $reason1 = Mage::helper('pnsofortueberweisung')->__('Order No.: ') . $order->getRealOrderId();
     $reason1 = preg_replace('#[^a-zA-Z0-9+-\\.,]#', ' ', $reason1);
     $reason2 = Mage::getStoreConfig('general/store_information/name');
     $reason2 = preg_replace('#[^a-zA-Z0-9+-\\.,]#', ' ', $reason2);
     $success_url = Mage::getUrl('pnsofortueberweisung/sofort/return', array('orderId' => $order->getRealOrderId(), '_secure' => true));
     $cancel_url = Mage::getUrl('pnsofortueberweisung/sofort/error', array('orderId' => $order->getRealOrderId()));
     $notification_url = Mage::getUrl('pnsofortueberweisung/sofort/notification', array('orderId' => $order->getRealOrderId(), 'secret' => $security));
     $sObj = new SofortLib_Multipay(Mage::getStoreConfig('payment/sofort/configkey'));
     $sObj->setVersion(self::MODULE_VERSION);
     $sObj->setAmount($amount, $order->getOrderCurrencyCode());
     $sObj->setReason($reason1, $reason2);
     $sObj->setSuccessUrl($success_url);
     $sObj->setAbortUrl($cancel_url);
     $sObj->setNotificationUrl($notification_url);
     $sObj->addUserVariable($order->getRealOrderId());
     $sObj->setEmailCustomer($order->getCustomerEmail());
     $sObj->setSenderAccount($session->getLsBankCode(), $session->getLsAccountNumber(), $session->getLsHolder());
     // set address
     $sObj->setLastschriftAddress($this->_getFirstname($order->getBillingAddress()), $this->_getLastname($order->getBillingAddress()), $this->_getStreet($order->getBillingAddress()), $this->_getNumber($order->getBillingAddress()), $this->_getPostcode($order->getBillingAddress()), $this->_getCity($order->getBillingAddress()), '');
     //$sObj->setPhoneNumberCustomer($order->getCustomerTelephone());
     $sObj->setLastschrift();
     $sObj->sendRequest();
     if (!$sObj->isError()) {
         $url = $sObj->getPaymentUrl();
         $tid = $sObj->getTransactionId();
         $order->getPayment()->setTransactionId($tid)->setIsTransactionClosed(0);
         $order->getPayment()->setAdditionalInformation('sofort_transaction', $tid);
         $order->getPayment()->setAdditionalInformation('sofort_lastchanged', 0);
         $order->getPayment()->setAdditionalInformation('sofort_secret', $security)->save();
         return $url;
     } else {
         $errors = $sObj->getErrors();
         foreach ($errors as $error) {
             Mage::getSingleton('checkout/session')->addError(Mage::helper('pnsofortueberweisung')->localizeXmlError($error));
         }
         return $cancel_url;
     }
 }
 * 
 * Released under the GNU General Public License (Version 2)
 * [http://www.gnu.org/licenses/gpl-2.0.html]
 *
 * $Date: 2012-11-21 12:02:12 +0100 (Wed, 21 Nov 2012) $
 * @version SofortLib 1.5.0rc  $Id: example_lastschrift_by_sofort.php 5724 2012-11-21 11:02:12Z rotsch $
 * @author SOFORT AG http://www.sofort.com (integration@sofort.com)
 *
 */
require_once '../../library/sofortLib.php';
define('CONFIGKEY', '1111:2222:9f5d237b65eb833e69520985f1c14e7c');
//your configkey or userid:projektid:apikey
$Sofort = new SofortLib_Multipay(CONFIGKEY);
$Sofort->setLastschrift();
$Sofort->setReason('Testzweck', 'Testzweck2');
$Sofort->setLastschriftAddress('Vorname', 'Nachname', 'Strasse', '12', '35578', 'Wetzlar', 2);
$Sofort->setSenderAccount('88888888', '12345678', 'Max Mustermann');
$Sofort->setAmount(10);
$Sofort->setSuccessUrl('https://{website}/');
$Sofort->setAbortUrl('https://{website}/');
$Sofort->setTimeoutUrl('https://{website}/');
$Sofort->setNotificationUrl('https://{website}/');
$Sofort->sendRequest();
if ($Sofort->isError()) {
    //PNAG-API didn't accept the data
    echo $Sofort->getError();
} else {
    //buyer must be redirected to $paymentUrl else payment cannot be successfully completed!
    $paymentUrl = $Sofort->getPaymentUrl();
    header('Location: ' . $paymentUrl);
}