# How do I add more complex PayPal functionality?

**Jason Williams**Good Evening,

I'm reaching out on behalf of my client and the form in question is this form: https://form.jotform.com/40548376476162

When someone signs up using the form the price of each class which can be checked off needs to change. Meaning that if a student takes one class is costs them $150, if a student takes a second class the price is $130, if they take any additional they cost $100 each. Is functionality like this possible?

This holds true for all of the classes on the form except the ones that start with "AP" those cost $150 each regardless.

We would like to add this functionality soon and also tie in a PayPal account to make this all work. Your help is greatly appreciated!

Best,

Jason Williams

- JotForm Support
**Chriistian**It is possible to see how many items are selected by adding calculation values to your checkbox field so that when a certain amount of items are checked, you can setup a condition to change the custom price in paypal.

1. Add calculation values to your check-box fields so we can count how many items are selected.

Click the gear icon of the check-box field then add calculation values of2. Add form calculation widget that will count the total items selected in the checkbox.

3. Then add calculation values to the AP courses, but now use 150.

4. Add another calculation field for the AP checkbox.

5. Then we add several fields that are required to calculate the final price.

6. Setup the conditions for the Total field. Here's a guide that can help: Smart Forms Using Conditional Logic

Condition for only one item checked.

Condition for 2 items checked.

Condition for greater than 2 items checked.

7. For the final price, you can add the Total for the courses with changed prices and the AP Total.

8. Then finally, pass the calculation value to the payment field. Here's a guide that can help: How to pass a calculation to a payment field

Here's how the form would appear after.

Here's a link to the demo so you can see it in action: https://form.jotform.com/60621380556958

If you want, you can clone it to your account by following this guide: How To Clone A Form

You can hide the calculation fields if you want to make the form appear clearer.

**jay11284**Thank you very much for this thorough explanation!

I have set it up and it's working fine for the Science section but I can't get it to work for another subjects (Math & Social Studies) in a different set of check boxes. Please view my form here: https://form.jotform.com/60646556200148

There's something else I have to set up so the different check box sections are all linked so if a student selects one science course and one math course they still add up to 260 and not 300. Currently the Math and Social Studies sections don't seem to be linked to calculate anything even though I duplicated the Science field.

Can you please point me in the right direction on how do this?

Thanks in advance for your continued assistance!

Best,

Jason Williams

- JotForm Support
**jonathan**Hi Jason,

I checked your jotform https://form.jotform.com/60646556200148 and I was able to identify the difference compared to the demo form of my colleague.

You have not added the calculation data to the 2 Calculation fields (Total and AP) from the Math and Social Studies courses/subjects.

If you include them, they should be like this:

Here is my updated version of the form https://form.jotform.com/60652528357965

It work like this:

Let us know how if you need further assisstance.

**amtyanks**Thank you for the explanation and for your work on this too!

I'm noticing that some of the numbers I used in the Conditions for "Total" aren't correct and I'd like to change them and I'm having some trouble.The first non-AP class should cost $150 (this is correct) the second should add $125 (this also works) but anything more than 3 courses selected should cost an additional $100.

Currently the condition looks like the below image but it doesn't seem to add correctly: https://form.jotform.com/60664031435146

Best,

Jason

- JotForm Support
**david**Replace your calculation in that condition with the following:

275+((calculation -2)*100)

That should give the desired result:

275 being what the first and second would cost, calculation minus 2 times 100 because the cost of the first two are included and the rest are multiplied by 100.

Here is the resulting form with the condition updated: