How to Send the Email Address to Square with WPFoms


Would you like to send the email address to Square when your form is completed? When using the Square addon, you can easily map over the Name, Email and Address fields to Square. They will be stored but they aren’t visible from inside the transaction.

default transaction view of Square single payment

In order to include any of the form field data viewable the transaction detail page, we’ll need to add a small PHP snippet. In this tutorial, we’re going to show you how!

Creating your form

First, you’ll need to create your new form, set up your fields, and add the Square credit card form field.

If you need any help in creating your form that will accept Square payments, please review this documentation.

Enabling the Square payments

Once you’ve set up your fields and added the Square form field, you’ll need to click on the Payments tab and then Square to enable the Square processing of the payments.

enable square on your form

Adding the field ID to the payment description

Next, we’re going to add the field ID for the Email Address to the payment description that Square displays on the transaction detail.

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

You can add any field from your form here if you’d rather have the name instead of the email address. You just need to change the number of the field ID. If you need help in finding your field ID, please check out this tutorial. You can also use any WPForms Smart Tag, for a complete list of built-in Smart Tags, please read through this documentation.

Adding the snippet

Now by default, that poyment description won’t be able to process Smart Tags so we’ll need to add a snippet that will allow this.

Copy and paste this snippet to your site.

If you need help in how to add snippets to your site, please see this tutorial.

 * Allow the payment transaction note to accept the WPForms Smart Tags.
 * @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 );

Please remember that Square’s API has limitations on the number of characters you can send through. For example, the note will only accept up to 500 characters.

In the snippet above, we’re going to take the note field that is displayed on the transaction detail and allow this field to process the WPForms Smart Tags.

And that’s it! Would you like to learn how to create custom Smart Tags? Check out our tutorial on How to Create a Custom Smart Tag.