Payment Providers - the services clients pay invoices by card * through (functions/payment_provider.php). Each row says whether it is on, * live or test (as its keys say), the account its payments go into, its card * limit, whether its fees are recorded as expenses (and what they came to, * and how many are still to record) and the card fee clients pay, its saved * cards and the autopay on them, and its card payments in the last 30 days. * Check connection asks the provider whose account the key is; Record fees * now does what the Payment Provider Fees job does every few minutes. Add * and Edit are one window (modals/payment_provider/payment_provider_edit.php); * the rest are admin/post/payment_provider.php. */ // Default Column Sortby Filter $sort = "payment_provider_name"; $order = "ASC"; require_once "includes/inc_all_admin.php"; // Only these sort - an unknown column would take the page down $sortable_columns = [ 'payment_provider_name' => "payment_provider_name $order", 'account_name' => "account_name $order, payment_provider_name ASC", 'payment_provider_threshold' => "payment_provider_threshold $order, payment_provider_name ASC", 'saved_cards' => "saved_cards $order, payment_provider_name ASC", 'last_paid' => "last_paid IS NULL, last_paid $order, payment_provider_name ASC", ]; if (!isset($sortable_columns[$sort])) { $sort = 'payment_provider_name'; } $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS payment_provider_id, payment_provider_name, payment_provider_description, payment_provider_private_key, payment_provider_threshold, payment_provider_active, payment_provider_account, payment_provider_expense_vendor, payment_provider_expense_category, payment_provider_card_fee, payment_provider_card_fee_percent, payment_provider_card_fee_fixed, account_name, account_archived_at, vendor_name, category_name, COALESCE(cards.saved_cards, 0) AS saved_cards, COALESCE(cards.autopay, 0) AS autopay, (SELECT MAX(payment_date) FROM payments WHERE payment_archived_at IS NULL AND payment_reference LIKE CONCAT(payment_provider_name, ' - %')) AS last_paid FROM payment_providers LEFT JOIN accounts ON account_id = payment_provider_account LEFT JOIN vendors ON vendor_id = payment_provider_expense_vendor AND payment_provider_expense_vendor > 0 LEFT JOIN categories ON category_id = payment_provider_expense_category AND payment_provider_expense_category > 0 LEFT JOIN ( SELECT saved_payment_provider_id, COUNT(DISTINCT saved_payment_id) AS saved_cards, COUNT(recurring_payment_id) AS autopay FROM client_saved_payment_methods LEFT JOIN recurring_payments ON recurring_payment_saved_payment_id = saved_payment_id GROUP BY saved_payment_provider_id ) cards ON cards.saved_payment_provider_id = payment_provider_id WHERE (payment_provider_name LIKE '%$q%' OR payment_provider_description LIKE '%$q%' OR account_name LIKE '%$q%' OR vendor_name LIKE '%$q%' OR category_name LIKE '%$q%') ORDER BY {$sortable_columns[$sort]}, payment_provider_id ASC LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); // Add only while there is a provider ITFlow takes payments through that isn't set up $set_up = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(DISTINCT payment_provider_name) FROM payment_providers WHERE payment_provider_name IN ('" . implode("', '", array_map('escapeSql', array_keys(paymentProviderKinds()))) . "')"))[0]); $can_add = $set_up < count(paymentProviderKinds()); $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; $add_url = 'modals/payment_provider/payment_provider_add.php'; $csrf = $_SESSION['csrf_token']; ?>

Payment Providers

Saved Cards
"> 0 && intval($row['payment_provider_expense_category']) > 0; $ties = paymentProviderTiesText(paymentProviderTies($provider_id)); $activity = paymentProviderActivity($row); ?>
Fees
Off Test Live
No account - pick one in Edit
Archived - pick another in Edit
Recorded
to record Not recorded
Clients pay
card None yet
in 30 days
>
'payment providers', 'icon' => 'fa-credit-card', 'text' => 'Set up Stripe and clients can pay their invoices by card, save a card, and pay recurring invoices by autopay.', 'actions' => $can_add ? [['label' => 'Add Provider', 'modal' => $add_url]] : [], ]; ?>