How to Send the Phone Number to


Would you like to send the phone number to By default, WPForms already gives you options to send through the customer’s name, email address, and address from the tab inside the Payment settings.

In this tutorial, we’re going to walk you through how to send the phone number with each transaction using a small PHP snippet.

Creating the form

To begin, we’ll create a new form and add our fields to this form. Once we’ve created the form, we’ll set the Payments tab to process transactions.

If you need any assistance with creating an form, please check out this useful documentation.

Mapping the fields

Next, we’ll map our Name, Email, and Address fields to send through this information with each form submission.

To do this, click on the Payments tab from inside the form builder then click Next, click the switch to Enable Authorize.Net payments.

Once you’ve enabled this option, you can map over the appropriate fields as well as provide the Payment Description and any conditional logic you may want to have.

For the purpose of this tutorial, we will not be using the Enable Conditional Logic feature so this will remain disabled.

you can map the name, email, and address to from the WPForms form builder

Adding the snippet

Now it’s time to add the snippet to our site. If you need any assistance with how and where to add custom snippets, please check out this tutorial.

 * Include a phone number with Authorize.Net args.
 * @link
function wpf_dev_authorize_net_process_payment_single_add_phone_to_args( $args, $process ) {
    // Replace 26 in $process->fields[26] to an id of your phone field.
    if ( isset( $process->fields[26][ 'value' ] ) ) {
        $args[ 'phone' ] = $process->fields[26][ 'value' ];
    return $args;
add_filter( 'wpforms_authorize_net_process_payment_single_args', 'wpf_dev_authorize_net_process_payment_single_add_phone_to_args', 10, 2 );
 * Set the phone number on customer billing information.
 * @link
function wpf_dev_authorize_net_process_transaction_add_phone_to_transaction( $transaction, $args ) {
   $bill_to = $transaction->getBillTo();
   if ( is_null( $bill_to ) ) {
      $bill_to = new netauthorizeapicontractv1CustomerAddressType();
   $phone = $args[ 'phone' ];
   $bill_to->setPhoneNumber( $phone );
   $transaction->setBillTo( $bill_to );
   return $transaction;
add_filter( 'wpforms_authorize_net_process_transaction', 'wpf_dev_authorize_net_process_transaction_add_phone_to_transaction', 10, 2 );

This snippet will look for the field ID that is set for the phone number, in this case, our field ID for our Phone field is 26. It will then store that number and process this through in the next function to setPhoneNumber in the billing information of the transaction.

the phone field ID number is 26, you will need to update this ID number in the snippet to match your own ID

You’ll need to update the field ID to match your own ID for the Phone field. If you need help finding your ID number, please check out this tutorial.

And now when the transactions are processed, you’ll easily be able to see that the phone number is now part of the information for the customer’s billing information.

the phone number has now been passed with the transaction and is stored inside the customer billing information

Would you like to also send through an invoice number to Be sure to check out our tutorial on How to Send an Invoice Number Through to Payments.

Filter References:


Q: Why isn’t this snippet isn’t working for me?

A: If you’re not seeing the phone number on your transactions, please make sure you’ve updated the ID inside fields[26][ 'value' ].