You'll have to use Paypal IPN for that. My site runs with Perl, but the way it basically works is as follows:
- Customer fills out an order form at my site with their name, address, email.
- Customer is being redirected to Paypal
- Upon successful payment via Paypal, Paypal calls my IPN-compliant script
- My script sends me an e-mail notifying me about the completed order
If the customer does not pay within 30 minutes or so, my database also sends him a reminder with a Paypal payment link for the respective order.
Follow these links also-
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdkshttp://www.spiderweblogic.com/Paypal-Integration-Code.aspx
Hope this will help you.