LASTPAYMENTDATE is often not present in GetRecurringPaymentsProfileDetails API Operation (NVP) - paypal

I've been testing some calls to GetRecurringPaymentsProfileDetails, and am trying to understand the behaviour of LASTPAYMENTDATE. I require this field because I want to differentiate between times where no payment has yet to be made and one has.
There seems to be some odd behaviour, though. I cancelled a payment profile, which happened successfully, and then called GetRecurringPaymentsProfileDetails, but no LASTPAYMENTDATE was present. I called it again and received a 500, and then again and LASTPAYMENTDATE was present. Each call after that (for this particular profile) has not returned any LASTPAYMENTDATE (although the payment is visible in the merchant account if I log in to the UI).
I think I'm going to switch to using the NUMCYCLESCOMPLETED field for my purpose instead, but any ideas why I'm seeing strange behaviour for LASTPAYMENTDATE? Is it a bug? Anyone else noticed this?
Many thanks.
Update: The same profile is now returning LASTPAYMENTDATE.
Update: It's stopped coming back again.

Related

Can you generate new PayPal IPNs for past (IPN-less) transactions?

So I'm working with a system that uses the legacy NVP/IPN thing from PayPal. The IPN listener URL wasn't set up properly and so they ran a couple weeks worth of transactions with no IPN data coming back. I've set it up properly now, but I'm wondering if there is a way to regenerate that last couple weeks that never had any. Whenever I go to the IPN history page, I just get a this feature is not available message. I know it's now working because I can see three transactions in our database (that come through the IPN listener)
On another note, if I go to the download history page and try to click download, the page refreshes but nothing happens. I don't get a report or anything, any idea why?
It sounds as though you're looking for the IPN history page, where you can resend IPNs: https://www.paypal.com/us/cgi-bin/webscr?cmd=_display-ipns-history
Late edit: changed title to better reflect the true question (it's not about regenerating IPNs). And the answer is it's not possible. Instead, for past IPN-less activity one must manually import a CSV obtained from www.paypal.com account home -> Reports -> Activity Download
This is the URL: https://business.paypal.com/merchantdata/reportHome
If once in the Activity Download, "Create Report" does not work properly (e.g. "nothing happens"), contact PayPal's support for assistance as that is not normal.

Paypal IPN Simulator (Different Sites, different results)

This is leading me into confusion only. After reading Paypal's documentation for Paypal IPN, I know how to get to the Simulator page and trigger an IPN test. Reading throughout PP's documentation, the page I am lead to is:
https://developer.paypal.com/developer/ipnSimulator/
Now, on my server side, I have used one of PP's Listenter example file in which I've implemented my own class to log everything I need into text files, and, I know that my IPN Listener is up, running and receiving requests from the IPN Simulator because I can see it all beeing logged.
Now the intriguing part is that, as I said before, i'm lead to the aforementioned page, which triggers an INVALID response from Paypal every single time I simulate a payment. Afters dozens of forums read, including SO, I have seen some people using https://developer.paypal.com/webapps/developer/applications/ipn_simulator instead of the former one.
If I use this latter URL, the simulation works without a hitch and I get the "VERIFIED" response, everytime. At this point, the question I cannot answer is "Why?". Why does this only works on the latter URL, and not on the URL that I am redirected to from within my paypal account, which is the one I think it was supposed to work from? And this constitutes by itself another problem. I cannot access this latter URL from anywhere within my paypal account, unless I manually enter it. You may question how did I get to this second URL. Well, I got it from other people's posts, otherwise I didn't even know it existed. So, right now I am completly lost and with this said,
Is there anyone that can explain me the difference from both URLs, and why is the second one not available inside my PP account?
If you can also explain me why the simulation works from the second URL only, that would be a bonus
NOTE: By the way, I've tried it and I know that in Live mode it works also, and I get the VERIFIED response.

Does paypal changes the order of POST fields in every IPN notification?

I read that I need to send a confirmation to paypal with the fields in the same order plus the cmd=_notify-validate field. I know that for certains event the fields will be different, but for example for a notification of paid using paypal buttons, will the params will always be in the same order?
Due some limitations I can't get the whole POST fields array (I can only get them by explicitely calling the key) so an option is to set each field in the confirmation request to paypal.
Whether it's always the same order is irrelevant. You're supposed to send them back in the same order they arrived in, whatever that was.
BUT I don't believe that observing the same order in the validation request is necessary, and in some languages, e.g. Java, it isn't even possible, as the order isn't preserved. I've been running IPN for several years without observing this constraint, and I've only ever had one validation failure, from Turkey, which remains unexplained but could have been say a character set issue.
Note that PayPal provide sample code for Java somewhere which therefore doesn't observe the constraint either. One assumes it was tested and passed a review ...

Unable to get a valid IPN postback with django-paypal

After spending several hours trying to get django-paypal (originally dcramer's fork) to get a 200 OK response from PayPal IPN, I pinpointed the error to PayPal adding an empty, spurious &cmd= argument when using the IPN Simulator. If I leave the &cmd= in, I get a 400 Bad Request response when I try to postback; if I take it out I get a 200 OK but, of course, the postback is invalid because it's not what PayPal sent my server.
Of course, I'd be absolutely happy to do away with the IPN Simulator entirely and simply use Sandbox accounts, but those are broken too: the ones I create through the developer interface can't login (login failed errors); the ones I created through the "regular" interface on the sandbox site don't send any IPN whatsoever no matter what.
So, actually there's two questions here:
is there a way to work around the IPN Simulator &cmd= bug?
is there a way to make the sandbox accounts work?
A reply to either one would make me very very happy.
Many of the issues you've experienced are now cleared up. The IPN issue and some developer/sandbox log in issues have been cleared up as of Monday evening. If you are still experiencing any issues please let me know and I'll be more than willing to look into this further.

paypal ipn notification twice

My notification script is launched twice first is VERIFIED and second INVALID.
I've tried different ipn validation scripts and always get it twice.
I'm using sandbox maybe seller account settings are not right? I've set IPN on with notify url and auto return. Also in form there is return and notify_url set
I remember in the documentation it states that duplicates are possible -- that's just the nature of the internet. That's why it gives you a unique transaction ID. You're supposed to use that to prevent bad things from happening if you get notified twice.
A better question might be: why does it say Verified and then Invalid? Or is that ok?
EDIT
The docs say "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". I'm going to guess that YOUR code accidentally sends the "echo" back to PayPak twice and one of them is malformed. Maybe they're both identical but PayPal responds with INVALID if it gets it twice. But no matter, for a particular transaction Id, once you get VERIFIED, you're good. Simply ignore all subsequent responses.
EDIT 2
The return url is simply used by PayPal to redirect the user back to your site. Use this page to thank them for their purchase and inform them they will be notified once processing is complete. You can even set this to an empty string if you don't want this feature. When Payment is actually complete (or some problem was identified), PayPal will invoke the script referenced by the notify url. This is where you make sure everything looks right, handle duplicate notifications, update your database, send an email to the user saying their payment was processed, etc.
before inserting or updating your mysql query Check if the returned Transaction id '$_POST['txn_id']' already exists in your db table, if it doesnt exists so insert it with other $_POST data, because paypal calls the notify url many times.