HomePHP Creating a PHP PayPal Instant Payment Notification Script
Creating a PHP PayPal Instant Payment Notification Script
This is an important tutorial on the use of PHP in the implementation of PayPal IPN (Instant Payment notification) system on your website. There are many advantages to using this system on your site. If you're ready to put the power of PayPal to work for you, keep reading.
This is a beginner-level tutorial for those websites business owners looking forward to implementing PayPal IPN along with the website payments standard. This is the first part of the tutorial series. It prepares the developer with the tools needed for the IPN implementation, as well as necessary theory, flow and guides for implementation success.
The rest of the tutorial series will focus on secure button creation, IPN database management and the PHP script in detail.
The Basic Requirement: PayPal Sandbox Account
This tutorial assumes you are a website owner with an active and verified PayPal business account. To confirm, log in to your PayPal account. Under your name at the dashboard, you should see information regarding your "Account type" ("Business," for example) and "status" (such as "verified").
However, developing and testing your PHP web applications to handle IPN processing is best done in the PayPal Sandbox.
The PayPal Sandbox is a simulation environment for PayPal sellers and buyers. It lets the developer test the PHP script without involving real money. The buyer/seller account information, as well as the money in the PayPal Sandbox, are fictitious.
Once the PayPal IPN PHP application is fully working under the PayPal Sandbox testing platform, it can be migrated very easily to an actual PayPal environment, and should work the same.
You then need to add a fictitious buyer and seller, which you will use to test your PHP scripts. Click "Preconfigured account" under "Test Accounts."
Suppose you create a buyer test account. You can configure the following:
Country = United States (if you want the test buyer to be located in the US).
Account type = "Buyer"
Login email = PayPal sandbox will provide one; you do not need to change this.
Password = PayPal sandbox will provide a default password (in numbers). You will not need to change it. But keep a copy of it in different location, such as a password management system like KeePass: http://keepass.info/
Under "Add Credit Card," you can use "Visa" if you are testing Visa credit cards.
You can also put "Yes" under "Add Bank account."
Finally, under "Account balance," make it big enough to make big purchases (if you are selling expensive products, for example). It should fall between $0 and $9999.
Finally, click the "Create Account" button. It will create an account like the one below:
Take note of the generated login email and the password you have kept earlier. You will be using those to log in to the Sandbox test site.