Question

I have a php for accepting some parameters (status,referenceNo,customerReferenceNo,merchentId,amount,checkSum).

https://cellpay.essecom.com/PGCCDCToken/TokenPayment.jsp?merchantId=xxxxxx&data=GyT5Sdoc5yUq1448sdsrva0KdhzI%2BprFmbZt8tAcpSfEWNUED%2BsHPf0yGl7bCn%2B%2FWE37yTWve6r4IBpaQWvFWF1ereC5mi6QPcLaYtX9PyvR%2F4LDhcKAK9EauYNGFkBy3lHy4ZLdZELjf5YERUS6i7AlRvGZCzLj0BZmnIBKIrIv%2FeHQxxxxxU6miaurjw%2BuNab%2BQkD0%2FJ4Fy%2FjRb7mr%2F9M7P7BmZwDW2nyNUQmWaKV4Bb3tbB%2BNlKoJRYhCNWOCKSUd1fa543iM3Yz19W6e0BxOq4ufBAMWbxxxxxxxxZEanAK%2BVPkBMiLvFc2mN0xCbw%2FAAvHZGogL5mIvQMHwZVJqtSld9QSJeQOhxxxxxxx8KfI5vHf6epiODYuhBPgTtPX2r9PJRkNimripVwFq0aj%2FJ%2BNyJBdfWH93jKdbSs3NYCSSziVsoHQqGj0mgXcRXOQjZoPaSctcb5VhFEze5azl%2B9BKQ%3D

The above url is to which I'm sending some data and after verifying this,they are sending back some parameters to the response url , the below code is the contents of my reponse.php file,which is my reponse url.I checked my reponse url using RESTconsole by senting the same parameters and it is getting injected in my db.But im not getting reponse from the provider.Is there anything wrong in my code?

 <?php
        session_start();
        require("./connect.php");

             $status    = $_REQUEST['status'];
             $ref_no= $_REQUEST['referenceNo'];
             $cust_ref_no= $_REQUEST['customerReferenceNo'];
             $merchantId= $_REQUEST['merchantId'];
             $amount= $_REQUEST['amount'];
             $checkSum= $_REQUEST['checkSum'];
              echo "Status is ".$status;
              echo "<br> Ref no is ".$ref_no;
              echo "<br> Cust Ref No is ".$cust_ref_no;
              echo "<br> Merchant ID is ".$merchantId;
              echo "<br> Amount is ".$amount;
              echo "<br> Checksum is ".$checkSum;
              $sql = "INSERT INTO paymentResponse VALUES('','$status','$ref_no','$cust_ref_no','$merchantId','$amount','$checkSum',now())";
              $result=mysql_query($sql);
              echo "<br>Data insert status: ".mysql_error()."<br>";
            if ($status=='0')
            {
             echo "<br>Your transaction is successful and your transaction reference no for any further communication is ".$ref_no;
            }
            else
            {
                 echo "<br>Your transaction failed and your transaction reference no for any further communication is ".$ref_no;
            }
    ?>

Status is 
Ref no is 
Cust Ref No is 
Merchant ID is 
Amount is 
Checksum is 
Data insert status: Duplicate entry '' for key 'referenceNo'

Your transaction failed and your transaction reference no for any further communication is

this is the only response i get in the page and the db valuess are null

Was it helpful?

Solution

Data insert status: Duplicate entry '' for key 'referenceNo'

Means you are inserting the data with the same referenceNo in database that already present in the database.

And you have the constraint on this column not to insert the duplicate entry. So you need to try with new one referenceNo. And the data is not inserting that data.

You can debug the data that what is returning data by:

print_r($_REQUEST);

And you will get that what data is coming in return.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top