User Guide

 

How to Pass a Form's Calculated Value to Another Form's Payment Total Field

How to Pass a Form's Calculated Value to Another Form's Payment Total Field

In case you're not aware, you can pass a calculated value to a payment field's total box. It's discussed on this other guide: How to Pass a Calculation to a Payment Field. However, what if you want to pass the calculated value from one form to another form that has a payment integration? In this tutorial, you'll learn how to pass a calculated value to the second form particularly on the Paypal payment field (donation or custom payment). Basically, this is a basic prepopulating method using URL parameters, which is similar to this guide: How to Automatically Pass Form Data to Another Form.

To start, you must have 2 different forms - Form 1 does the calculation and Form 2 is where the payment field will be populated. 

NOTE: You can only pass a calculated value to a payment field if its PAYMENT TYPE is set to either COLLECT DONATIONS or USER DEFINED AMOUNT.

Example:

Form 1 (Calculation) - https://www.jotform.com/41004751066950

Form 2 (Paypal form) - https://www.jotform.com/41004537068954

To pass the calculated value to the PayPal field on the second form, follow these steps.

STEP 1: Create the THANK YOU PAGE URL using the second form's URL since Form 2 will serve as the thank you page of Form 1.

So, whenever the user submits the first form, they will be redirected to the second form with the payment field prepopulated.

Example:

https://www.jotform.com/41004537068954?myProducts3[price]=

Where:

🔘 https://www.jotform.com/41004537068954 is Form 2's URL.

🔘 myProducts3[price] is the unique field name of the PayPal payment field on Form 2.

🔘 ? and = are constants. Without these, prepopulation won't work so make sure to use the same format.

Here's how to get the unique field name using the browser's (Chrome's) INSPECT ELEMENT feature. The field name is on the name attribute, right after the underscore.

1.1. First, view your form and right click on the PAYMENT FIELD.

1.2. Select INSPECT ELEMENT.

1.3. It should open the browser's console and show you the field name.

In this case, it is q3_myProducts3[price] but we will only get the field name after the underscore, which is myProducts3[price].

STEP 2: Edit Form 1 in the form builder, get the unique field name of the field where the calculated value will come from and then append this tag to the THANK YOU PAGE URL constructed in the STEP 1.

Example:

https://www.jotform.com/41004537068954?myProducts3[price]={total}

Where:

{total} is the unique field name of the calculation.

2.1. Select the field and click the GEAR icon. Go to the ADVANCED tab and expand the FIELD DETAILS section.

2.2. Take note and copy the field's UNIQUE NAME, which is {total}.

STEP 3: Set the constructed THANK YOU PAGE URL as Form 1's custom thank you URL.

3.1. Click SETTINGS at the top then THANK YOU PAGE on the left.

3.2. Choose REDIRECT TO EXTERNAL LINK. Paste the completed URL with parameters to fill out the second form.

https://www.jotform.com/41004537068954?myProducts3[price]={total}

Your changes will automatically be saved and you're done. Go test your form!

Demo (submit this form to see how it works): https://www.jotform.com/41004751066950

Send Comment

6 Comments...

  • rockblinka

    Hi, I don't get about how to do the link or set it, can you please explain it better because I don't know from where comes {total} or hot you set in the URL. Please help! :)

  • rhenry

    I am trying to pass the total camp fee on a registration form into a Paypal payment form with this URL in the thank you field of the registration form https://form.jotform.us/70874394087165?paymentthrough={totalcampfees}. The payment form opens correctly, but the field does not automatically fill. "payment through" is the field name for the payment form blank and "totalcampfees" is the field name on the registration form. What have I done wrong?

  • Troy Beglinger

    Hello,
    It seems that when you get to the second page of the demo, you can still change the amount due, without doing anything more than clicking on the amount field and typing in a new amount. I changed a $20 total to a $1 total, that way, and it was willing to accept it as correct.

  • easyshine

    hi i need a booking form thats shows the price once they choose the dates im finding it very hard to do

  • marknolha

    The field name of the PayPal amount is not accessible - there is a javascript of some sort in the way of the HTML and therefore field name. Help!

  • milbra

    Will this result in a PayPal Order Summary showing each form's purchase?

    Like the ones shown in the User Guide - http://www.jotform.com/help/183-Difference-Between-PayPal-PayPal-Pro?