function DoPayment($token, $invoice) { global $dbh; global $config; \Stripe\Stripe::setApiKey($config['stripe']['apiKey']); $invoiceData = getFullInvoiceData($invoice); $amount = number_format($invoiceData['invoice_total'], 2, '', ''); try { $charge = \Stripe\Charge::create(array("amount" => $amount, "currency" => "eur", "source" => $token, "description" => "Betaling factuur #{$invoice}")); setInvoicePaid($invoice); return true; } catch (\Stripe\Error\Card $e) { die($e->jsonBody['error']['message']); } }
<p>Selecteer hier rechts een factuur om deze te bekijken<!-- , te downloaden of opnieuw per e-mail te versturen-->.</p> </div> <div class="options-row"> <ul class="options clearfix"> <li><a href="#"><i class="fa fa-credit-card"></i></a></li> <li><a href="#"><i class="fa fa-print"></i></a></li> <li><a href="#"><i class="fa fa-envelope"></i></a></li> </ul> </div> <?php if (isset($_GET['no'])) { $invoiceData = getFullInvoiceData($_GET['no']); } else { $invoiceData = getFullInvoiceData(); } if ($invoiceData['invoice_recipient'] == $_SESSION['user_num']) { ?> <div class="element"> <?php include 'templates/invoice.php'; ?> </div> <?php } else { ?> <div class="element"> <h1>Error!</h1> <p>403 no access.</p>
echo "<th><a class='invoice number' href='/admin/invoices/{$invoices['invoice_number']}'>{$invoices['invoice_number']}</a></th>"; echo "<th><a class='invoice customer' target='_blank' href='/admin/users/{$invoices['invoice_recipient']}'>{$invoices['invoice_recipient']}</a></th>"; echo "<th><a class='invoice number' href='/admin/invoices/{$invoices['invoice_number']}'>{$invoices['invoice_number']}</a></th>"; echo "<th><a class='invoice total' href='/admin/invoices/{$invoices['invoice_number']}'>€ {$totalAmount}</a></th>"; echo '<tr>'; } ?> </tbody> </table> </div> </div> </div> </div> <?php } else { $userdata = getFullInvoiceData($_GET['id']); ?> <div class="container"> <div class="row"> <div class="twelve columns"> <div class="element" id="invoice--options"> <h5>Details factuur: <i><?php echo $_GET['id']; ?> </i></h5> <p>Een rij factuur opties</p> </div> <div class="element" id="invoice"> <?php echo showInvoice($_GET['id']); ?>
function showInvoice($id) { $invoiceData = getFullInvoiceData($id); ob_start(); include '../templates/invoice.php'; $contents = ob_get_contents(); ob_end_clean(); return $contents; }