PayPal IPN

Top  Previous  Next

 

PAYPAL IPN

 

s5logoipn

 

Items

1. What is the PayPal IPN service?

2. What is the PayPal Sandbox?

3. Using IPN with the OLM from a Delphi application

 

What is the PayPal IPN service?

 

The PayPal IPN (Instant Payment Notification) is a message service that notifies the events associated with a PayPal transaction. This notification is sent to an URL specified for you, called "The Listener" which is responsible for processing transactions achieved in your PayPal account. At this way, when a transaction is processed  (e.g. a payment to your account), your URL instantly will receive all related information with this operation.

 

There are two ways to specify the URL listener in order to inform to PayPal where should be send the IPN messages.

   

1. Select Instant Payment Notification into your account profile, then specify the URL listener  and check [x]Activate it.

 

2. Dinamically, including the URL listener together with each payment request, e.g. from a [Pay Now] button.

 

In our example we use the second option, specifying the URL Listener together with the  payment request.

 

For more information download the IPN Guide from this link: https://cms.paypal.com/cms_content/US/en_US/files/developer/IPNGuide.pdf

 

What is the PayPal Sandbox?

 

When the listener is being implemented, which in our case is a php script (ipn.php), it is necessary to test and debug it like any other piece of software, and these tests can not be done using our real PayPal account (PayPal Live ). To that end, PayPal has a separate place is called the sandbox, where you can test using fictitious accounts.

 

o create fictitious accounts must first create an account on the PayPal Sandbox. This is the link where you can do it:

https://developer.paypal.com

Create your account using a different email address than your actual PayPal account. Once you have created your account click "Test Accounts"

 

sandboz01

 

Then create at least two accounts, one to simulate the venderdor and one for the buyer. The vendor must be a Busines account, and the buyer a Personal account. See an example in the image below:

 

sandboz02

 

 

You can learn more by downloading the Sandbox User Guide from the following link:

https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_Sandbox_UserGuide.pdf

 

Using IPN with the OLM from a Delphi application

 

ipnlogo1

 

 

The idea is to put a button [Pay Now] in the registration form of the application that when clicked by the user it is redirected to the PayPal site for payment. Once finished the payment, PayPal automatically sends an Instant Message to your Listener with all information related to the payment. Our Listener is the ipn.php script and this should be located into the OLM folder on our site. Then ipn.php verifies the information received and modify  the corresponding record (Paid = Y) if the operation has been "Completed" or putting (Paid = P) if the status is "Pending".

 

Some few seconds after the payment, the user can click on the button [Activate] to activate the application. We see that this method is fully automatic, no need to send the installcode to the developer then wait for the  registration key. The user simply makes the payment and has its registered application ready to use. In addition, ipn.php will send an email to you with all relevant information.  In the case of having the status "Pending", you should check the transaction in your PayPal account, then when the transaction is completed you should go to the OLM control panel and edit the corresponding record setting (Paid = Y) in order to allow to the user activate the application with the [Activate] button.

Most normal PayPal payments haves the status "Completed", but using the Sandbox can be the opposite, the most with the status "Pending". See implemented it in the example4.