0

I have a form on my checkout page that redirect to the payment gateway and at same time write customer info on database, but i don't know how to pass info that customer just fill on the checkout page to the payment gateway. I use php xml for the dynamic button all is working with the data from previous page "cart" page but on checkout i don't know how to pass the infos
that customer will write on the form i attach a picture of the checkout page when customer finish to fill the info they are redirect to payment gateway and data are insert to database but i need to add some to the payment gateway and im stuck here im sure it's stupid thing but im newbie ...

// Here the code for the payment gateway //

   <?php

    $name=$_REQUEST['name'];
    $total=$_REQUEST['total'];
    $quantity=$_REQUEST['quantity'];
    $stotal=$_REQUEST['s_total'];
    $image=$_REQUEST['image'];
    $taskOption=$_REQUEST['taskOption'];
    $taskOption2=$_REQUEST['taskOption2'];
    $pricefix=$_REQUEST['pricefix'];
    $email=$_request['email'];
    $productname=$_REQUEST['name'];

$xml = "<?xml version='1.0' encoding='utf-8' ?> 
<order> 
    <userAccountId>2855698</userAccountId> 
    <currency>EUR</currency> 
    <label>$productname</label> <= all infos here came from previous page cart.php and succesfuly passed to the gateway*/ 
    <ageGroup>ALL</ageGroup> 
    <categoryId>639</categoryId> 
     <urlAcquital><![CDATA[http://mysite.com/deals/capture.php]]></urlAcquital> 
    <urlOk><![CDATA[http://mysite.com/deals/capture.php]]></urlOk> 

    <!-- optional --> 
    <locale>fr_FR</locale> 
    <issuerAccountLogin>$email</issuerAccountLogin> <= here it's not working it's on the current page checkout */ 
    <items> 
        <item id='1'> 
        <name>My site</name> 
           <infos>$productname / $taskOption</infos> <= all infos here came from previous page cart.php and succesfuly passed to the gateway*/ 
            <amount>$pricefix</amount> <= all infos here came from previous page cart.php and succesfuly passed to the gateway*/ 
            <categoryId>639</categoryId> 
            <quantity>$quantity</quantity> <= all infos here came from previous page cart.php and succesfuly passed to the gateway*/ 
            <reference>REF1</reference> 
        </item> 
    </items> 
</order>";

<form action='https://payment.mysite.com/index/form/' method='post'  target='_blank' > 
    <input type='hidden' name='mode' value='MODE_B' /> 
    <input type='hidden' name='website_id' value='8544799' /> 
    <input type='hidden' name='sign' value="<?php echo $md5Sign ?>" /> 
    <input type='hidden' name='data' value="<?php echo $encodedData ?>" /> 
    <input type="hidden"  id="productname" name="productname" value="<?php echo $name ?>">
    <input type="hidden"  id="quantity" name="quantity" value="<?php echo $quantity ?>">
    <input type="hidden"  id="taskOption" name="taskOption" value="<?php echo $taskOption; ?>">
    <input type="hidden"  id="taskOption2" name="taskOption2" value="<?php echo $taskOption2; ?>">
    <input type="hidden"  id="total" name="total" value="<?php echo $stotal ?>">
    <input type="hidden"  id="email" name="email" value="<?php echo $semail ?>">
    </form>

// Here the code for the database //

<script>
    function WriteToFile() {

        var fname=$("#fname").val();
        var lname=$("#lname").val();
        var address=$("#address").val();
        var zipcode=$("#zipcode").val();
        var city=$("#city").val();
        var country=$("#country").val();
        var phone=$("#phone").val();
        var email=$("#email").val();
        var productname=$("#productname").val();
        var taskOption=$("#taskOption").val();
        var taskOption2=$("#taskOption2").val();
        var quantity=$("#quantity").val();
        var total=$("#total").val();

        var formdata = new FormData();
        formdata.append('fname',fname);
        formdata.append('lname',lname);
        formdata.append('address',address);
        formdata.append('city',city);
        formdata.append('country',country);
        formdata.append('phone',phone);
        formdata.append('zipcode',zipcode);
        formdata.append('productname',productname);
        formdata.append('taskOption',taskOption);
        formdata.append('taskOption2',taskOption2);
        formdata.append('quantity',quantity);
        formdata.append('total',total);
        formdata.append('email',email);

        $.ajax({
            url: "form.php",
            type: "POST",
            data: formdata,
            cache: false,
            contentType: false,
            processData: false,
            success: function (response) {
                console.log(response)
            }
        });

    }
</script>

Edited by momo_1

Attachments infosss.jpg 262.17 KB
1
Contributor
1
Reply
26
Views
5 Months
Discussion Span
Last Post by momo_1
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.