Make return URL for getting a response from bank/paymentgateway

Ajeesh

I need to create a return url which I have given to a payment gateway in which they will post their response parameters:

status
customerReferenceNo    
referenceNo
merchantId
amount
checkSum

to the URL I given. All I want is an HTML page which could accept this parameters and store them to a database, the database part I can do it.

But the php code for accepting their values,I cant do that.i dont know whether they are using POST or GET:

status-4N
customerReferenceNo    -  30An
referenceNo  - 32 AN
merchantId  - 10AN
amount  - 9.2AN
checkSum - 64AN

This are the parameters they given in their documentation and they have also given respective field specification (I don't know what field specs is).

The status '0' will be successful transaction and if its a negative value, it's a failed transaction.

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

    if (count($_GET)==0 && count($_POST)==0)
    {  
    ?> 
         <h1 style="font-weight:bold; font-family:'RobotoThin' align='center';">ERROR. NO DATA FOUND</h1>
    <?php
    }
    else
    {

        if($_SERVER['REQUEST_METHOD']=='POST')
        {

         $status    = $_REQUEST['Status'];
         $essrefno= $_REQUEST['TransactionId'];
         $ref_no= $_REQUEST['ReferenceNo']; 

         $sql = "update `tablename` set `ess_ref_no`= '$essrefno',status='$status' where ref_no ='$ref_no'";

         mysql_query($sql);
         }
         if($_SERVER['REQUEST_METHOD']=='GET')
        {

         $status    = $_REQUEST['Status'];
         $essrefno= $_REQUEST['TransactionId'];
         $ref_no= $_REQUEST['ReferenceNo'];

          //echo $status+$essrefno+$ref_no;
         $sql = "update `tablename` set `ess_ref_no`= '$essrefno',status='$status' where ref_no ='$ref_no'";

         mysql_query($sql);
         }
        //echo $sql;
    ?>
    <?php
        if ($status==0 )
        {
    ?>
            <h1 style="font-weight:normal; font-family:'RobotoThin';">Your transaction is successful and your transaction reference no for any further communication is  <?php echo $ref_no; ?> .</h1>
     <?php
        }
        else
        {
     ?>
            <h1 style="font-weight:normal; font-family:'RobotoThin';">Your transaction failed and your transaction reference no for any further communication is  <?php echo $ref_no; ?>.</h1>
     <?php
        } 
    }
?>

This is the PHP I have made but it's not working. Moreover I have given something.html page to them and I don't know how this PHP be integrated to that HTML page using JavaScript or something? Is there someone who could help me?

Damien Overeem

The superglobal $_REQUEST will contain both POST as GET data, so don't worry too much (yet) if they POST or GET the data.

Do a var_dump($_REQUEST); to see the data that's been posted. Should be easy from that point on.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get / Make thumbnail image from video url getting in API response

From Dev

Getting the response of an instagram url

From Dev

How to make a REST call from Spring MVC Controller and return the response as it is

From Dev

Windows Silverlight phone app getting a json response from url

From Dev

Android: json response, google api and getting image from url

From Dev

get XML from server by URL in AsyncTask and return response to UI

From Dev

Getting correct URL to make ajax call from JS file

From Dev

How do you make apache return a status 200 response code on a post to a url

From Dev

How do you make apache return a status 200 response code on a post to a url

From Dev

Not getting expected response from Guzzle

From Dev

Getting IP from DNS Response

From Dev

Getting headers from a response in volley

From Dev

Getting IP from DNS Response

From Dev

Getting url and make the menu active

From Dev

Make request to external server from vaadin client and return JSON response to my sever

From Dev

Return response from FasctCGI to nginx

From Dev

return response from php to jquery

From Dev

Laravel - return response from helper

From Dev

Liftweb return response from scalaz

From Dev

Unable to return response from function

From Dev

getting input from URL

From Dev

getting id from url

From Dev

getting input from URL

From Dev

Getting JSONP response inside a javascript: URL

From Dev

Can Google's Vision API accept a URL from any external server and return a response on that image?

From Dev

How to make clickable URL's in JSON response from REST using AngularJS?

From Dev

Getting response from HTTP Adapter from Worklight

From Dev

Getting response from HTTP Adapter from Worklight

From Dev

How to go to the url return by a restful service as response

Related Related

  1. 1

    Get / Make thumbnail image from video url getting in API response

  2. 2

    Getting the response of an instagram url

  3. 3

    How to make a REST call from Spring MVC Controller and return the response as it is

  4. 4

    Windows Silverlight phone app getting a json response from url

  5. 5

    Android: json response, google api and getting image from url

  6. 6

    get XML from server by URL in AsyncTask and return response to UI

  7. 7

    Getting correct URL to make ajax call from JS file

  8. 8

    How do you make apache return a status 200 response code on a post to a url

  9. 9

    How do you make apache return a status 200 response code on a post to a url

  10. 10

    Not getting expected response from Guzzle

  11. 11

    Getting IP from DNS Response

  12. 12

    Getting headers from a response in volley

  13. 13

    Getting IP from DNS Response

  14. 14

    Getting url and make the menu active

  15. 15

    Make request to external server from vaadin client and return JSON response to my sever

  16. 16

    Return response from FasctCGI to nginx

  17. 17

    return response from php to jquery

  18. 18

    Laravel - return response from helper

  19. 19

    Liftweb return response from scalaz

  20. 20

    Unable to return response from function

  21. 21

    getting input from URL

  22. 22

    getting id from url

  23. 23

    getting input from URL

  24. 24

    Getting JSONP response inside a javascript: URL

  25. 25

    Can Google's Vision API accept a URL from any external server and return a response on that image?

  26. 26

    How to make clickable URL's in JSON response from REST using AngularJS?

  27. 27

    Getting response from HTTP Adapter from Worklight

  28. 28

    Getting response from HTTP Adapter from Worklight

  29. 29

    How to go to the url return by a restful service as response

HotTag

Archive