How to Pass a Calculation to a Payment Field

June 24, 2022

Whether you have a simple or complex calculation using the Form Calculation Widget on your form, you can now pass the calculated total to your payment field.

What will you need to make this happen? Two important things:

  • Form Calculation Widget – you must have the form calculation widget added and set up in the form.
  • Payment Element – you also need to have one of our payment integrations in the form.

Setting up the Form Calculation Widget

If you have multiple calculation widgets in the form and wish to get their total, we highly recommend adding one more calculation widget and summing all other calculation widgets there. You can hide this new calculation widget if you don’t wish it displayed in the form. This trick is needed since you can only pass one calculation widget to the payment field.

It would be something like the following:


Related User Guides:

Passing the Form Calculation to the Payment Field

Now, assuming you already performed the calculation in a Form Calculation widget, which represents the total to be paid by your users, follow the below steps to add and set up your payment field to fetch the value from the calculation.

  1. If you haven’t added the payment field yet, do the following:
    • Click the Add Form Element button in the Form Builder.
    • Go to the Payments tab.
    • Please search for your preferred payment gateway, and click it. You can also drag/drop it to add. Here’s an example of the Stipe gateway:
  1. The Payment Settings would generally open once you add the payment gateway. Otherwise, click the Wand icon in the payment gateway to open it.
  2. Connect your account to your chosen payment gateway or provide the credentials when asked.
  3. Next, set up the following:
    • Payment Type – you must select the User Defined Amount option from the list.
    • Payment Box Sub Label – you have to enter a short description of what the payment is for.
    • Get Price From – this is where you must select the Form Calculation widget.
  1. Lastly, please don’t forget to click the Save button to save your changes.

If you currently set up your form to Sell Products or Subscriptions, switching the Payment Type to User Defined Amount from the Payment Settings will permanently remove your product or subscription items, so please be wary of that. Here’s the prompt you’ll get when you switch from Sell Products/Subscriptions to User Defined Amount:

Here are demo forms you can check:

Was this guide helpful?
Contact Support:

Our customer support team is available 24/7 and our average response time is between one to two hours.
Our team can be contacted via:

Support Forum:

Contact Jotform Support:

Send Comment:

Jotform Avatar
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.