Description

Filter used to view data about the transaction from the payment processor with WPForms.

Parameters

$details
(array) Array of data available from the payment processor of the transaction.

Source

wpforms-stripe/src/Process.php

More Information

The wpforms_stripe_creditcard_value filter is used to view Name, Last 4 Digits of card and Brand of card used.

Example

/**
 * Filter of data available from the credit card transaction.
 *
 * @link   https://wpforms.com/developers/wpforms_stripe_creditcard_value
 *
 * @param  array $details  Array of data used inside the credit card transaction available from the payment processor.
 *
 * @return array
 */

function wpf_dev_credit_card_save_cardholder( $value, $charge ) {
    if (
        !empty( $charge->source->name ) &&
        !empty( $charge->source->last4) &&
        !empty( $charge->source->brand)
    ) {
 
        $value  = $charge->source->name . "\n"; // card holder name
        $value .= 'XXXXXXXXXXXX' . $charge->source->last4 . "\n"; // last 4 card numbers
        $value .= $charge->source->brand; // type of card (visa/AMEX etc)
    }
 
    return $value;
}
add_filter( 'wpforms_stripe_creditcard_value', 'wpf_dev_credit_card_save_cardholder', 10, 2 );

Snippet Reference: How to Store the Credit Card Holder Name In Entries