How to Enable Credit Card Field Without Stripe Addon

Overview

Do you need to accept credit cards but don’t have the WPForms Stripe Addon enabled? If you’re using a different 3rd party service but still need to accept credit cards, you can easily allow this with a custom code snippet. We can show you how to enable the Credit Card field without the Stripe addon using PHP.

The Credit Card field in WPForms will, by default, be hidden until the Stripe addon is installed and activated.

This is by design, as the Credit Card field will not store any details to your site’s database and is only able to send data to a third-party source (currently, Stripe is the only built-in option for this).

If you have built a custom integration, however, you may still need to use the Credit Card field.

Setup

To make the Credit Card field display in the form builder without the Stripe Addon, you can add the following filter to your site:

/**
 * Determines whether Credit Card field will be displayed in form builder.
 *
 * @link   https://wpforms.com/developers/how-to-enable-credit-card-field-without-stripe-addon/
 *
 * @param  array $enable_cc
 * @return bool
 */
function wpf_dev_field_credit_card_enable( $enable_cc ) {

	$enable_cc = true;
	
	return $enable_cc;
}

add_filter( 'wpforms_field_credit_card_enable', 'wpf_dev_field_credit_card_enable', 10, 1 );

Now when you go into the form builder, you’ll see a new option for Payment Fields.

Enable credit card field on your site without the Stripe Addon

And that’s all you need to enable the Credit Card form field without using the Stripe addon. Would you like to be able to change the CSV separator when exporting form entries? We’ll walk you through how to achieve this in our article on How to Change CSV Export Delimiter.

Filter Reference: wpforms_field_credit_card_enable