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 '
';
							} 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 '
';
								}
							}
						} 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.
							
								
									| Description | Price excl. | VAT | Price incl. | 
								getItems() as $item) {
									$i++;
									echo '';
									echo "| {$item->title} ";
									echo "{$item->getHTMLDescription()} | ".Constants::invoice_valuta."{$item->calculate(Calculatable::SUBTOTAL)}";
									echo " | {$item->VAT_percentage}%";
									echo " | ".Constants::invoice_valuta."{$item->calculate(Calculatable::TOTAL)}";
									echo ' | 
';
								}
								?>
								
									| Totals | =$subtotal?> |  | =$total?> |