Jotform to PayU integration help

  • Profile Image
    batourguide
    Asked on November 11, 2017 at 02:44 PM

    I need to change the payment Gateway from PayPal to Payu.

    Since Jotform integration does not support Payu payment gateway, I have been reserching on the Forum and found this:

    https://www.jotform.com/answers/988650-PayU-payment-integration

    However, at the end of the post, the person who offered his knowledge to implement this, posted the solution in a private message which I do not have access.

    Does someone know how to implement it?

    I undestand from previous post that I need the total amount on the form.

    Then, how I redirect the variables to the Payu Gateway?

    I am not an IT person, but could understand something if it is explained clearly.

    Hope someone can help.

    Many thanks.

     

  • Profile Image
    Mike
    Answered on November 11, 2017 at 07:02 PM

    Thank you for contacting us.

    1) From what I understand, one of my colleagues provided a PHP script to redirect the form user to the PayU checkout.

    If you would like to use that solution, you will need to be able to host a PHP script.

    2) Form will redirect user to the PayU checkout upon the form submission. Each entry will be recorded in your submission, and payment status paid/unpaid will not be transferred back to the JotForm.

    So this will work differently compared to our standard payment forms. With our standard payment forms, only successfully paid entries are being placed to the submissions.

    If the 1 & 2 items are fine with you, let us know. I can ask Welvin for a PHP script sample.

  • Profile Image
    batourguide
    Answered on November 11, 2017 at 08:43 PM
    Hi,
    Yes, items 1 and 2 would be fine.
    Could you please send me the PHP sample?
    Thanks.
    Máximo
    Enviado desde mi iPhone
    El 11 nov. 2017, a la(s) 21:02, JotForm escribió:
    ...
  • Profile Image
    Mike
    Answered on November 11, 2017 at 09:09 PM

    Sure, I will get back to you once I have the script.

  • Profile Image
    batourguide
    Answered on November 13, 2017 at 04:43 PM
    Hi,
    Do you have any news? Have you been able to get the script I need from
    Welvin?
    Thanks.
    Regards,
    Máximo Yedid
    www.BAtourguide.com.ar
    Cell: +54 911 5693 9740 (From ABROAD)
    Cell: 15 5693 9740 (From ARGENTINA)
    ...
  • Profile Image
    aubreybourke
    Answered on November 13, 2017 at 05:58 PM

    Sorry no update yet on the script. I have left a message with our associate. And he will update us if that's at all possible soon.

  • Profile Image
    Welvin
    Answered on November 14, 2017 at 01:12 PM

    Please copy the codes here: https://www.pastiebin.com/5a0b31971f531. If you need help, let me know the following details:

    1. You PayU Merchant ID.

    2. Your PayU Account ID.

    3. Your PayU API Key.



  • Profile Image
    batourguide
    Answered on November 14, 2017 at 11:43 PM
    Hi Welvin,
    Thank you very much for your cooperation.
    I am not an IT person...I guess I can modify Merchant ID, Account ID and
    API Key on the code you provided.
    However, the problem to me is to understand where/how should I then copy
    the final PHP code.
    This is a sample form I created to test the integration with Payu.
    https://form.jotformz.com/73148511372655
    Should I copy your PHP code inside the "PAGAR" (Pay) button? How do I do
    this?
    Or do I need to put the code somewhere else in the form?
    Looking forward to your reply.
    Thanks.
    Regards,
    Maximo
    Máximo Yedid
    www.BAtourguide.com.ar
    Cell: +54 911 5693 9740 (From ABROAD)
    Cell: 15 5693 9740 (From ARGENTINA)
    ...
  • Profile Image
    Chriistian
    Answered on November 15, 2017 at 03:25 AM

    The final PHP code should save as a PHP file and then upload it to your own server. The link to it will be used as your Thank you Page URL. Please refer to this guide: Redirecting Users to a Different Page

    You need also to enable the Post Send data in the JotForm Settings. Please refer to this guide: How to Post Submission Data to Thank You Page.

    However, if you get stuck, please let us know if you need further help.


  • Profile Image
    batourguide
    Answered on December 05, 2017 at 04:43 PM
    Hi,
    I have tested your code and everything is working correctly.
    Many thanks.
    I would like to ask you.
    Is it possible for you to modify the code in order I can get a detailed
    description of the purchase, instead of the general "Payment for total
    order" sentence?
    I think that seeing a detailed description at the checkout will give
    customers more confidence on their purchase.
    For example, using your test form
    https://www.jotformpro.com/form/63168529699980
    If a customer selects 2 products (i.e. E-card Recarga $10.000 COP and
    E-card Recarga $15.000 COP), then the "description" on the checkout should
    describe those 2 products.
    Would that be possible?
    I am nota programmer and it is out of my knowledge to modify your code.
    Your assistance with this will be much appreciated.
    Regards,
    Máximo Yedid
    www.BAtourguide.com.ar
    Cell: +54 911 5693 9740 (From ABROAD)
    Cell: 15 5693 9740 (From ARGENTINA)
    ...
  • Profile Image
    aubreybourke
    Answered on December 05, 2017 at 05:47 PM

    You could try this:

    <?php

    //Data From the Form
    $id = $_POST['submission_id'];
    $name = $_POST['name']['0'] . ' ' . $_POST['name']['1'];
    $email = $_POST['email'];
    $phone = $_POST['phonenumber']['0']. ' ' . $_POST['phonenumber']['1'];
    $amount = $_POST['myproducts']['4'];
    $description = $_POST['myproducts']['5'];

    //PayU Account Data
    $api = "4Vj8eK4rloUd272L48hsrarnUA";
    $merchantId = "508029";
    $accountId = "512321";
    $currency = "COP";

    //remove comma from the amount
    $finalamount = str_replace(',', '', $amount);

    //Create Signature
    $signature = "$api"."~"."$merchantId"."~"."$id"."~"."$finalamount"."~"."$currency";
    ?>

    <!DOCTYPE html>
    <html>

    <head>
        <title>Payment Page</title>

        <!--Auto Load to payment page within 1 second(s)-->
        <script type="text/javascript">
            setTimeout(function(){ document.getElementById('submit').click(); }, 2000);
        </script>
        <style type="text/css">
           
              #redirect {
                display: block;
                margin: 100px auto;
                position: relative;
                text-align: center;
            }

        </style>
    </head>


    <body>

    <div id="redirect"><img src="https://shots.jotform.com/welvin/php/payu/redirect.gif"></div>
        <!--Payment Form with variables coming from the PHP codes above-->
        <form method="post" action="https://sandbox.gateway.payulatam.com/ppp-web-gateway/">
            <input name="merchantId" type="hidden" value="<?php echo "$merchantId"; ?>">
            <input name="accountId" type="hidden" value="<?php echo "$accountId"; ?>">
            <input name="referenceCode" type="hidden" value="<?php echo "$id"; ?>">
            <input name="amount" type="hidden" value="<?php echo "$finalamount"; ?>">
            <input name="description" type="hidden" value="<?php echo "$description"; ?>">
            <input name="buyerFullName" type="hidden" value="<?php echo "$name"; ?>">
            <input name="buyerEmail" type="hidden" value="<?php echo "$email"; ?>">
            <input name="telephone" type="hidden" value="<?php echo "$phone"; ?>">
            <input name="currency" type="hidden" value="<?php echo "$currency"; ?>">
            <input name="signature" type="hidden" value="<?php echo md5($signature); ?>">
            <input name="tax" type="hidden" value="0">
            <input name="taxReturnBase" type="hidden" value="0">      
            <input name="test" type="hidden"  value="1" >
            <input name="responseUrl" type="hidden" value="">
            <input name="confirmationUrl" type="hidden" value="">
            <input name="submit" id="submit" type="submit" value="Enviar" hidden="true">
        </form>


    </body>

    </html>

    The yellow is Welvin's code. The green parts are the modifications I have made.