Notice of non-liability:
PayPal, Inc. is providing the information in this document to you “AS-IS” with all faults. PayPal, Inc. makes no warranties of any kind (whether express,
implied or statutory) with respect to the information contained herein. PayPal, Inc. assumes no liability for damages (whether direct or indirect), caused
by errors or omissions, or resulting from the use of this document or the information contained in this document or resulting from the application or use
of the product or service described herein. PayPal, Inc. reserves the right to make changes to any information herein without further notice.
This document describes the Instant Payment Notification (IPN) message service.
Intended Audience
This document is intended for merchants implementing IPN.
Revision History
Revision history for Instant Payment Notification Guide.
TABLE P.1 Revision History
DateDescription
06/26/09Added information about IPN messages related to payment review. Updated the
section about setting up IPN notifications on PayPal and added a note about the
delivery of IPN messages to the notify URL.
06/10/09Added IPN history and resend information and added information to the
troubleshooting section.
03/16/09Made additions to sample code.
02/16/09First draft.
IPN GuideJune, 20095
Revision History
6June, 2009IPN Guide
1
Instant Payment Notification (IPN) is a message service that notifies you of events related to
PayPal transactions. You can use it to automate back-office and administrative functions, such
as fulfilling orders, tracking customers, and providing status and other information related to a
transaction.
z What is IPN?
z IPN Protocol and Architecture
z A Sample IPN Message and Response
z Non-IPN Notification Mechanisms
What is IPN?
IPN notifies you when an event occurs that affects a transaction. Typically, these events
represent various kinds of payments; however, the events may also represent authorizations,
Fraud Management Filter actions and other actions, such as refunds, disputes, and
chargebacks.
Introducing IPN
IPN is a message service that PayPal uses to notify you about events. These events include the
following:
z Instant payments, including Express Checkout and direct credit card payments
z eCheck payments and associated status, such as pending, completed, or denied
z Payments that may be pending for other reasons, such as those being reviewed for potential
fraud
z Events related to recurring payments and subscriptions
z Authorizations, which indicate a sale whose payment has not yet been collected
z Chargebacks, which are initiated by a credit card processor; for example, when a customer
disputes a charge
z Disputes, which are initiated by a buyer using the PayPal resolution process
z Reversals, which occur when you win a dispute or a chargeback is canceled
z Refunds, which you may choose to give
In many cases, the action that causes the event, such as a payment, occurs on your website;
however, your website is not the only source of events. In many cases, events can be generated
by Website Payment Standard buttons, the PayPal API, or by PayPal itself.
You detect and process IPN messages with a listener, sometimes called a handler, which is a
script or program that you write. It waits for messages and passes them to various back-end or
IPN GuideJune, 20097
Introducing IPN
What is IPN?
administrative processes that respond the messages. PayPal provides sample code that you can
modify to implement a listener that detects IPN messages.
The actions to take when your listener is notified of an event are specific to your needs.
Examples of the kinds of actions you might take when your listener receives an IPN message
include the following:
z Trigger order fulfillment or enable media downloads when a check clears or a payment is
made
z Update your list of customers
z Update accounting records
z Create specialized “to do” lists based on the kind of event
You are typically notified of events by email as well, but the IPN message service enables you
to automate your response to events. The following diagram shows how events can occur and
how PayPal responds with IPN messages that it sends to your listener:
The diagram shows requests and responses, which are the result of processing button clicks or
API operations on PayPal. PayPal sends an IPN message when it sends a response to a request.
8June, 2009IPN Guide
Introducing IPN
IPN Protocol and Architecture
The IPN message is not actually part of the response sent to your website. Rather, the IPN
message is sent to the your listener, which allows you to take actions that are not directly tied
to the operation of your website.
NOTE: The diagram does not show the IPN authentication protocol messages that validate the
IPN message.
IPN is an asynchronous message service, meaning that messages are not synchronized with
actions on your website. Thus, listening for an IPN message does not increase the time it takes
to complete a transaction on your website.
The IPN message service does not assume that all messages will be received by your listener
in a timely manner. Because the internet is not 100% reliable, messages can become lost or
delayed. To handle the possibility of transmission and receipt delays or failures, the IPN
message service implements a retry mechanism that resends messages at various intervals
until you acknowledge that the message has successfully been received. Messages may be
resent for up to four days after the original message.
NOTE: Unless you are certain that a failure occurred on the the Internet, the most likely cause
of lost, delayed, or duplicate IPN messages is faulty logic in the listener itself.
Because messages can be delivered at any time, your listener must always be available to
receive and process messages; however, the retry mechanism also handles the possibility that
your listener could become swamped or stop responding.
The IPN message service should not be considered a real-time service. Your checkout flow
should not wait on an IPN message before it is allowed to complete. If your website waits for
an IPN message, checkout processing may be delayed due to system load and become more
complicated because of the possibility of retries.
IPN Protocol and Architecture
IPN is designed to be secure, reliable, and asynchronous. To meet these requirements, the
protocol requires you to acknowledge receipt of IPN messages. The IPN service provides a
retry mechanism to handle cases in which a message is not acknowledged; for example, when
a transmission or receipt failure occurs.
When you enable IPN, PayPal sends messages to the IPN listener at the URL you specify in
your account’s profile. You can override the URL to associate other IPN listeners with specific
transactions. In this case, you specify the listener’s URL when you set up a Website Payment
Standard button or a PayPal API operation.
The IPN protocol consists of three steps:
1. PayPal sends your IPN listener a message that notifies you of the event
2. Your listener sends the complete unaltered message back to PayPal; the message must
contain the same fields in the same order and be encoded in the same way as the original
message
IPN GuideJune, 20099
Introducing IPN
IPN Protocol and Architecture
3. PayPal sends a single word back, which is either VERIFIED if the message originated with
PayPal or INVALID if there is any discrepancy with what was originally sent
Your listener must respond to each message, whether or not you intend to do anything with it.
If you do not respond, PayPal assumes that the message was not received and resends the
message. PayPal continues to resend the message periodically until your listener sends the
correct message back, although the interval between resent messages increases each time. The
message can be resent for up to four days.
This resend algorithm can lead to situations in which PayPal resends the IPN message while
you are sending back the original message. In this case, you should send your response again,
to cover the possibility that PayPal did not actually receive your response the first time. You
should also ensure that you do not process the transaction associated with the message twice.
IMPORTANT:PayPal expects to receive a response to an IPN message within 30 seconds.
After PayPal verifies the message, there are additional checks that your listener or back-end or
administrative software must take:
Your listener should not perform time-consuming operations, such as creating
a process, before responding to the IPN message.
z Verify that you are the intended recipient of the IPN message by checking the email address
in the message; this handles a situation where another merchant could accidentally or
intentionally attempt to use your listener.
z Avoid duplicate IPN messages. Check that you have not already processed the transaction
identified by the transaction ID returned in the IPN message. You may need to store
transaction IDs returned by IPN messages in a file or database so that you can check for
duplicates. If the transaction ID sent by PayPal is a duplicate, you should not process it
again.
z Because IPN messages can be sent at various stages in a transaction’s progress, make sure
that the transaction’s payment status is “completed” before enabling shipment of
merchandise or allowing the download of digital media.
z Verify that the payment amount actually matches what you intend to charge. Although not
technically an IPN issue, if you do not encrypt buttons, it is possible for someone to capture
the original transmission and change the price. Without this check, you could accept a
lesser payment than what you expected.
IPN Messages Generated by Website Payments Standard
PayPal generates an IPN message when your customer clicks a Website Payments Standard
payment button, such as a Buy Now button, and completes the transaction on PayPal. You can
use this notification to kick-off order fulfillment, enable digital media downloads, store
information in a customer relationship management (CRM) or accounting system, and so on.
The following diagram shows both the web flow and the IPN message authentication protocol:
10June, 2009IPN Guide
The numbers in diagram correspond to the following steps:
Introducing IPN
IPN Protocol and Architecture
1. The button action initiates a payment that completes on PayPal
2. PayPal sends your IPN listener a message that notifies you of the event
3. Your listener sends the complete unaltered message back to PayPal; the message must
contain the same fields in the same order and be encoded in the same way as the original
message
4. PayPal sends a single word back, which is either VERIFIED if the message originated with
PayPal or INVALID if there is any discrepancy with what was originally sent
Your IPN listener must implement the IPN authentication protocol (steps 2, 3, and 4 in this
diagram). After successfully completing the protocol, your back-office or administrative
process vets the contents of the message and responds appropriately. For example, if the
payment status for the transaction is “Completed,” your system can print a packing list or
email a password to your customer for downloading digital media.
IPN Messages Generated by PayPal APIs
PayPal generates an IPN message when you invoke an API operation, such as
DoExpressCheckoutPayment of DoDirectPayment during checkout. You can use this
notification to kick-off order fulfillment, enable digital media downloads, store information in
a customer relationship management (CRM) or accounting system, and so on.
The following diagram shows both the web flow and the IPN message authentication protocol:
IPN GuideJune, 200911
Introducing IPN
IPN Protocol and Architecture
The numbers in diagram correspond to the following steps:
1. The API operation initiates a payment on PayPal.
2. PayPal sends your IPN listener a message that notifies you of the event
3. Your listener sends the complete unaltered message back to PayPal; the message must
contain the same fields in the same order and be encoded in the same way as the original
message
4. PayPal sends a single word back, which is either VERIFIED if the message originated with
PayPal or INVALID if there is any discrepancy with what was originally sent
Your IPN listener must implement the IPN authentication protocol (steps 2, 3, and 4 in this
diagram). After successfully completing the protocol, your back-office or administrative
process vets the contents of the message and responds appropriately. For example, if the
payment status for the transaction is “Completed,” your system can print a packing list or
email a password to your customer for downloading digital media.
IPN Messages Generated by a Back-Office Procedure
PayPal generates an IPN message when you perform actions that invoke the PayPal API,
regardless of whether it is from your website or from a back-office or administrative
procedure. You can use this notification to trigger an email to your customer, store information
in a CRM or accounting system, and so on.
The following diagram shows both an administrative web flow and the IPN message
authentication protocol:
12June, 2009IPN Guide
The numbers in diagram correspond to the following steps:
Introducing IPN
IPN Protocol and Architecture
1. Your back-office or administrative process invokes a PayPal API operation; for example, it
could invoke the RefundTransaction API operation when your employee issues a
refund.
2. PayPal sends your IPN listener a message that notifies you of the event
3. Your listener sends the complete unaltered message back to PayPal; the message must
contain the same fields in the same order and be encoded in the same way as the original
message
4. PayPal sends a single word back, which is either VERIFIED if the message originated with
PayPal or INVALID if there is any discrepancy with what was originally sent
Your IPN listener implements the IPN authentication protocol (steps 2, 3, and 4 in this
diagram). After successfully completing the protocol, your listener or back-office or
administrative process vets the contents of the message and responds appropriately. For
example, your system can notify the customer of the refund by email.
IPN Messages Generated by PayPal
Some IPN messages generated by PayPal are not directly associated with a web flow. PayPal
generates an IPN message when external events arise that might affect a transaction, such as
disputes, chargebacks, echeck clearing, and various recurring payment and subscription
events.
In this case, events that trigger IPN messages are not directly related to actions on your
website. The following diagram shows the steps your listener must take:
IPN GuideJune, 200913
Introducing IPN
A Sample IPN Message and Response
The numbers in diagram correspond to the following steps, which implement the IPN message
authentication protocol:
1. PayPal sends your IPN listener a message that notifies you of the event
2. Your listener sends the complete unaltered message back to PayPal; the message must
contain the same fields in the same order and be encoded in the same way as the original
message
3. PayPal sends a single word back, which is either VERIFIED if the message originated with
PayPal or INVALID if there is any discrepancy with what was originally sent
After successfully completing the protocol, your back-office or administrative process vets the
contents of the message and responds appropriately. For example, the IPN messages may
trigger you to print shipping labels for items whose payments have cleared, investigate
disputes and chargebacks, store information in an accounting system, and so on.
A Sample IPN Message and Response
An IPN message consists of variables that describe the transaction. These variables contain
information about you, your customer, and the details of the transaction itself.
PayPal sends a message, similar to the following one, for a $19.95 purchase made by Express
Checkout:
Before you can trust the contents of the message, you must first verify that the message came
from PayPal. To verify the message, you must send back the contents in the exact order they
were received and precede it with the command _notify-validate, as follows:
PayPal will then send one single-word message, VERIFIED, if the message is valid; otherwise,
it will send another single-word message, INVALID.
IMPORTANT:After you receive the VERIFIED message, there are several important checks
you must perform before you can assume that the message is legitimate and
not already processed:
Confirm that the payment status is Completed.
Use the transaction ID to verify that the transaction has not already been
processed, which prevents duplicate transactions from being processed.
Validate that the receiver’s email address is registered to you.
Verify that the price, item description, and so on, match the transaction on
your website.
Non-IPN Notification Mechanisms
You can use IPN with other notification mechanisms. For example, you can use PDT or the
API to determine real-time information about a transaction and let IPN notify you of any
changes after the transaction occurs.
Introducing IPN
Non-IPN Notification Mechanisms
If you are using Website Payments Standard, you can use PDT to obtain information about the
transaction. If you are using Express Checkout or Direct Payment, the PayPal API notifies you
of the status and details of the transaction immediately and automatically. In either case, you
can immediately display to your customer the information being returned from PayPal. You
should not use IPN for this purpose.
IPN GuideJune, 200917
Introducing IPN
Non-IPN Notification Mechanisms
18June, 2009IPN Guide
Loading...
+ 42 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.