How to Send the Email Address to Square with WPFoms


Do you want to automatically transmit the email address to Square upon form submission? When utilizing the Square addon, you can seamlessly map the Name, Email, and Address fields to Square. These details are securely stored within Square’s system but aren’t displayed within the transaction view.

default transaction view of Square single payment

To display any form field data on the transaction detail page, you’ll need to implement a brief PHP snippet. This tutorial will guide you through the process step by step.

Creating your form

To begin, you’ll want to create a new form, configure your fields, and ensure that you’ve included the Square credit card form field.

If you require assistance in setting up a form that accepts Square payments, please refer to this documentation for detailed instructions.

begin by creating your form and adding your fields

Enabling the Square payments

After configuring your fields and incorporating the Square form field, proceed to the Payments tab. Then, select Square to activate Square as the payment processing method.

enable square on your form

Adding the field ID to the payment description

Next, we’ll embed the field ID corresponding to the Email Address into the payment description that Square presents on the transaction details page.

add the smart tag for the field id for the email address to the payment description

For our specific form, the Email Address is field ID is 2. Consequently, in the Payment Description, we’ve modified this field to read as Payment from {field_id=”2″}. Should you prefer to display a different field from your form, such as the name instead of the email address, simply adjust the field ID number accordingly.

If you require assistance in locating your field ID, please refer to this tutorial. Additionally, you have the flexibility to utilize any WPForms Smart Tag. For a comprehensive list of built-in Smart Tags, consult this documentation.

Adding the snippet

As a default setting, the payment description doesn’t support Smart Tags. To enable this functionality, you’ll need to incorporate a code snippet. Simply copy and paste the following snippet into your website.

If you require guidance on how to add code snippets to your site, please consult this tutorial for step-by-step instructions.

 * Send the email address to Square
 * @link

function wpf_dev_process_smart_tags_in_payment_description( $args, $process ) {
	if ( isset( $args[ 'note' ] ) ) {
		$note = apply_filters( 'wpforms_process_smart_tags', $args[ 'note' ], $process->form_data, $process->fields, 0 );

		// The maximum length for the Square notes field is 500 characters.
		$args[ 'note' ] = wp_html_excerpt( $note, 500 );

	return $args;
add_filter( 'wpforms_square_process_get_payment_args_single', 'wpf_dev_process_smart_tags_in_payment_description', 10, 2 );

Keep in mind that Square’s API imposes restrictions on the maximum number of characters you can transmit. For instance, the note field will only accommodate a maximum of 500 characters.

In the provided code snippet, we’ve enabled the note field displayed on the transaction detail page to process WPForms Smart Tags.

And that’s it! Following this tutorial, you can easily send the email address to Square inside the payment description. Would you like to learn how to create custom Smart Tags? Check out our tutorial on How to Create a Custom Smart Tag.