Paypal still gets more popular every day. Not only for consumers making purchases. But also for first time or small businesses who aren’t ready for a real merchant account yet. I’m going to teach you quite a few things about Paypal so you’ll know how to get it installed on your own webpage. And also give you my free script that does all the things we’ll be going over.
If you’re just here for the paypal php code you can download the script near the bottom of the post.
I’ll explain the different ways you can take payments with Paypal. How to make Paypal buttons with basic options, this is how you get paid. And show you where to find all the options for Paypal buttons. You’ll learn distinction between Instant Payment Notification (IPN) and a Return URL, and what you should be doing with them respectively.
Paypal’s different payment choices
At the time of this writing, there are actually three separate payment methods available from Paypal. Website payments standard, is the one I’ll be going over. It is the most basic simple account they offer for taking money online. You can hook your checking or savings bank account to Paypal, using the routing and account number printed on your checks. This allows you to transfer money to and from your Paypal account to your bank, where you can get the money. And after a while, you can request a debit card that is directly hooked to your Paypal money.
The other two methods offered cost money. First, Website Payments Pro with Express Checkout is considered the “mid level”. It lets you accept credit cards directly on your site. They won’t have to leave your page, and go to paypal to pay. You’ll need an SSL certificate so yo
u can take credit card data over HTTPS, that’s the page with the lock icon showing. Website payments pro allows you to integrate express Paypal checkout into the same process for using credit cards directly on the site. This is slightly different than just standard payment buttons. It provides for a tighter integration when paying with Paypal. Which will ultimately increase your overall conversions.
Finally there is also PayFlowPro formerly a Verisgn product, recently aquired by Paypal. This is a full blown merchant account, with virtual terminal. Which like most others requires application fees and a more formal sign up process. With PayFlow You need to do a full API integration to accept credit cards directly on your site and have the money deposited straight into your business bank account. There are no buy it now buttons with this “grown up” solution.
Standard Paypal Payment Buttons
Making a button payment button is pretty easy. You use HTML code to make a form on your page . The form contains fields containing the required values. Such as the price, who’s account the money should go to, the name of the product, and more which I’ll show you in a code sample below.
The submit button for the form is the buy now or pay now button. You can use your own custom graphic, or one of the default paypal buttons.
When the customer clicks pay now or buy now, they are taken to Paypal’s page. Shown a summary of the order with price and other info. And instructions for them to make a payment by credit card or login using their existing user name and password to pay with funds in Paypal.
There are many possible parameters for creating Paypal buttons. In my sample I’m going to give the required options, and a few of the most commonly used options. In my free button script download, there are more examples of options you can use. This is an example of a Paypal button with the most basic options:
<input type=’hidden’ name=’cmd’ value=’_xclick’>
<input type=’hidden’ name=’business’ value=’sellers@email.com’>
<input type=’hidden’ name=’item_name’ value=’Item They are buying’>
<input type=’hidden’ name=’amount’ value=’1400′>
<input type=’hidden’ name=’no_shipping’ value=’0′>
<input type=’hidden’ name=’no_note’ value=’1′>
<input type=’hidden’ name=’currency_code’ value=’USD’>
<input type=’hidden’ name=’lc’ value=’US’>
<input type=’hidden’ name=’bn’ value=’PP-BuyNowBF’>
<input type=’image’ src=”btn_paynowCC_LG.gif” border=’0′ name=’submit’>
</form>
You can take this, and paste it onto your site, change the info to reflect your product, and you’ll have a payment button. The “name” value in the example, are common fields Paypal will use on the button. The names are pretty self explanatory. If you need detailed explanations, or want to see all the button options and parameters visit this Paypal document.
Integrate with your product database
If you have a lot of products, to put this pay button on all of your pages would be tedious. That is if you are copying and having to update that code manually. If you make a PHP function to ‘echo’ the paypal form, you can use variables from the database to fill the name value fields. Dynamically setting price, item name, and other values. This will save you lots of time as the Paypal form will be in one place, getting reused over and over with different database values injected.
IPN vs Return URL
Ok, both of these things happen after a payment is made. IPN is behind the scenes, meaning the customer doesn’t see it happen. The IPN is a call from paypals servers which sends customer and order data to a page you specify. The return URL is where the customer will be taken, if they click through, after paying. They may never make it to the return URL if they don’t click on the link on the paypal confirmation page.
What to do on the IPN page

If you have gone into the Paypal preferences, and set your IPN URL to the page you created on your server. When an order is completed it will send user and order information to that URL. There are a few things you’ll normally want to do on the instant notification page.
If you have an orders database, you will likely insert a row into an orders table. Or perhaps mark an unfinished order with the status finished. You may want to send a thank you and instructions email to your customer. Important steps in the order process that need to happen on every order, should be done on the IPN page not on the return url. The return url is not is not reliable and may not fire every time.
Make Use of the return URL page

When you create your buy it now buttons, you can set what page the customer can return to after the purchase is made. This page is usually called the thankyou page or thanks page. If you sell a digital product, give the download link or instructions here.
This is also a great place to upsell an additional offer to your customer. I like to use something like greybox for a nice clean popup to present the offer. Make it a one time thing, only available here, on the thanks page. If you’re comfortable, and you should be, put an exit pop on the thanks page if they didnt take the upsell, try another offer, or add more value the one they declined.
Download my free Paypal button PHP script
Download the paypal button script here. Its got an easy to use php function to make buttons with multiple item capability, and all basic options. For single button “one pagers”, like sales letters, or use on dynamic database driven multi product sites.
Easily extendable to support any paypal button features. Easy to follow, copy and paste code samples. Clean and clear examples. Return URL and IPN sample scripts included.
|
Category: cart and checkout, tools.
Related Posts: None Yet You can leave a response, or trackback from your own site. |




February 22nd, 2009 at 4:25 pm
[...] You’ll need an SSL certificate so yo Paypal Debit Card and Credit Card u can take credit card data on an HTTPS, that’s the page with the lock icon showing. Website payments pro allows you to integrate express Paypal checkout into the …Continue [...]
May 17th, 2009 at 9:16 am
Any articles written by you for Payflow Pro and Express checkout too.
Please do share.
Thanks once again.
May 3rd, 2010 at 6:00 am
hi guys…
hi guysI would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well and i have start my own blog now, , thanks for your effort…