Process of Making a Payment With Paypal
Now we have completed how to create and configure test accounts and configure the website payment settings. So lets move onto integrating paypal sandbox with our site. In this tutorial I am going to show you how the flow of a paypal payment using “Paypal Buy Now” buttons. This tutorial is used to learn the process of a payment. I’ll be covering several types of payment process like express checkout, recurring payments, subscriptions in future tutorials once we cover all the basics needed to handle paypal payments. So let’s start creating a Buy Now button.
You can find sample paypal button codes at Paypal Buttons. Copy the code for Buy Now button and change it as following.
<form name="_xclick" action="https://www.sandbox.paypal.com/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="innova_1316586326_biz@gmail.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name" value="Teddy Bear"> <input type="hidden" name="return" value="http://www.innovativephp.com/demo/payapl-process/success.php"> <input type="hidden" name="amount" value="12.99"> <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> </form>
Form action – the code you copied contains paypal live site url as the action. Since we are still using the sandbox for testing, we need to change it as https://www.sandbox.paypal.com/webscr.
Return URL – we can set the url to return after finishing the paymet, by using the return hidden parameter. If this is not specified payment will redirect to the URL you have configured on Website Payment Preferences. In order to return url to work you need to set the status of auto return to on.
Business Email – Change the email address of business hidden parameter to your business email address.
Now we are ready to start the payment process. Following section contains the steps for making a paypal sandbox payment.
Insert the above code to your web page and load the web page. You will see a paypal button. Following code is a sample screen of how it will be displayed. In the sample i have added a html table to display the data for purchased item. If you insert the code only, you will get only the paypal button.
Now click the buy now button and you will be directed to the paypal payment screen as shown in the following screen.
After login you will be asked to Review your payment information as shown in the following screen. Click the Pay Now button once the review is complete.
Then you will be directed to Paypal Payment success page and in few seconds you will be redirected automatically to return url you have specified as shown in the following screen.
Now the payment is completed and you should take a look at the URL of the above screen. After the success.php it contains set of parameters and values returned from paypal. In order to validate the payment and save in our database we need to process these data. Next tutorial I will show you how to process paypal payment data using php curl library.






October 19th, 2011 at 7:24 am
Hey there, I think your blog might be having browser compatibility issues. When I look at your website in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, wonderful blog!
October 22nd, 2011 at 1:44 am
I do not know if it’s just me or if everyone else experiencing issues with your site. It appears as though some of the text in your content are running off the screen. Can somebody else please provide feedback and let me know if this is happening to them too? This could be a problem with my internet browser because I’ve had this happen previously. Cheers