<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Sending Form Values to Payment Gateway Page with Auto POST

Published on
7,991 Points
4,891 Views
1 Endorsement
Last Modified:
Loganathan Natarajan
LAMP Developer, PHP Expert, Web Developer
When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered product items details before you do the payment gateway process.

It can be done in the below manner.

On your web site process page, you need to connect with the database and retrieve the products and user details. And then you need to place the payment gateway implementation code in the page with auto post form script written.

So here, we just combine our custom database values with payment gateway implementation script and redirecting to it

It will look like the sample code,

 
<?

	your database process... connecting to the db 
	and get the details for the payment gateway page

?>


<html>
		<head><title>Web Site Title</title></head>
	<body>
	<form name="frm1" method="post" action="payment_gateway_url.jsp">
		
		<input type=hidden name="Amount" value="">
		<input type=hidden name="Order_Id" value="">	
			
		<input type=hidden name="Merchant_Id" value="">		

		<input type=hidden name="WorkingKey" value="">	
		
		
		<input type="hidden" name="billing_cust_name" value="echo value"> 
		<input type="hidden" name="billing_cust_address" value="echo value"> 
		<input type="hidden" name="billing_cust_country" value="echo value"> 
		<input type="hidden" name="billing_cust_tel" value="echo value"> 
		<input type="hidden" name="billing_cust_email" value="echo value"> 
		<input type="hidden" name="billing_cust_notes" value="">
		
		<input type="hidden" name="delivery_cust_name" value="echo value"> 
		<input type="hidden" name="delivery_cust_address" value="echo value"> 
		<input type="hidden" name="delivery_cust_tel" value="echo value"> 		
		
		
	</form>
	
	<script language="javascript" type="text/javascript">
		document.frm1.submit();		
	</script>	
	
</body>
</html>

Open in new window



Once you auto posted the values with the required fields to the payment gateway page, you will get response from the gateway page.

That's all, now you can verify into your merchant account whether the payment is done or not.

This process helps much to auto post the form field values along with required values to the payment gateway and to keep track the ordered product items details into the database.

Enjoy this tip.
1
Comment
  • 4
  • 2
6 Comments
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
Respected Sir,

You can use the session variables to store the values which you want to pass to another page. like this

session.Contents("Name") = txtName.Text
session.Contents("Address")=txtAddress.Text

and then after you can access this session varibles from another page.
like this
hdName.Text = session.Contents("Name")
hdAddress.Text = session.Contents("Address")
0
LVL 36

Author Comment

by:Loganathan Natarajan
The main goal of the above post is to forward the variable values to the Payment Gateway forms.
0
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
Hello,

You also pass the varible values through this type of session variables. Try this.
0
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

LVL 11

Expert Comment

by:SAMIR BHOGAYTA
Hello,
session.Contents("sess_Amount") = Amount
<input type=hidden name="Amount" value="">

session.Contents("sess_Order_Id") = Order_Id
<input type=hidden name="Order_Id" value="">      

session.Contents("sess_Merchant_Id") = Merchant_Id                  
<input type=hidden name="Merchant_Id" value="">

session.Contents("sess_WorkingKey") = WorkingKey            
<input type=hidden name="WorkingKey" value="">      

session.Contents("sess_billing_cust_name") = billing_cust_name
<input type="hidden" name="billing_cust_name" value="echo value">

session.Contents("sess_billing_cust_address") = billing_cust_address
<input type="hidden" name="billing_cust_address" value="echo value">

session.Contents("sess_billing_cust_country") = billing_cust_country
<input type="hidden" name="billing_cust_country" value="echo value">

session.Contents("sess_billing_cust_tel") = billing_cust_tel
<input type="hidden" name="billing_cust_tel" value="echo value">

session.Contents("sess_billing_cust_email") = billing_cust_email
<input type="hidden" name="billing_cust_email" value="echo value">

session.Contents("sess_billing_cust_notes") = billing_cust_notes
<input type="hidden" name="billing_cust_notes" value="">

session.Contents("sess_delivery_cust_name") = delivery_cust_name
<input type="hidden" name="delivery_cust_name" value="echo value">

session.Contents("sess_delivery_cust_address") = delivery_cust_address
<input type="hidden" name="delivery_cust_address" value="echo value">

session.Contents("sess_delivery_cust_tel") = delivery_cust_tel
<input type="hidden" name="delivery_cust_tel" value="echo value">
0
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
Hello, sorry use like this

session.Contents("sess_Amount") = Amount.value
<input type=hidden name="Amount" value="">

session.Contents("sess_Order_Id") = Order_Id.value
<input type=hidden name="Order_Id" value="">      

session.Contents("sess_Merchant_Id") = Merchant_Id.value                  
<input type=hidden name="Merchant_Id" value="">

session.Contents("sess_WorkingKey") = WorkingKey.value            
<input type=hidden name="WorkingKey" value="">      

session.Contents("sess_billing_cust_name") = billing_cust_name.value
<input type="hidden" name="billing_cust_name" value="echo value">

session.Contents("sess_billing_cust_address") = billing_cust_address.value
<input type="hidden" name="billing_cust_address" value="echo value">

session.Contents("sess_billing_cust_country") = billing_cust_country.value
<input type="hidden" name="billing_cust_country" value="echo value">

session.Contents("sess_billing_cust_tel") = billing_cust_tel.value
<input type="hidden" name="billing_cust_tel" value="echo value">

session.Contents("sess_billing_cust_email") = billing_cust_email.value
<input type="hidden" name="billing_cust_email" value="echo value">

session.Contents("sess_billing_cust_notes") = billing_cust_notes.value
<input type="hidden" name="billing_cust_notes" value="">

session.Contents("sess_delivery_cust_name") = delivery_cust_name.value
<input type="hidden" name="delivery_cust_name" value="echo value">

session.Contents("sess_delivery_cust_address") = delivery_cust_address.value
<input type="hidden" name="delivery_cust_address" value="echo value">

session.Contents("sess_delivery_cust_tel") = delivery_cust_tel.value
<input type="hidden" name="delivery_cust_tel" value="echo value">
0
LVL 36

Author Comment

by:Loganathan Natarajan
yes, we can use SESSION also to pass the values.Np
0

Featured Post

Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Join & Write a Comment

Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month