Click here to Skip to main content
13,092,725 members (65,288 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to integrate PayPal Adaptive Payments into my localhost project. Until now I have managed to perform the paying process. However I need to receive a success response once the payment has been completed in order to update my database.

I have come across the returnURL property, however this is not secure for my implementation since the user can just terminate the session before redirecting the the returnURL and thus the database woould not get updated.

I have also come across the ipnNotificationUrl however I did not manage to make it work. If this is the right way to achieve this goal what needs to be configured in the coding itself, the Web.config, the PayPal sandbox account, or any other configuration.

What is the best practice to achieve this goal?
Posted 4-Apr-13 3:58am
Updated 4-Apr-13 3:59am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.

Only get such code from Paypal - the scope for fraud otherwise is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

IPN is the correct way to go. Once the payment is processed Paypal will generate IPN whether it is success or fail. You can specify a url to your web application (not localhost, because paypal cannot access your localhost url. you need to host your application somewhere to test this). and paypal will call that url once the payment is processed. There is a IPN testing tools in the developer sandbox. you can generate as many IPNs you want until everything is working fine. but you need to host your application or implement some kind of dynamic DNS provider to your machine (so that people outside your network can access your url).

Few tips on receiving IPN.

- Check if the request host is before even start processing (this is very easy to check from server variables of the request).

- IPN will have a lot of information regarding your payment, it always a good idea to store everything in your database (this will come handy in case of dispute).

- Mark the order processed only after receiving IPN, until then mark it 'Pending'.

- Receiving IPN doesn't mean that the payment is successful, check the status in the response.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Rutvik Dave is there another way without using IPN since I have to work locally for the moment?
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

I have found a possible work around to avoid using the

The lightbox feature. Take a look at the following link Introducing Adaptive Payments While using the lightbox feature, the
seems to be always called.

The returnURL was constructed as follows:
public const string PayPal_URL_Return = YourReturnURL + "/${payKey}";

is automatically filled in by PayPal itself Using such information one may call the PaymentDetails using the PayPal Adpative Payments, and use the transaction details accordingly.

For information regarding the PayPal Adaptive Payments visit AdaptivePaymentsSampleApp. The file adaptivepaymentshandler.ashx.cs contains nearly all the necessary details, together with the Web.config file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 5 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100