[memb_keap_list_creditcards]
Description
Lists the cards the current member has on file with Keap: brand, last four digits, and expiration. Paste the shortcode bare and you get a designed table. Expired cards never appear; Keap drops them at sync time.
The list is read-only until you turn on removal: set delete="yes"
and each removable card row grows a Remove Card button. A card billed
by an active auto-charging subscription gets no button, because Keap
would reject the delete anyway. If Keap cannot be reached to check,
the buttons stay hidden until it can.
A removal asks the member to confirm with a browser dialog unless you
set confirm="no". On success the member lands on success_url with
a notice, the Torii tag in tag_id is applied, and the list reflects
the removal right away. A refusal or failure redirects to
failure_url with an error notice instead.
Cards refresh from Keap every two hours, so a card added in Keap can
take that long to appear here. When the list comes back empty,
empty_text shows in its place. If Keap cannot be reached, the
shortcode renders nothing rather than telling the member they have no
cards. Any content placed between the opening and closing tags is
ignored.
Design controls match
[memb_keap_list_subscriptions]:
the same layout and fields attributes, the same --torii-list-*
CSS tokens, and theme templates on the same contract with
template="name". Pair with
[memb_keap_add_creditcard]
to let members replace a card in the same breath as removing a stale
one.
Shortcode Examples
The default table, read-only:
[memb_keap_list_creditcards]
Let members remove stale cards themselves:
[memb_keap_list_creditcards delete="yes"]
Relabel the button and tag the member after a removal:
[memb_keap_list_creditcards delete="yes" delete_text="Delete" tag_id="27"]
Cards instead of a table:
[memb_keap_list_creditcards layout="cards"]
Show when each card was added:
[memb_keap_list_creditcards fields="card_type,last4,expires,added"]
Shortcode Parameters
confirm
Ask the member to confirm a removal with a browser dialog before the
form posts. Default: yes.
date_format
PHP date format applied to every date field. Default: M j, Y.
debug
Prepend the card count, the in-use count or a usage-check failure
note, any ignored fields keys with the valid alternatives, and the
active order_by when a value was not sortable. Super admins only.
Default: no.
delete
Show a Remove Card button on each removable row. Removal is opt-in:
leave it off and the list is display-only. Default: no.
delete_text
Label on the remove button. Default: Remove Card.
empty_text
Message shown in place of the list when the member has no cards on
file. Default: You have no cards on file..
fields
Comma-separated field keys that choose which columns appear and in
what order. Unknown keys are dropped, and an att where every key is
unknown falls back to the default set. See Fields below for the keys
and their types. Default: card_type,last4,expires.
layout
table, cards, rows, or plain. plain enqueues no CSS, so a
page builder container or your own stylesheet dresses the bare
structure. Default: table.
order_by
Field to sort on: added, card_type, created_time, id, or
last4. The expiration fields are display-derived and not sortable;
they and any unrecognized value fall back to created_time.
Default: created_time.
sort
Sort direction: asc or desc. Default: desc (newest first).
success_url
Redirect target after a successful removal. Default: the current page.
failure_url
Redirect target after a refused or failed removal. Default: the current page.
tag_id
Torii tag ID applied to the member after a successful removal.
Default: 0.
template
Render through a named template instead of the built-in skeleton.
See Customizing with Templates below. Default: ''.
Fields
The registry works the same way as the subscription list: the type decides how a value renders.
| Field | Type | Shows |
|---|---|---|
card_type |
text | Card brand, e.g. Visa |
last4 |
text | Last four digits of the card number |
expires |
date | Last day of the expiration month |
id |
text | Keap payment method ID |
expiration_month |
int | Expiration month as a number |
expiration_year |
int | Expiration year as a number |
added |
date | Date the card was added, in your site's time zone |
Date fields follow date_format. A card stays valid through the last
day of its expiration month, which is the date expires shows.
Customizing with CSS
The list shares the subscription list's stylesheet, tokens, and
markup contract. The wrapper carries torii-list--keap-creditcards,
rows carry data-card-id, and a card billed by an active
subscription carries data-card-in-use="1", so one attribute
selector styles or hides the in-use rows. The remove button carries
torii-list__action-button inside torii-list__action-form.
Re-theme it with the same --torii-list-* custom properties,
documented at
[memb_keap_list_subscriptions].
Customizing with Templates
Set template="my-cards" and Torii looks for
torii/shortcodes/keap/creditcards/my-cards.php in your theme (child
theme first), falling back to the shared skeletons in the plugin's
templates/shortcodes/list/ directory. Templates receive the same
$atts, $content, $code, and $data contract as the
subscription list, documented at
[memb_keap_list_subscriptions].
The general workflow is documented in Shortcode
Templates.
Shortcode Attributes
| Attribute | Value |
|---|---|
| Conditional | No |
| Nestable | No |
| Accepts formatting | No |