How to calculate a total amount using the Driving Distance widget and Stripe Integration?

  • Profile Image
    TBSE
    Asked on January 04, 2017 at 02:42 PM

    Hello,

    On my website - www.tbsportsentertainment.com/ride, you will see a Jotform which has a "Schedule Your Ride" section. This is the Driving Distance widget.

    My developer and I wanted some tips on integrating that widget within JotForm to STRIPE payments, based on location miles.

    What I want to do is to auto-populate a STRIPE button with a payment amount, based on the number of miles it takes to travel from distance A to B (Distances and locations entered into the Driving Distance widget by the user).

    For instance, we will use $2 / mile.

    When a user enters two destinations within the Driving Distance widget, the miles for that distance come out to be 10 miles (Or $20 per the calculations).

    What would you recommend as to how my developer can integrate Stripe for payment and include the Driving Distance widget, based on the use location selections and the miles presented?

     

    Thanks for your help and I will forward the information to my developer.

     

    George

  • Profile Image
    Kevin_G
    Answered on January 04, 2017 at 04:51 PM

    This is possible to do since the driving distance widget will return the distance as a value that can be used in calculations, you could get it and then process it as you need. To get more info about calculations, please check this guide: How-to-Perform-Form-Calculation-Using-a-Widget

    Once you have the calculation you will need to change the current payment type you're using in Stripe and switch to collect custom amounts, the custom amount will then be captured from the calculation widget that you will add. Here's  also a guide about how to pass a calculated value to the payment field: How-to-Pass-a-Calculation-to-a-Payment-Field

    If you still would need to have the current options you have in your payment section "Prime ($21.99 for each month.) and Platinum ($34.99 for each month.)" then you could add them with a drop down and assign calculations values to each option that will be the equivalent to the price. 

    This guide will help you to add a calculation value to options in a field: How-to-Assign-Calculation-Value

    If you have any question, please let us know.