PayPal/IPN
Overview
Instant Payment Notification (IPN) is one of two methods by which a web site may retrieve payment information from PayPal in real-time, i.e. immediately after a payment is completed. The other method is Payment Data Transfer (PDT).
IPN is somewhat more reliable than PDT in that PayPal's server contacts the merchant's server directly to transmit transaction data as soon as the transaction has occurred, rather than depending on the customer's browser to convey the data.
This page is a seed article. You can help HTYP water it: make a request to expand a given page and/or donate to help give us more writing-hours!
|
Example
Sample data passed back to the merchant's server using IPN (using the PayPal Sandbox, not a real transaction), as collected by SpecialLogPost:
HTML form code
<xml> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="14406"> <input type="hidden" name="custom" value="UserNameWouldGoHere"> <input type="hidden" name="invoice" value="InvoiceFieldGoesHere"> <input type="hidden" name="notify_url" value="http://wiki.vbz.net/Special:LogPost"> <input type="hidden" name="return" value="http://test.vbz.net/cgi-bin/runpl"> <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif"
border="0" name="submit" alt="">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </xml>
IPN POSTed data
2009-01-01 21:58:16 REQUEST_METHOD POST HTTP_USER_AGENT REMOTE_ADDR 216.113.191.33 transaction_subject payment_date 18:58:14 Jan 01, 2009 PST txn_type subscr_payment subscr_id S-5G6357170N2927728 last_name User residence_country US item_name Full Site Access - one year payment_gross 49.00 mc_currency USD business paypal_1230320215_biz@hypertwins.org payment_type instant protection_eligibility Ineligible verify_sign AxvQhTcd4JBdIIpB5MztE755SMD7AMz0sJLKKvdDiqzSP8TKRFoLHttM payer_status verified test_ipn 1 payer_email paypal_1230659178_per@hypertwins.org txn_id 17R310755W630331M receiver_email paypal_1230320215_biz@hypertwins.org first_name Test invoice InvoiceFieldGoesHere payer_id 9AAMA7CUQ8TUN receiver_id YCRD6GWFSUZ5L payment_status Completed payment_fee 1.72 mc_fee 1.72 btn_id 14406 mc_gross 49.00 charset windows-1252 notify_version 2.6 2009-01-01 21:58:16 REQUEST_METHOD POST HTTP_USER_AGENT REMOTE_ADDR 216.113.191.33 txn_type subscr_signup subscr_id S-5G6357170N2927728 last_name User residence_country US mc_currency USD item_name Full Site Access - one year business paypal_1230320215_biz@hypertwins.org amount3 49.00 recurring 1 verify_sign AdXmlE88KERMphmdMG4e.jeWGlkRAcUYzJVdMfWdteAAmuWxx9bpnguV payer_status verified test_ipn 1 payer_email paypal_1230659178_per@hypertwins.org first_name Test receiver_email paypal_1230320215_biz@hypertwins.org payer_id 9AAMA7CUQ8TUN invoice InvoiceFieldGoesHere reattempt 1 subscr_date 18:58:12 Jan 01, 2009 PST btn_id 14406 charset windows-1252 notify_version 2.6 period3 1 Y mc_amount3 49.00
Note that IPN returns the invoice data but not the custom data.