floatval($invoice['invoice_amount']))) { $stripe_customer = mysqli_fetch_row(mysqli_query($mysqli, "SELECT payment_provider_client FROM client_payment_provider WHERE client_id = $client_id AND payment_provider_id = " . intval($stripe['payment_provider_id']) . " LIMIT 1")); $pay_url = ($stripe_customer ? 'guest_pay_invoice_stripe.php' : 'guest_pay_setup_stripe_customer.php') . "?invoice_id=$invoice_id&url_key=$query_key"; } // The card fee on paying by card, when the client pays one (functions/billing_pay.php) $card_fee = $pay_url ? billingCardFeeCents(intval(round($state['balance'] * 100)), billingCardFeeFor($client_id)) / 100 : 0; // Paid by its recurring invoice's autopay on the due date - said, so it isn't paid twice, while that will go through $autopay = $state['state'] === 'open' ? invoiceAutopay($invoice) : null; if ($autopay && $autopay['problem'] !== '') { $autopay = null; } $paper = [ 'type' => 'invoice', 'row' => $invoice, 'items' => $items, 'totals' => $totals, 'paid' => $state['paid'], 'balance' => $state['balance'], 'logo_url' => $company['logo_url'], ]; ?>