How to perform a server to server request with Paypal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have searched and searched through the Paypal documentation, but didn't find the solution ... however, I believe it is a common task.
On my website people can buy an e-book. They click the 'Buy now' button with a hidden unique ID, successfully pays the amount, and auto return to my website. However, I need to find a way where the unique ID will be send from Paypal back to my server using a different (secret) URL after a successful payment, so I can update my database and automatically send an e-mail to the buyer with their e-book.
Does anybody know the solution to this at Paypal?
Best regards,
Christophe

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, have a look at PayPal Instant Payment Notifications to receive a server-to-server notification from PayPal which you can subsequently verify and use to update your database / send out your custom email.
IPN works as follows:
- You create the PayPal and incude a "notify_url". The value for this parameter will be the full URL to a script on your server, called the 'IPN script' or 'IPN handler'.
You can specify an IPN handler as follows for Website Payments Standard
<input type="hidden" name="notify_url" value="http://yourdomain.com/ipn.php
For Express Checkout or Website Payments Pro, simply include the following in your SetExpressCheckout/DoExpressCheckoutPayment or DoDirectPayment API call respectively. NOTIFYURL=http://yourdomain.com/ipn.php
Next:
- A buyer completes a transaction via PayPal
- Once the buyer completes the transaction, he/she may close the browser, or return to your website. It doesn't matter.
- Once the transaction is accepted and processed by PayPal, PayPal will send out a notification to http://yourdomain.com/ipn.php
- You need to take all POST data that was sent to this script, and POST it back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate
- If the data you send back matches the data PayPal sent you, a 'VERIFIED' response is returned.
- If the response is VERIFIED, it's at this point that you would look up the matching transaction/buyer on your end, and update the phpBB thread status appropriately.
Some sample code and documentation for PayPal IPN is available at https://www.paypal.com/ipn/
In addition, some tips on making a secure IPN script are available at https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant-payment-notification...
Note: If you want to include any custom data along with the transaction which you can read out later, use 'custom'.
<input type="hidden" name="custom" value="xxxxx">
This will also be returned in the IPN POST data sent from PayPal.
Should you run into any issues while implementing IPN, support is available via https://www.paypal.com/mts/
For technical assistance with PayPal merchant product offerings, please file a ticket at https://www.paypal.com/mts/

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Invalid sdk meta in Merchant services (Archive)
- Select Shipping or Delivery in Shipping (Archive)
- Refunding and balance issues in Reporting and tracking (Archive)
- Church with NO tax-exempt certificate in Merchant services (Archive)
- Multi-Order Shipping MOS can not import Item # Title N/A from non-ebay transaction. in Shipping (Archive)