Saved cards expiring: each night cards expiring next month or lately are read back from Stripe so a card the bank replaced keeps its new expiry, and for each card on autopay for an active recurring invoice the client's primary and billing contacts are emailed a month before the month it expires and again in it (once just after, within 60 days, for one that ran out unannounced) with an Add your new card link that needs no sign-in and puts the new card in place of the old on every recurring invoice it paid, the team gets a Card Expiring notification each time and an Autopay Failed notification with Stripe's reason when an autopay charge doesn't go through, the portal no longer turns away a card Stripe has renewed, Settings > Invoices > Paid online can turn the client emails off and Saved Cards shows when each card was checked and when the team was told (DB 4.3.8, functions/card_expiry.php, guest/guest_card_update.php); 26.12.4 changelog

This commit is contained in:
johnnyq
2026-12-01 21:22:51 -05:00
parent 19c09b670c
commit 8b2426c841
16 changed files with 828 additions and 10 deletions

View File

@@ -7,7 +7,10 @@
* with it and when each next does, and when it was saved. The tabs pick out
* the cards on autopay and the ones that have run out - an expired card on
* autopay is flagged, as its next autopay will be declined. Filtered by
* provider (the Payment Providers list links here so) and by client. Remove
* provider (the Payment Providers list links here so) and by client. A card
* running out on autopay says when the team was told (and its client emailed,
* as cardExpiryNightly() could), and when it was last read back from Stripe
* (functions/card_expiry.php). Remove
* takes a card off at the provider and in ITFlow, its autopay with it
* (paymentCardRemove(), functions/payment_provider.php,
* admin/post/saved_payment_method.php).
@@ -55,6 +58,7 @@ $from = "FROM client_saved_payment_methods
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS saved_payment_id, saved_payment_client_id, saved_payment_provider_id, saved_payment_provider_method, saved_payment_description,
saved_payment_created_at, payment_provider_name, payment_provider_active, client_name, client_archived_at, payment_provider_client,
" . (cardExpiryReady() ? 'saved_payment_checked_at, saved_payment_reminded_expiry, saved_payment_reminded,' : '') . "
$expiry_sql AS expires, $autopay_sql AS autopay
$from
WHERE $filters AND $show_where
@@ -194,6 +198,12 @@ $page_title = 'Saved Cards';
<?php } elseif ($expiring) { ?>
<span class="badge rounded-pill bg-warning-subtle text-warning-emphasis border border-warning-subtle ms-1">Soon</span>
<?php } ?>
<?php if ($expires && intval($row['saved_payment_reminded_expiry'] ?? 0) === $expires && intval($row['saved_payment_reminded'] ?? 0) > 0) { ?>
<div class="text-body-secondary" data-card-reminded="<?= intval($row['saved_payment_reminded']) ?>" title="Your team was told it is running out - and its client emailed a link to add their new card, unless they are left out of reminders, emailing clients about it is off, or it ran out long ago. The recurring invoice's history says which."><i class="fas fa-fw fa-bell me-1"></i>Notified <?= intval($row['saved_payment_reminded']) > 1 ? 'in its month' : 'a month before' ?></div>
<?php } ?>
<?php if (!empty($row['saved_payment_checked_at'])) { ?>
<div class="text-body-secondary" title="Read back from Stripe <?= escapeHtml(date('M j, Y g:i A', strtotime($row['saved_payment_checked_at']))) ?> - a card the bank replaced shows its new expiry"><i class="fas fa-fw fa-sync-alt me-1"></i>Checked <?= escapeHtml(timeAgo($row['saved_payment_checked_at'])) ?></div>
<?php } ?>
<?php } ?>
</td>
<td class="d-none d-lg-table-cell small" data-card-autopay="<?= count($uses) ?>">