Paypal PDT - unable to get transaction ID - paypal

After a customer pays from Paypal, he can be auto-redirected back to my website with auto-return and pdt features switched on. Everything works fine when the customer waits 10 seconds for the auto-redirect, transaction id is sent via a get, but when the customer chooses to "click here" instead of waiting for 10 seconds for the auto-redirect, the transaction id is not sent.
Anyone knows of a way to fix this?
Thanks!

First, are you just trying to display the transaction ID or are you trying to add it in a database or use it for email receipts, etc?
If you're simply trying to display it then PDT is fine. Otherwise, I'd highly recommend you use IPN instead. It's very similar except that the data will always be POSTed to it regardless of whether the user makes it back to your site or not, which isn't always guaranteed, even with Auto-Return enabled.
If PDT is all you need, it really should work the same regardless of how they make it back. I use PDT so rarely, though, that I really haven't tested it much lately. I'd have to run some tests in the sandbox to see if I can reproduce that and figure out how to make it work how you want.
Let me know, though, because if IPN is the better solution I don't want to waste time messing with PDT.

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.

Roadblocks with using PayPal Recurring Payment Subscription with ASP.Net Membership?

I'm using ASP.Net Membership Provider for logging into the premium content of this web site. The content isn't downloads, it's web pages of information and discounts, etc. That part is done. We want them to also have a PayPal Subscription annual payment to see the premium content. I would like ASP Membership and PayPal Subscription to work together as much as possible, but for the minimum I am thinking they will have to create a MemberId before they pay. Then I will send that MemberId to PayPal to associate the two.
I think I can do that like this:
Set "Auto Return" on in the interface so that it will redirect to return URL when payment is made.
Set "return URL" query string to MemberId. This requires not using the precompiled "Saved" buttons. I'll have to set it in Code Behind with Name Value Pairs, "NVP" to PayPal. I was hoping to just paste the stupid button.
But then, there were those "Advanced Variables" in the Button maker. Problem was they are compiled into the Saved button, so I can't change them for each person. But maybe that one parameter could be separate from the compiled parameters? Is this better than hacking the return URL? Are "Advanced Variables" good for anything?
All the details about the transaction will be POSTed to the return URL if I put in the right code, which might be rm=2. (Right?) Then I can record it.
This process is said to be unreliable, though, and PayPal recommends using a secondary system that they have, "IPN". PayPal sends the transaction details to me. I send them back http 200 code. Then I send it back to them in the same order I got it. Then they send me http 200. Then we all know it's good. This sounds like a few hours research to me, but if you've already done it once, it sounds like copy and paste. I hate reinventing the wheel. Is there a .Net sample of this IPN handshake/dance?
Also, if I do the IPN thing, maybe I don't need Auto Return. Maybe I add MemberId to "notify" URL instead of "return" URL. Then PayPal can handle the confirmation page, email, etc. Is that better?
Assuming we get the Subscription paid for and recorded with the MemberId, at least once per user session, after they log in, I have to check if they have paid their PayPal subscription and if it's up to date. "GetRecurringPaymentsProfileDetails" does this, but it is an API operation. That makes sense, but I was hoping to avoid learning their REST API. (Is there a "NVP" version?)
REST API OAUTH tokens expire every few minutes, but the only way it tells to get one is by using "Bash" to "cURL" some Linux commands. Again, this seems like the kind of thing that would only ever have to be written once. Does this already exist as a sample code somewhere?
(I don't want to use the API to do the Subscribe, because I don't want the Credit Card numbers to ever go to our site. Too much liability. That's why I wanted PayPal.)
Will this even work? I know PayPal has 18 ways to do everything and they all exclude each other, and I'm just getting the feeling that I'm creating a patchwork of unrelated ideas to fool myself into believing there's a light at the end of the tunnel. I've already been researching and experimenting for 10 hours or so. I really thought, going in, I'd just be pasting a stupid button.
If you want to just "copy the stupid button" then you'll have to stick to Payments Standard, and then you'll be limited with what you can do. For example, you won't be able to use GetRecurringPaymentsProfileDetails for a standard subscription.
Instead, you'll need to use Express Checkout and / or Payments Pro. There is indeed an NVP API available for these, and there is also a SOAP/XML version. Details on those can be found here: https://developer.paypal.com/docs/classic/api/
Specifically, for Express Checkout, you'll want SetExpressCheckout, GetExpressCheckoutDetails, DoExpressCheckoutPayment, and CreateRecurringPaymentsProfile. Some of those calls are optional depending on how exactly you're configuring things with the checkout flow.
For Payments Pro you'll use either DoDirectPayment / CreateRecurringPaymentsProfile or PayFlow depending on what version they put you on.
In any case, IPN is definitely the way to go for post-transaction processing.
.NET IPN Sample - https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.asp

paypal express checkout digital goods testing in sandbox

I used PayPal's Integration Wiz to generate the code (PHP) for the Express Checkout Digital Goods functionality. I'll admit, I made a few minor changes to it so that it could work with my site... My site is a single page Angular.js app - so I need to pass back parameters to the app, and not go back to a different page (as it is, I'm not keen on leaving the page at all, but I'm not ready to shell out for a business pro account yet.. the PCI compliance is something I don't relish being on the hook for...but maybe one day... certainly not until I know I can get "basic" things working).
I would not expect any of my changes (basically changing the hardcoded URLS to being PHP session vars) to interrupt any of the flow of the Integration Wiz's processing.
However, when I test things in the sanbox, the process stops at the point of redirection to:
https://www.sandbox.paypal.com/incontext?token={somevariabletokenconent}
The token always starts with "EC-" so I'm assuming this is telling me I've been able to successfully start the Express Checkout process.
All I am seeing is a blank page, with Chrome telling me I'm getting:
Failed to load resource: net::ERR_CONNECTION_RESET
AFAICT my sandbox account is set up for EC/DG:
Your payment solution: PayPal Digital Goods (Express Checkout)
I HAVE updated my sandbox details in paypalfunctions.php
And other than the changes in checkout.php, I havent messed with any other code from the integration wizard... should this not "just work" ??
Or have I missed something else?
[Edit]
Update a few hours later...
I actually was able to get things to progress end to end. Once. But no record of the transaction can be seen on either side of the sandbox accounts. It did sit thinking for a long time... so I'm not sure what it was doing, but the final redirect was back with a success parameter, so I have to think that something behind the scenes must be having issues...
But now its not working anymore. Its stopping in the same spot again.
For the life of me, I don't believe I made any code changes to the PP wiz produced code prior to it working, or prior to it not working again.
I have logged into the sandbox to check the transaction as I mentioned. Both accounts are showing nothing. And the transactions are not processing.
[EDIT 2]
Ok - strange things are afoot. I know I did absolutely no changes since my last test...I havent even been at the keyboard. And upon trying again, the test proceeds to allow me to log into the sandbox, and approve a payment, but gets stuck processing at
https://www.sandbox.paypal.com/webapps/checkout/webflow/sparta/expresscheckoutvalidatedataflow?execution=e1s2
with the PayPal "Loading" icon spinning...
Is this a configuration issue on my side? With the Integration Wiz writing all the Express Checkout code, there's not to change, but it seems really flakey to me.
[EDIT3]
I've been hanging my head on this for about a day now, and got nowhere. My App is a single page Angular.js site, and triggers the PayPal purchase out of a Bootstrap Modal popup window.
As mentioned above, my process would get to the point of approving and confirming payment, then spin wildly at the point it should be redirecting back to the success (or failure) page.
Using the PP integration Wiz, the form code that was produced (and used) was:
<form name='ppcheckout' action='checkout.php' METHOD='POST'>
And it fails to proceed to the final redirect.
However, if I change the code to:
<form name='ppcheckout' action='checkout.php' METHOD='POST' target="_blank">
The processing occurs as expected.
Is there some interaction between PayPal's JS and Angular (or Bootstrap) that I'm not aware of? It seems strange that it "just works" when the target is added.

Implementing PayPal discounts - what if the user cancels?

Alright, I got my Paypal shopping cart set up and working, now I'd like to be able to add discount coupons.
I know I can simply implement the 'discount_amount_cart' variable in my form, but I'm still a little lost when it comes to handling the deactivation of a coupon code.
Let's say A activates the code. Now in my database it will be marked as 'reserved', meaning no one else can use it. Once A completes his transaction, the IPN will mark the code as 'used' and it becomes useless.
But what if A decides to activate the code, but never actually buys anything on my website?
I'm using the $_SESSION variable to save my shopping cart, so once the user returns to my website, the code might still be shown as activated for him. When exactly would I mark it back as 'not reserved & not used' in my database?
I could do this based on time, but this doesn't really feel safe either. Let's say the user puts everything into his basket, goes to Paypal, waits for an hour and then decides to finish his checkout. The discount would still be activated, but in the meantime, it could've already been 'unreserved' in the database and used by another person!?
How would I go about this?
Thanks in advance!
IMHO, this has little to do with PayPal and more about your business rules. If your coupon is single use (globally), then you will be faced with the same issue regardless of any payment flow.
Simply putting it in "cart" and/or any event where a user "activates" said coupon, then just navigating elsewhere in your site, doesn't do anything, [whatever], creates that lag
it could be Paypal, Amazon, your own gateway - it really doesn't matter...but there will be a lag between activation and payment (beyond your control)
I think it's just best to be explicit with your customers and handle it appropriately technically (based on what that explicit messaging is).
You'll see some implementation of "timed purchase" at ticketing sites (e.g. buying a ticket to a game, movie, etc.) - they will have a "timer" for the user to do something (otherwise, the "reservation" is lost).
Hth...
Put an expiry date on coupon use - such as must be used within 10 days of activation. It gives the user urgency to use the coupon and gives you a timeframe to invalidate it.

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.