Today i am going to show you, How to integrate PayPal payment gateway in your website using php. In this article, i will show you step by step flow of PayPal payment gateway integration using very popular and excellent web development language PHP. If you do not know PHP web development language then please learn first PHP web development language before reading this article, How to setup PayPal payment gateway integration using PHP.
What you need to learn PHP PayPal payment gateway integration.
First of all, i am going to introduce your requirement of the resources which will be require.
1. A working domain / sub domain / web address to access web page.
2. A working web server which pointed to web address.
3. Working internet connection.
4. Web browser, Mozilla Firefox is my recommendation.
5. PayPay account, Main account Not sandbox.
Let me start my steps to integrate PayPal payment gateway using PHP web development language.
Step 1 : Setup PayPal main account.
First of all, you need a main account of PayPal to test PayPal payment gateway using php web development language. so just go to http://paypal.com and create a account (Personal account). Just create a account using your personal details. You not need to enter bank, PAN etc details. It will be use to create sandbox seller and buyer accounts. For example, i have created email@example.com this is my main PayPal account email id. Have you done, Let go to step 2.
Step 2: Set up PayPal sandbox seller and buyer account.
Now we will create two test account one for seller and second one for buyer.
What is sandbox : Sandbox is the testing environment of PayPal. It words as real account but it is only for testing. All the balance, transaction etc will be for testing.
Let we create two PayPal sandbox account to make payment using these two seller and buyer account.
First of all open http://PayPal.com and login there using email id and password of main account. which we have created in step 1.
After that go to https://developer.paypal.com/webapps/developer/applications/accounts
This will be auto login using your main account details if not login using main account details such as using firstname.lastname@example.org and it’s password.
This is development environment of PayPal payment gateway integration.
Now, Click on “Create Account” and fill country and select a Account type Personal (buyer account), Business (merchant account). Let me explain what means Personal (buyer account) and Business (merchant account).
Select Business (merchant account) if this is seller account.
Select Personal (buyer account) if this is buyer account.
You need to create both account so first create a Business (merchant account) account and then Personal (buyer account) account.
In first time, suppose we are creating Business (merchant account) account then select Business (merchant account). then enter any email id and password. It will be use to login into sandbox seller account so please note down into a txt file.
Then fill First name, Last name, PayPal balance (1000$ recommend, will be use to make payment) etc which you like better but these does not matter. You only need to write down email id and password which you have filled.
Suppose i have create a Business (merchant account) with email id “email@example.com”. it will be use to get payment from testing website.
Same as Business (merchant account) create a Personal (buyer account) account. suppose i have create “firstname.lastname@example.org” It will be use it buy any product from testing website.
Now you have 3 account email id and password. Main account, seller account and buyer account.
You can login only using seller account or buyer account into https://www.sandbox.paypal.com/
Suppose, you are login as seller account into PayPal sandbox account then you can track transaction, received money etc. It will act like real seller account. same buyer account.
Step 3 : Build web page and make payment using buyer account.
In this step of PHP PayPal payment gateway integration, we will develop a web page into web server and make a payment.
Create a new php file and past
<form name=”_xclick” action=”https://www.sandbox.paypal.com/webscr” method=”post”>//paypal sandbox post url
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”business” value=”email@example.com”>//Paypal sandbox seller account email id
<input type=”hidden” name=”currency_code” value=”USD”>//enter your currency code
<input type=”hidden” name=”item_name” value=”reesu.org”>//enter the item name
<input type=”hidden” name=”return” value=”http://www.example.com/paypal/success.php”>//url to return once payment is done.
<input type=”hidden” name=”amount” value=”1″>//amount of transaction needs to be credited to your paypal account
<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!”>
Then access your web page using web address and click on buy. you will go to sandbox website. here login using your sandbox buyer email id and password and make payment.
Done you have setup PHP PayPal payment gateway integration.
Step 4 : Redirect url to success page from PayPal sandbox website.
Till yet, we have created 3 PayPal account with email id and password. We have developed a form to make payment. We have paid using PayPal buyer email id and password.
Now, After that we have to setup return url into PayPal sandbox seller account. To do so, Go to https://www.sandbox.paypal.com/ and login using seller account.
After that go to profile > my selling tools. after that click on “update” of “Website preferences“.
And set to ON of Auto return. and type return URL. And payment data transfer to ON and other all as per you need.
That is. Now after successfully payment done, you will redirect to inserted URL.
This is just simple PayPal payment gateway integration using PHP web development language. If you want more advanced PayPal payment gateway integration then browse web developer website of PayPal.
Now suppose, you want to send invoice id then add a input type and fill invoice id. you can pass any thing. This is just starter PayPal payment gateway integration.
There are many type of program to setup PayPal payment gateway using PHP web development language. Visit https://developer.paypal.com and https://github.com/paypal to learn all method of PayPal payment gateway integration using PHP.