How to Store the Credit Card Holder Name In Entries


Would you like to store the credit card holder’s name inside your WPForms entry? The card holder’s name isn’t always the same as the user completing the form and you may wish to retain this information. Using a small PHP snippet you can easily achieve this.


To use this code snippet, just copy it to your site.

 * Store cc name
 * @link

function wpf_dev_credit_card_save_cardholder( $value, $charge ) {

    $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 );

With the above snippet you can now see the card holder’s name, the last 4 of the card used and the type of card it was.

Now you can store the credit card holder name in the form entry

And that’s all you need to save the name in your entry. Would you like to add a unique ID number to each form entry? Take a look at our article on How to Create a Unique ID for Each Form Entry.

Filter Reference: wpforms_stripe_creditcard_value