Sending an Invoice Number Through to Authorize.Net Payments

Would you like to include the invoice number from WPForms for any completed Authorize.Net payment? Authorize.Net will accept certain metadata that they have already mapped to their payment API.

In this tutorial, we’ll show you how to send a payment invoice number as metadata for the Authorize.Net payments.

Creating your Authorize.Net Form

To start, create a new payment form or edit an existing one to access the form builder. In the form builder, make sure to add the Authorize.Net field.

create the form first to send the invoice through to Authorize.net

Then proceed to configure your form and payment settings. For more details, please see our tutorial on setting up and using the Authorize.Net addon.

Adding the Snippet to Send an Invoice Number

Once your form is set up to accept these payments, the next step is to add the custom snippet below to your site. If you need additional help, check our guide to learn how to add custom code snippets to WordPress sites.

In our example below, we added a Hidden Field (fields[20]) form field that contains the Smart Tag {unique_value} to generate an invoice number when the form is submitted.

In the first part of the snippet above, we’re grabbing the invoice number stored in the Hidden field. This step is essential to inform the API of what field we want to pass through as the invoice number. Please remember to update this field ID to match the field ID of your form.

The second part of the code is where we send an API request to Authorize.Net and set the invoice number to the value generated in the Hidden field.

Now, when Authorize.Net payments are sent through WPForms, they will include the invoice number generated in WPForms.

Now you can pass invoice through to Authorize.net

Frequently Asked Questions

Below, we’ve answered some of the top questions we see about generating and sending an invoice number for Authorize.Net payments.

What if I don’t have an invoice number?

A: In our above example, we’re using a built-in Smart Tag for the {unique_value} to create an alpha-numeric random number. If you prefer that the unique value be numeric only or a controlled count, just follow this tutorial.

That’s it! You’ve now learned how to generate an invoice and send the unique invoice number to Authorize.Net.

Would you also like to learn how to send the address to Authorize.Net? Check out our tutorial on sending an address through for completed Authorize.Net payments.

Filter References: