Sending Form Values to Payment Gateway Page with Auto POST

AID: 219
  • Status: Published

1990 points

  • By
  • TypeGeneral
  • Posted on2008-11-20 at 22:59:01
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>
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:

Select allOpen 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.
Asked On
2008-11-20 at 22:59:01ID219
Tags

auto form post

,

payment gateway process

,

form values auto post

,

shopping cart

Topic

Web Languages/Standards

Views
1397

Comments

Expert Comment

by: samirbhogayta on 2012-03-12 at 20:11:05ID: 45435

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")

Author Comment

by: logudotcom on 2012-03-12 at 21:31:54ID: 45436

The main goal of the above post is to forward the variable values to the Payment Gateway forms.

Expert Comment

by: samirbhogayta on 2012-03-13 at 19:52:16ID: 45753

Hello,

You also pass the varible values through this type of session variables. Try this.

Expert Comment

by: samirbhogayta on 2012-03-13 at 19:59:46ID: 45754

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">

Expert Comment

by: samirbhogayta on 2012-03-13 at 20:07:26ID: 45755

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">

Author Comment

by: logudotcom on 2012-03-13 at 22:12:04ID: 45769

yes, we can use SESSION also to pass the values.Np

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Web Languages/Standards Experts

  1. COBOLdinosaur

    90,847

    Master

    0 points yesterday

    Profile
    Rank: Genius
  2. DaveBaldwin

    62,008

    Master

    2,800 points yesterday

    Profile
    Rank: Genius
  3. Ray_Paseur

    58,802

    Master

    0 points yesterday

    Profile
    Rank: Savant
  4. mplungjan

    58,636

    Master

    0 points yesterday

    Profile
    Rank: Savant
  5. ChrisStanyon

    25,340

    0 points yesterday

    Profile
    Rank: Sage
  6. jason1178

    25,235

    0 points yesterday

    Profile
    Rank: Genius
  7. leakim971

    23,800

    0 points yesterday

    Profile
    Rank: Genius
  8. dgofman

    22,600

    0 points yesterday

    Profile
    Rank: Genius
  9. ahoffmann

    21,350

    0 points yesterday

    Profile
    Rank: Genius
  10. tagit

    17,800

    0 points yesterday

    Profile
    Rank: Genius
  11. tommyBoy

    17,668

    0 points yesterday

    Profile
    Rank: Genius
  12. _agx_

    16,000

    0 points yesterday

    Profile
    Rank: Genius
  13. gdemaria

    14,740

    0 points yesterday

    Profile
    Rank: Genius
  14. CodeCruiser

    13,800

    0 points yesterday

    Profile
    Rank: Genius
  15. LZ1

    12,964

    0 points yesterday

    Profile
    Rank: Genius
  16. Gertone

    12,400

    0 points yesterday

    Profile
    Rank: Genius
  17. elvin66

    10,750

    0 points yesterday

    Profile
    Rank: Sage
  18. nap0leon

    10,600

    0 points yesterday

    Profile
    Rank: Sage
  19. logudotcom

    10,518

    10 points yesterday

    Profile
    Rank: Genius
  20. Tiggerito

    10,400

    0 points yesterday

    Profile
    Rank: Sage
  21. TheLearnedOne

    10,200

    0 points yesterday

    Profile
    Rank: Savant
  22. StingRaY

    10,050

    0 points yesterday

    Profile
    Rank: Wizard
  23. webmatrixpune

    9,500

    0 points yesterday

    Profile
    Rank: Guru
  24. Eyal

    8,200

    0 points yesterday

    Profile
    Rank: Wizard
  25. johanntagle

    8,200

    0 points yesterday

    Profile
    Rank: Sage

Hall Of Fame