Special Offer - Get $90 Discount and Host Your Dream Web Site @ Dreamhost for 1 Year Click Here. Promo Code SLJ345
Back To Top
Building Impressive Presentations with impress.js
Are you tired of creating boring Presentations?
Take a look at the the future of online presentations with impress.js
in my latest book

Learning Paypal Payment Flow Using Buy Now Buttons

on 2011/10/3 7:37 AM stored in: Paypal Integration and tagged: ,

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.

Creating a Paypal 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.

Making a Payment With Paypal Buy Now Buttons

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.

 

Paypal Form Button

 

Now click the buy now button and you will be directed to the paypal payment screen as shown in the following screen.

 

Paypal Payment 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.

 

Paypal Payment Review

 

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.

 

Paypal Payment Success

 

Paypal Payment Return URL

 

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.

You may have browsed many websites and spent hours to find the informaion provided in this tutorial. So take 1 minute to share this post to help others find it quickly. Thank You for visiting InnovativePHP.

 

Popular Posts
Recent Posts

 

2 Responses to “Learning Paypal Payment Flow Using Buy Now Buttons”

  1. veg mocking party Says:

    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!

  2. sore throat Says:

    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

Follow Us On Facebook

Page optimized by WP Minify WordPress Plugin