Home arrow PHP arrow 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.

  1. Creating a PHP PayPal Instant Payment Notification Script
  2. Adding a Bank and Credit Card
By: Codex-M
Rating: starstarstarstarstar / 7
January 10, 2011

print this article



This article assumes you are implementing the PayPal website payments standard: https://www.paypal.com/cgi-bin/webscr?cmd=_wp-standard-feature-list-outside. If you are implementing common PayPal buttons for selling the products on your website, such as "Buy Now" and "Pay Now," then you are implementing the website payments standard.

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.

To open a PayPal Sandbox account:

  1. Go to https://developer.paypal.com/.

  2. Click "Sign Up Now."

  3. Follow the registration procedures. You will be asked to confirm your PayPal Sandbox account using the email address you have provided.

  4. Once your account is active, you can log in at https://developer.paypal.com/.

  5. 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.

>>> More PHP Articles          >>> More By Codex-M

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: