How to Create a WordPress Payment Form with Calculations

You CAN accept payments from your WordPress website without spending a fortune or working for days to make it happen.

Want to offer multiple products or service options from your WordPress website? Accept payment for an event or charge a registration fee that will vary depending on the selections your users make? It can be tough to find the features you need at a reasonable price point.

Looked at or using a dedicated ecommerce solution? Integrations like WooCommerce and Shopify are great for big online stores. They’re also very expensive and complex. The time investment to learn and maintain them is high.

Most WordPress form builders offer payment integrations. Unfortunately payment options are usually gated behind expensive packages. Finding the features you need for selling a mix of products or service features can be rough, too.

You shouldn’t have to risk spending more than you might make in a month on a way to take payments. You don’t have to. Here’s how.

These 4 steps will give you a WordPress payment form that can handle almost any transaction.

Using Ninja Forms calculations, you can take values from anywhere on your form, total it all out behind the scenes, display an amount for your customers, and send that amount through to your payment gateway of choice.There are even WordPress payment form templates to help you get started!

1. Add fields for your products, options, or features

The following fields can be used in Ninja Forms calculations (which we’ll set up in step 3 below):

  • Single Checkbox: let customers select a single item
  • Checkbox List: let customers select one or more items
  • Select List: let customers select a single item from a dropdown
  • Multi-Select: let customers select one or more items from a dropdown
  • Radio List: let customers select a single item from a list
  • Select Image: let customers select one or more items with an image
  • Number: let customers enter a value

Just choose the field(s) you need. The list fields are perfect for offering different products, features, options, etc for the customer to select. The Number field is perfect for letting the customer choose quantities if that’s something you need.

2. Add the price for each product, option, or feature

Make sure you have Developer Mode enabled. It’s not as scary as it sounds- no code required! 🙂

Each of the fields in step 1 have a Calc Value setting. That’s where your price goes. Just plug it in. Decimals are supported. It’s literally that easy.

select image field featuring grumpy cat, smudge cat, and pizza cat with the calc value setting highlighted to the right of each list option

3. Create a Ninja Forms calculation that totals the combined prices

You’ll find the Calculations feature under the Advanced Tab. Create a new one by clicking Add New. Give it a name (Variable Name). Decimals are set to 2 by default.

Add your fields by clicking the sandwich icon in the upper right of the Equation box. Just choose your fields from the list that opens and that will place the merge tag of the field into the calculation’s equation. You can add (+), subtract (-), multiply (*), and divide (/) field values this way. Exponents (^), parentheses, and Order of Operations are respected, too.

ninja forms calculations getting the total of three fields via additoion and multiplication of field values using those field's merge tag

4. Display your total and send it to Stripe or PayPal on form submission

You can display the total for customers using the HTML field. Just place the calculation’s merge tag into the HTML field’s text editor. Put whatever text or symbols you want before or after for example:

Total: $ {calc:total}

With the Stripe or PayPal Express add-on, you can send this total off for payment. You can also connect with Elavon or Recurly (perfect for recurring subscriptions). Just choose the Collect Payment action and set Get Total From > Calculation, then select your calculation!

get total from setting in collect payment action

Follow the steps above to have a working payment form in not much more time than it’s taken to read this article.

You can use the Ninja Forms calculations feature to build payment forms like a pro, without being one. And without spending a small fortune. Following the four simple steps above, you can accept payments in WordPress that are as simple or complex as needed. Not a single line of code required. What are you waiting on? Grab Stripe or PayPal and start making money!

Comments are below. What kind of WordPress payment form do you need help building?

Editor’s note: this article has been updated from an older version on 29 Jan 2020. Everything described above is 100% current, but responses to comments below from before that date may not be. Please feel free to reach out to support anytime with questions, too!