How to Pass a Calculation to a Payment Field

May 4, 2023

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

Youtube Embed Poster: Mz7TFYYjoFs

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

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

Setting up the Form Calculation Widget

If you have multiple calculation widgets in your 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 want it displayed in your form. This trick is needed since you can only pass one calculation widget to the payment field.

It would look like this:

jotform-form-calculation-widget

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, just 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 Stripe gateway:
How to Pass a Calculation to a Payment Field Image-1
  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 your 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.
How to Pass a Calculation to a Payment Field Image-2
  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:

How to Pass a Calculation to a Payment Field Image-3

Here are demo forms you can check:

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: https://www.jotform.com/answers/

Contact Jotform Support: https://www.jotform.com/contact/

Send Comment:

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

Comments:

  • Peter Keen - Profile picture
  • Emily Naden - Profile picture