paypal express checkout digital goods testing in sandbox - paypal

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.

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.

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 Web Payment Pro hangs when order is submitted

Sometime last weekend our Opencart install, version 1.5.1.3 started to process duplicate orders for CC payments made through PayPal Website Payment Pro. It happens in the same order sometimes it will process twice. Sometimes 3 times.Payments made through Paypal Web Standard module is working fine.
I looked in the erros logs and about the same time this started happening, we started to get these php notices.
2013-04-23 3:44:01 - PHP Notice: Undefined index: customer_id in /var/www/vhosts/xxxxxxxxx.com/httpdocs/system/library/customer.php(170) : eval()'d code on line 4
2013-04-23 3:44:01 - PHP Notice: Undefined index: payment_address_id in /var/www/vhosts/xxxxxxxxx.com/httpdocs/system/library/customer.php(170) : eval()'d code on line 4
I don't know if they are related, but they started to crop up right at the same time. I went way back in the logs and did not see these anywhere else. Strange for this to pop up out of the blue the cart has been working fine, up until now.
I did a request of new API credentials from PayPal and reinstalled the web payments pro module in Opencart. This seemed to help initially, but we still had orders yesterday that came in as duplicate in the same order. We got a bit of feedback from some customers and it seems that that people are getting hung up on the "please wait..." part when they submit their order. We would get this initially from time to time, but all of a sudden it is much more frequent. The page submits the order, but then never returns the success page. Keeping customers from pressing the button again would help, so we put up a script that blocks the user from pressing the submit order button again.
Unfortunately it still doesn't solve the source of the issue, in that the communication between the site and the payment processor is getting hung up somewhere. I'm guessing paypal made some changes on their end to cause this issue, but any suggestions where I could look to get this corrected would be much appreciated. Thanks.

Every alternate Paypal IPN transaction is failing (HTTP code 400)

I have a weird issue with Paypal IPN. Every alternate transaction is failing. So let's say if first transactions goes well then second one fails. Similarly if 3rd one goes well then 4th one fails.
HTTP status code I am getting for failed transactions in IPN history is 400.
I have implemented the new Paypal host header changes that were newly introduced by them.
Any idea why this is happening?
IPN History
http://i.imgur.com/NfqRsGi.png
IPN Detail
http://i.imgur.com/hcKdasw.png
EDIT
I am using PHP with curl to do IPN work (using same sample code as available on Paypal website)
ANOTHER EDIT
Ok I found another code sample for PHP 5.2 from Paypal site. This one is slightly different than the one I am currently using. I tested it on Paypal Sandbox twice and it worked. Later on I will test it on live to see if it is working fine or not.
Error 400 = bad request, this means that the get requests being made on the application layer (by your browser) may contain errors or the transport layer (syn, syn, ack, syn) 3 way hand shack is being interrupted. I would check your PC for Mallware to be on the safe side. Do a netstat -b in dos and see what's trying to get connections to the external network.
Also do a scan with malware bytes and a good virus scanner like Eset nod32.. Let us know how you get on^^
The new script I downloaded from Paypal website fixed the issue.