Product Icon

PayPal Payments for WooCommerce

PayPal’s brand recognition helps give customers the confidence to buy. PayPal’s all-in-one checkout solution allows you to offer PayPal, Venmo (US), Pay Later, credit and debit cards, country-specific payment options and more.

Allow saving last four digits of credit card

When a customer pays with a credit card, it should save the card type and last four digits of the credit card so that it can be displayed where needed.

My workaround is to add the following snippet in OrderProcessor.php before the end of the process(WC_Order $wc_order) function:

$card_brand = ”;
$last_digits = ”;
if (!is_null($order->payment_source()) && !is_null($order->payment_source()->card()))
{
$card_brand = $order->payment_source()->card()->brand();
$last_digits = $order->payment_source()->card()->last_digits();
}

if (!empty($card_brand) && !empty($last_digits)) {
$wc_order->update_meta_data( ‘payment_cc_info’, $card_brand . ” *” . $last_digits);
$wc_order->save();
}

I then get the payment_cc_info meta data where needed.
This is obviously not the best way to handle it and requires a modification every time the plugin updates so an official way to handle this would be appreciated.

Author

bkabsedev

Current Status

Open

Last updated: January 3, 2024

0 comments

Log in to comment on this feature request.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.