. */ require_once(__DIR__ . '/../index.php'); require('./header.php'); ?>

Pay

payment_key) { echo "
The invoice could not be found.
"; } elseif (!$_offer->getPaymentEligibility()) { echo "
This invoice is not eligible for online payment.
"; } elseif ($_offer->getPayment() != null) { echo "
This invoice has already been paid.
"; } elseif (isset($_POST['payment_method_nonce'])) { $nonce = $_POST['payment_method_nonce']; $trans = Braintree_Transaction::sale([ 'amount' => (string) $_offer->calculate(Calculatable::TOTAL), 'paymentMethodNonce' => $nonce, 'options' => [ 'submitForSettlement' => true ] ]); if (!$trans->success) { echo '
'; echo "

Your transaction could not be completed: {$trans->message}

"; foreach ($trans->errors->deepAll() as $error) { echo "{$error->attribute}: {$error->code} {$error->message}
"; } echo 'Please try again, or contact us.'; echo '
'; } else { try { $payment = $_offer->createPayment(); $payment->braintree_id = $trans->transaction->id; $payment->send(); echo '
Thank you for your payment. A confirmation has been sent to '.$_offer->getContact()->email.'.
'; } catch (Exception $e) { echo '
Your payment has been received, but could not be stored in our database. Please contact us.
'; } } } else { $subtotal = Constants::invoice_valuta . $_offer->calculate(Calculatable::SUBTOTAL); $total = Constants::invoice_valuta . $_offer->calculate(Calculatable::TOTAL); ?>
Welcome to the checkout environment. Please review the invoice carefully.
getItems() as $item) { $i++; echo ''; echo ""; echo ""; echo ""; echo ""; echo ''; } ?>
Description Price excl. VAT Price incl.
{$item->title}
{$item->getHTMLDescription()}
".Constants::invoice_valuta."{$item->calculate(Calculatable::SUBTOTAL)}{$item->VAT_percentage}%".Constants::invoice_valuta."{$item->calculate(Calculatable::TOTAL)}
Totals
A confirmation will be sent to getContact()->email?>.