Index: /mods/wpsg_mod_prepayment.class.php
===================================================================
--- /mods/wpsg_mod_prepayment.class.php	(revision 8345)
+++ /mods/wpsg_mod_prepayment.class.php	(revision 8346)
@@ -175,4 +175,46 @@
 		} // private function get_subject($order_id)
 
+		public function getDownloadFile($order_id) {
+
+            $file_path = $this->getFilePath($order_id);
+
+            header('Content-Disposition: attachment; filename="'.$file_path.'"');
+
+            return $file_path;
+
+        } // public function getDownloadFile($order_id)
+
+        /**
+         * Startet den Download einer QR-Rechnung wird im Frontend wie im Backend verwendet
+         */
+        private function doDownload($order_id) {
+
+            $file = $this->getDownloadFile($order_id);
+
+            header("Cache-Control: no-cache, must-revalidate");
+            header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+            header('Content-type: application/pdf');
+            header('Content-Disposition: inline');
+
+            die(file_get_contents($file));
+
+        } // private function doDownload($order_id)
+		
+		/**
+		 * Gibt einen Downloadlink fÃŒr die Rechnung fÃŒr die Verwendung im Frontend zurÃŒck
+		 */
+		public function getFrontendLink($order_id)
+		{
+			 
+			$hash = md5($this->shop->get_option('wpsg_salt').'wpsg'.$order_id.'wpsg'.$this->shop->get_option('wpsg_salt'));
+			
+			$url = $this->shop->getDoneURL($order_id);
+			$url .= ((strpos($url, '?') === false)?'?wpsg_action=wpsg_mod_prepayment_download':'&wpsg_action=wpsg_mod_prepayment_download');
+			$url .= '&hash='.$hash.'&order_id='.$order_id;
+			
+			return $url;
+			 
+		} // public function getFrontendLink($order_id)
+
 		/**
 		 * @throws \Exception
@@ -286,5 +328,6 @@
 						'additionalInformation' => $subject,
 						'customerdata' => $kundendaten, 
-						'invoiceAmount' => $betrag
+						'invoiceAmount' => $betrag,
+						'order_id' => $order_id
 					);		
 					$ret[] = $qrCode;		
@@ -370,5 +413,7 @@
 						'additionalInformation' => $subject,
 						'customerdata' => $kundendaten, 
-						'invoiceAmount' => $betrag
+						'invoiceAmount' => $betrag,
+						'filepath' => $this->getFilePath($order_id).'/'.$order_id.'.pdf',
+						'order_id' => $order_id
 					);
 					$ret[] = $qrCode; 
@@ -412,5 +457,6 @@
 						'additionalInformation' => $subject,
 						'customerdata' => $kundendaten, 
-						'invoiceAmount' => $betrag
+						'invoiceAmount' => $betrag,
+						'order_id' => $order_id
 					);		
 					$ret = $qrCode;		
@@ -501,5 +547,7 @@
 						'additionalInformation' => $subject,
 						'customerdata' => $kundendaten, 
-						'invoiceAmount' => $betrag
+						'invoiceAmount' => $betrag,
+						'filepath' => $this->getFilePath($order_id).'/'.$order_id.'.pdf',
+						'order_id' => $order_id
 					);		
 					$ret = $qrCode;
@@ -532,4 +580,15 @@
 				
 			}
+
+			if (wpsg_isSizedString($_REQUEST['wpsg_action'], 'wpsg_mod_prepayment_download'))
+			{
+				
+				$hash = md5($this->shop->get_option('wpsg_salt').'wpsg'.$_REQUEST['order_id'].'wpsg'.$this->shop->get_option('wpsg_salt'));
+				
+				if ($hash != $_REQUEST['hash']) die(__('Kein Zugriff', 'wpsg'));
+					
+				$this->doDownload($_REQUEST['order_id']);
+				
+			}	
 			
 		}
Index: /views/mods/mod_prepayment/order_done.phtml
===================================================================
--- /views/mods/mod_prepayment/order_done.phtml	(revision 8345)
+++ /views/mods/mod_prepayment/order_done.phtml	(revision 8346)
@@ -39,4 +39,5 @@
 					<div class="wpsg_mod_prepayment_info_left" style="display: flex; flex-direction: column;">
 						<h4 style="margin: 0;"><?php echo wpsg_translate(__($i['title'], $wpsg)); ?></h4>
+						<?php if (isset($i['filepath'])) { ?><a title="Downloadlink fÃŒr die QR-Rechnung" style="box-shadow:none; font-size:smaller; font-style:italic; text-decoration:underline;" target="_blank" href="<?php echo $this->callMod('wpsg_mod_prepayment', 'getFrontendLink', [$i['order_id']]); ?>">Download</a><?php } ?>
 						<br />
 						<?php echo '<img style="width: 240px; height:240px;" src="data:image/png;base64,'.$i['hash'].'" />'; ?>
@@ -140,4 +141,5 @@
 			<div class="wpsg_mod_prepayment_qrrechnung_left" style="display: flex; flex-direction: column;">
 				<h4 style="margin: 0;"><?php echo wpsg_translate(__($img['title'], $wpsg)); ?></h4>
+				<?php if (isset($i['filepath'])) { ?><a title="Downloadlink fÃŒr die QR-Rechnung" style="box-shadow:none; font-size:smaller; font-style:italic; text-decoration:underline;" target="_blank" href="<?php echo $this->callMod('wpsg_mod_prepayment', 'getFrontendLink', [$i['order_id']]); ?>">Download</a><?php } ?>
 				<br />
 				<?php echo '<img style="width: 240px; height:240px;" src="data:image/png;base64,'.$img['hash'].'" />'; ?>
