So I'm trying to modify a system that currently works like this:
- prepayment.php Gathers the information of the customer and posts it
- pay_info.php Creates a session and displays more information about the payment
- payment.php displays more information about the payment
- creditcardpay.php displays MORE information about the payment
- com_web_process.php Sends the information to a bank, posting it to https://migs.mastercard.com.au/vpcpay
- Then you jump in to the bank API which is not hosted in our server
- When you are done doing the transfer, the bank returns the user to credit_card_process.php in our server, along with transfer information.
- credit_card_process.php receives the receipt number and transfer information and prints a receipt with it and information previously stored in the session.
First question: Im not sure how this works, is the session staying alive even when the customer is sent to another server? or does it stay in our server and when the user gets back the variables are still there? (If so, how does it recognizes the user?)
And second:
The process is too long,the customer receives redundant information in 3 pages which I want to remove, sumarizing everything in prepayment.php and send the information to com_web_process.php to be processed immediately (Removing steps 2-4)
I can get the information to the bank API and the deposit works just nicely. However when it gets back to our server in the file credit_card_process.php it prints the information generated by the bank (receipt etc) but the information that was stored in session variables (cusotmer's email, name, country of residency) doesnt displays.
if it helps I can post either all the files, or the parts I consider most relevant (which would be the session variable and such)
Funny thing is I tested by printing the variables in com_web_process.php and they show properly, but they get lost when going to the bank and coming back.
Files in order of appearance:
pre_payment.php
form name="frm_main" action="pay_info.php?lang=" method="post" onSubmit="return validate_register();"
//customer information
Pay_info.php
$last_url=$_SERVER['HTTP_REFERER'];
// im not sure what this does
$last_name=$_POST["last_name"];
// get the customer data in variables (I dont see why they did this instead of doing post directly to session variables)
$_SESSION['first_name']=$first_name;
// get the variables in to session variables
form name="frm_main" action="payment.php?lang=<?=$LANG_TYPE?>" method="post"
input type="hidden" name="first_name" value="<?=$_SESSION['first_name']?>"
//use the session variables to post to the next form
payment.php
$_SESSION["CREDIT_CARD_TRANS"]="YES";
This is validated later on to make sure you are actually making a transaction, in my new attempt I created this variable in pre_payment
$last_name=$_POST["last_name"];
Get the post in to variables (necessary? dont we have the session ones already?)
<form name="frmMain" action="credit_card_pay.php?lang=<?=$LANG_TYPE?>" method="post" onSubmit="return validatePayment();">
<input type="hidden" name="last_name" value="<?=$last_name?>" />
Variables sent to the next file
credit_card_pay.php
<input type="hidden" name="vpc_LirtsName" value="<?=$last_name?>" /> this variable last_name is not declared anywhere in the code, I dont know how, why or if its even using it
<form name="frm_main" action="com_web_process.php" method="post" onsubmit=" return credit_card_validation();">
<input type="hidden" name="reciept_last_name" value="<?=$_POST["reciept_first_name"]?>" />
posting customer information to the next file
com_web_process.php.
$_SESSION["CC_FIRST_NAME"]=$_POST["reciept_first_name"]; posting customer info to session variables
<form name="frmMain" action="./PHP_VPC_3Party_DO.php" method="post">
<input type="hidden" name="vpc_ReturnURL" size="63" value="http://www.visaustralia.com/ekey/credit_card_process.php" maxlength="250"/>
<input type="hidden" name="vpc_Amount" value="<?=$_POST["vpc_Amount"]?>" size="20" maxlength="10"/> sending info to the bank file in our server that connects and sends the information to the bank.
credit_card_process.php
$NAME=$_SESSION["CC_NAME"];
<td width="421" class="formLabel2" style="padding:5px;"><strong><?=$NAME?></strong>
gets the name from the session and prints it in the receipt