How to integrate paypal pro in to your php site….

The following code is used to integrate payment module in your site

create one file with name paypal.php [or any name you wish]

paypal.php file contains the following code

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>The Popout – Paypal Payment</title>
<link rel=”icon” href=”favicon.ico” type=”image/x-icon” />
<link rel=”icon” href=”images/1.ico” type=”image/x-icon”>
<link rel=”shortcut icon” href=”images/1.ico” type=”image/x-icon”>
</head>
<body oncontextmenu=”return false” onLoad=”document.paypal_form.submit();”>
<form action=”https://www.paypal.com/cgi-bin/webscr&#8221; method=”post” name=”paypal_form”>
<input type=”hidden” name=”image” src=”images/payment_sub.gif” border=”0″ alt=”Make payments with PayPal – it’s fast, free and secure!”>
<input type=”hidden” name=”cmd” value=”_xclick-subscriptions”>
<input type=”hidden” name=”business” value=”clientpaypalid@clientsite.com”> <!–Value is Client paypal id for his site, it is mandatary–>
<input type=”hidden” name=”item_name” value=”Premium Membership”>
<input type=”hidden” name=”buyer_credit_promo_code” value=”1″>
<input type=”hidden” name=”buyer_credit_product_category” value=”1″>
<input type=”hidden” name=”buyer_credit_shipping_method” value=”1″>
<input type=”hidden” name=”buyer_credit_user_address_change” value=”1″>
<input type=”hidden” name=”no_shipping” value=”1″>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”currency_code” value=”AUD”> <!–Value is currency code–>
<input type=”hidden” name=”lc” value=”US”> <!–Country code–>
<input type=”hidden” name=”bn” value=”PP-SubscriptionsBF”>
<input type=”hidden” name=”a3″ value=”<?=$amount?>”> <!–Value is the amount how much you collect from user, this value is mandatary, you can get this value from the hidden filed of previous form you come from or get from passing to the url, best to get from hidden field, if you get from url it is not safe because we give chance to the user to change the amount value–>
<input type=”hidden” name=”p3″ value=”1″>
<input type=”hidden” name=”t3″ value=”M”>
<input type=”hidden” name=”src” value=”1″>
<input type=”hidden” name=”sra” value=”1″>
<input type=”hidden” name=”first_name” value=”<?=$firstname?>”> <!–Value for this user details is not mandatary, these fields will be filled in the paypal site if we are not passing. If we pass these values these values will be autofilledin in the paypal site–>
<input type=”hidden” name=”last_name” value=”<?=$lastname?>”>
<input type=”hidden” name=”address1″ value=”<?=$address?>”>
<input type=”hidden” name=”city” value=”<?=$city?>”>
<input type=”hidden” name=”state” id=”state” value=”<?=$state?>”>
<input type=”hidden” name=”zip” value=”<?=$zip?>”>
<input type=”hidden” name=”country” id=”country_code” value=”<?=$country_code?>”>
<input type=”hidden” name=”H_PhoneNumber” value=”<?=$H_PhoneNumber?>”>
<input type=”hidden” name=”email” value=”<?=$email?>”>
<input type=”hidden” name=”credit_card_type” id=”credit_card_type” value=”<?=$credit_card_type?>”>
<input type=”hidden” name=”cc_number” value=”<?=$card_num?>”>
<input type=”hidden” name=”expdate_month” value=”<?=$exp_month?>”>
<input type=”hidden” name=”expdate_year” value=”<?=$exp_year?>”>
<input type=”hidden” name=”cvv2_number” value=”<?=$card_code?>”>
<input type=”hidden” name=”return” value=”http://www.popout.com.au/dev/paypalstatus.php?msg=success”&gt; <!–this is the page redirecting from paypal site when the user gives all correct details–>
<input type=”hidden” name=”cancel_return” value=”http://www.popout.com.au/dev/paypalstatus.php?msg=failure”&gt; <!–this is the page redirecting from paypal site when the user gives false details–>
<input type=”submit” name=”submit” value=”continue” />
</form>
</body>
</html>

Advertisements
Categories: PHP

4 thoughts on “How to integrate paypal pro in to your php site….

  1. I get pleasure from, lead to I found exactly what I used to be taking a look for.
    You’ve ended my four day lengthy hunt! God Bless you man. Have a great day. Bye

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s