perl code for HTTPS - PDF by ntz11397

VIEWS: 102 PAGES: 33

									perl code for HTTPS


        boody 7 posts since
Jul 8, 2007 Anyone have or willing to share some perl code for posting transactions using HTTPS. Is it safe to
assume someone is working on a PM for this? Also, any news on an ETA for full documentation on HTTPS?


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 1. Re: perl code for HTTPS Oct 25, 2007 6:51 PM
As far as documentation goes, what's on this forum is pretty much it. You obviously need the Payflow Pro
Developer's Guide or the Websites Payments Pro UK Developer's Guide, but the underlying way to send data is just
HTTPS. Nothing special there.

Message Edited by PayPal_ToddS on 10-25-2007 11:51 AM


          boody 7 posts since
Jul 8, 2007 2. Re: perl code for HTTPS Jul 20, 2007 7:29 PM

  in response to: PayPal_ToddS Thanks, will try it. Any ETA on full documentation and/or perl modules for this (that
would include solid error reporting and retry routines)?


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 3. Re: perl code for HTTPS Jul 20, 2007 7:35 PM

   in response to: boody No ETA as we open-sourced this so we are not working on anything at the moment. The
idea is you have control over your own business logic. All the result codes are in the guides and you decide what
you want to do. As for retry logic, bottomline just don't change the request id for the same session.


          vivekkhera 14 posts since
Jul 17, 2007 4. Re: perl code for HTTPS Jul 20, 2007 7:41 PM
I have one that's about 80% done. I'm going to release it here and possibly on CPAN once it is done. All that's left is
parsing the return data from the gateway into a usable form identical to the old pfpro() function from the PFProAPI
perl module from the SDK kits. My goal is to just replace the pfpro() function call and let my app continue to run as-is.

It is based on the LWP perl library.


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 5. Re: perl code for HTTPS Jul 20, 2007 7:43 PM

   in response to: vivekkhera Good to know, keep us posted.
Todd




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                        1
perl code for HTTPS




          vivekkhera 14 posts since
Jul 17, 2007 6. Re: perl code for HTTPS Jul 31, 2007 5:03 PM
Ok... I have completed and tested my code. I have prepared the equivalent of a CPAN release of the code (pending
commentary from here I shall post it to CPAN also).

The interface is exactly the same as the interface to the old perl PFProAPI module's pfpro() function. So, to change
your existing code is trivial: you install this module, you update your "use" line to change PFProAPI to PayflowPro,
and you delete the lines setting the certificate file location and the hostnames. The rest should "just work".

Please let me know if you get this to work, or if you have problems running it. Also, please review the code to see if I
missed anything. I've implemented retries to help ensure there are no duplicate transactions due to network failures.

You can fetch it from my work site, http://labs.mailermailer.com/downloads/index.html


         tcharles72 6 posts since
Aug 24, 2007 7. Re: perl code for HTTPS Sep 3, 2007 7:57 AM

   in response to: vivekkhera Hi, is this for the UK version of Payments Pro / Payflow?
(https://payflowpro.verisign.com/transaction)

In my case, I'm only authorising transactions at the time of checkout (and storing the ORIGID). Then I'm going back
later to fulfill the transaction (after possibly changing the price).

So given this library, how would I charge the card? (and provide the new price)

Can you provide a quick example please???


          vivekkhera 14 posts since
Jul 17, 2007 8. Re: perl code for HTTPS Sep 4, 2007 2:00 AM

   in response to: tcharles72 I'm not sure how to change the prices, but to do an auth instead of a sale, just change
the transction type. if you go to the payflow manager site, then click on the downloads for the original Perl API, this
one follows it exacly. the manual describes what every parameter means.


         mickalo 31 posts since
Oct 15, 2006 9. Re: perl code for HTTPS Sep 20, 2007 9:27 PM

   in response to: vivekkhera Hello vivekkhera,

does your PayPal PayFlow module need to be compiled/installed like the old PayFlowPro API?

if the old PayFlowPro SDK isn't installed, do you need to first install it then use your module?

Thx's
Mickalo

Message Edited by mickalo on 09-20-2007 04:26 PM




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                          2
perl code for HTTPS


Message Edited by mickalo on 09-20-2007 04:27 PM


          vivekkhera 14 posts since
Jul 17, 2007 10. Re: perl code for HTTPS Sep 20, 2007 9:34 PM

   in response to: mickalo Hi, it is a pure perl implementation that replaces the old payflow pro API module that
verisign distributed. You don't need to uninstall the old one but it makes sense to do so.

My module should be 100% drop-in replacement. Just change the "use" line to the new module, and remove any
calls to the old API other than the pfpro() function call. That's pretty much it.


         mickalo 31 posts since
Oct 15, 2006 11. Re: perl code for HTTPS Sep 20, 2007 9:40 PM

   in response to: vivekkhera Ok, so if the old Verisign PayFlowPro SDK kit isn't installed on the server, we;'d just
call up your module "PayflowPro" module in the "use ..... " line, nothing needs to be compiled or installed prior to
using your module then? As I see there is a Makefile.pl I assumed it needs to be compiled/installed in some manner?

thx's
Mickalo



          vivekkhera 14 posts since
Jul 17, 2007 12. Re: perl code for HTTPS Oct 24, 2007 4:06 PM

   in response to: vivekkhera I've released and registered my PayflowPro module to CPAN. You can now install it
using the cpan installer.

To update a program using the existing PFProAPI module, the following edits are necessary:

Replace lines like these:

Code:
use PFProAPI qw(pfpro); $ENV{PFPRO_CERT_PATH} = '/usr/local/share/pfpro';


with lines like these:

Code:
use PayflowPro qw(pfpro pftestmode pfdebug); # CA cert peer verification $ENV{HTTPS_CA_FILE} = '/usr/local/etc/ca-bundle.crt';


Be sure to install the ca-bundle.crt file to the location specified.

If you have code to specify the "test" server like this:

Code:
$PFProAPI::HOST = 'test-payflow.verisign.com';


replace it with this code:

Code:




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                    3
perl code for HTTPS


pftestmode(1);

That's it. If you want to watch the http protocol and other details of processing, call pfdebug(1) prior to calling the
pfpro() function and it will write to the warning output details of progress.



         mickalo 31 posts since
Oct 15, 2006 13. Re: perl code for HTTPS Oct 24, 2007 4:23 PM

   in response to: vivekkhera Ok, thanks, got. is the ca-bundle.crt required or is that optional? Everytime I run the
perl file to create the file I get this error: perl ./mkcabundle > ./ca-bundle.crt
cvs [checkout aborted]: connect to cvs-mirror.mozilla.org(63.245.209.14):2401 failed: Permission
denied Mickalo


         ConradIrwin 1 posts since
Dec 11, 2007 14. Re: perl code for HTTPS Dec 11, 2007 9:51 AM

   in response to: vivekkhera Thank you so much! This is just what I needed, allowing low-level control without
bothering about formatting. The debug mode is also tremendously helpful, A must have for Perl Payflow Pro
developers.


          vivekkhera 14 posts since
Jul 17, 2007 15. Re: perl code for HTTPS Dec 11, 2007 4:35 PM

  in response to: mickalo Hi. the ca bundle file that ships with the CPAN module is good enough. It rarely changes. I
don't know why you're getting the CVS login error, but I'll investigate.


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 16. Re: perl code for HTTPS Dec 11, 2007 6:14 PM

   in response to: vivekkhera Just a reminder for those that want to use this package, that as of early 2009 this will
no longer work as the host URL will become obsolete and you'll need to use the paypal.com host urls which will be
online first quarter of 2008. The newer service does not require or use the "cert" that older SDKs did.
Todd


         jimg 1 posts since
Jan 4, 2008 17. Re: perl code for HTTPS Jan 4, 2008 7:20 AM

    in response to: vivekkhera I've worked with your PERL API. It works great, except under IE6 and SSL. There's
a bug in IE6 that popsup a window asking to file or save the output rather than letting me parse it. Have you seen
this? Do you have a fix?


          vivekkhera 14 posts since
Jul 17, 2007 18. Re: perl code for HTTPS Jan 4, 2008 5:49 PM




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                          4
perl code for HTTPS


  in response to: jimg Given that the API doesn't ever render any HTML pages, I'm not sure why you think this code
would be causing IE this problem. Whatever your webserver is doing while rendering the page is the problem.


          vivekkhera 14 posts since
Jul 17, 2007 19. Re: perl code for HTTPS Apr 16, 2008 6:52 PM

  in response to: PayPal_ToddS I just posted to my company site, MailerMailer Labs, the latest version of the perl
API. I'm uploading to CPAN and updating the FreeBSD package too.

Changes in this version are:

1) use the new hostname and URL string
2) remove protocol data no longer supported by the gateway

Any problems please contact me. Thanks!


         mrsveteran 4 posts since
Jun 30, 2008 20. Re: perl code for HTTPS Jun 30, 2008 6:00 PM

   in response to: vivekkhera
Hi. I plugged in PayflowPro.pm but unfortunately I keep getting "Error 26: Invalid Vendor
account." I have verified that USER, VENDOR, PARTNER, and PWD are all correct. Is
this common, and what else can I check? If I switch back to "use PFProAPI qw(pfpro)"
transactions work fine. Just going to "use PayflowPro qw(pfpro)" causes the error.



I just know this is something simple that I'm missing. :-)



Thanks in advance for any suggestions!



          PayPal_ToddS 3,991 posts since
Jul 19, 2006 21. Re: perl code for HTTPS Jun 30, 2008 6:06 PM

   in response to: mrsveteran
Verify the actual string of data you are sending, something is probably wrong with it.



Todd




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                     5
perl code for HTTPS




         mrsveteran 4 posts since
Jun 30, 2008 22. Re: perl code for HTTPS Jun 30, 2008 7:07 PM

   in response to: PayPal_ToddS
Thanks, Todd.



I was more posting for vivek to know that the module doesn't seem to drop in for the old
PFProAPI.pm, since switching them back and forth gets different results, and also to see if
there were any module-specific issues with PayflowPro.pm that had come up.



I'll run it in debug mode and see what happens. :-)



As a side note, "make test" seems to work just fine...



          PayPal_ToddS 3,991 posts since
Jul 19, 2006 23. Re: perl code for HTTPS Jun 30, 2008 7:18 PM

   in response to: mrsveteran
It is definately not a drop-in as there the means to communicate is totally different.



Todd



         mrsveteran 4 posts since
Jun 30, 2008 24. Re: perl code for HTTPS Jun 30, 2008 7:26 PM

    in response to: PayPal_ToddS Sure, but I was under the impression that PayflowPro.pm was written such that the
differences in the interface were invisible to whoever is using the module. As long as the arguments in and out are
the same, then all the communication can happen in the library without the application knowing about it ... sort of. :-)


         mrsveteran 4 posts since
Jun 30, 2008 25. Re: perl code for HTTPS Jun 30, 2008 10:57 PM

   in response to: mrsveteran




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                       6
perl code for HTTPS


Arg. I knew it was something simple. PayflowPro.pm does seem to be a drop-in replacement
for PFProAPI.pm, however, you have to make SURE that you're sending USER, VENDOR,
PARTNER, and PWD. I believe PFProAPI.pm only required USER and PWD, and I had
added VENDOR but not PARTNER, hence error 26.



Since I'm calling PayflowPro.pm from a cgi script, I temporarily edited line 207 of
PayflowPro.pm to change "warn" to "Print" so it would show the actual HTTPS request, and
sure enough, PARTNER was missing.



I hope this helps someone with the dreaded error 26. Other than this, vivek's module
is awesome and seems to work perfectly. So far I've tried credit card sales and voiding
transactions and both have worked flawlessly.



         ultranerds 8 posts since
Oct 8, 2008 26. Re: perl code for HTTPS Oct 16, 2008 5:45 PM

  in response to: mrsveteran
Hi,



Thanks for this module. For some reason, I can't even get a test payment to work :/



My code is:




#!/usr/bin/perl use strict; use lib '/home/user/members2.domain.com/cgi-bin/art/admin'; use Links qw/$IN



##################




Generated by Jive SBS on 2010-06-13-07:00
                                                                                           7
perl code for HTTPS


For some reason, I just get this response every time:



$VAR1 = {

        'PROCCVV2' => 'X',

        'RESPMSG' => 'Declined',

        'CVV2MATCH' => 'X',

        'RESULT' => 12,

        'X-VPS-REQUEST-ID' => '1223973089S28000',

        'HOSTCODE' => 'D',

        'AVSZIP' => 'X',

        'AVSADDR' => 'X',

        'PREFPSMSG' => 'No Rules Triggered',

        'IAVS' => 'X',

        'PNREF' => 'VLEA3A86A785',

        'PROCAVS' => 'U',

        'VISACARDLEVEL' => ' '

       };




Looking up the error message, that comes up as a basic error message. Surely that shouild
work fine? :/



TIA!



Generated by Jive SBS on 2010-06-13-07:00
                                                                                            8
perl code for HTTPS




Andy

Message Edited by PayPal_ToddS on 10-16-2008 10:45 AM


         ultranerds 8 posts since
Oct 8, 2008 27. Re: perl code for HTTPS Oct 17, 2008 5:52 AM

    in response to: ultranerds
Hi,



For anyone interested , here is the working code:



#!/usr/bin/perl
#
use strict;
use lib '/home/rgillen/members2.domain.com/cgi-bin/art/admin';
use Links qw/$IN $DB $CFG $USER/;
use Links::Plugins;
use Links::SiteHTML;
use CGI::Carp qw(fatalsToBrowser);

# use PayflowPro;
use PayflowPro qw(pfpro pftestmode pfdebug);

local $SIG{__DIE__} = \&Links::fatal;

Links::init('/home/rgillen/members2.domain.com/cgi-bin/art/admin');

my $setup_file = '/home/rgillen/members.domain.com/www/CDRom/cgi/config.cfg';

PayflowPro::pfdebug(1);
PayflowPro::pftestmode(1);

#pftestmode($testmode)
my $data = {
USER=>'user',


Generated by Jive SBS on 2010-06-13-07:00
                                                                                9
perl code for HTTPS



VENDOR=>'user',
PARTNER=>'VeriSign',
PWD=>'password',

AMT=> '42.24',
TAXAMT=>'0.00', # no tax charged, but specifying it lowers cost
INVNUM=>$$,
DESC=>"Test invoice $$",
COMMENT1=>"Comment 1 $$",
COMMENT2=>"Comment 2 $$",
CUSTCODE=>$$ . 'a' . $$,
TRXTYPE=>'S', # sale
TENDER=>'C', # credit card

# Commercial Card additional info
PONUM=>$$.'-'.$$,
SHIPTOZIP=>'20850', # for AmEx Level 2
DESC4=>'FRT0.00', # for AmEx Level 2

# PayPal tracking info
STREET => '123 AnyStreet',
CITY => 'Anytown',
COUNTRY => 'us',
FIRSTNAME => 'Firsty',
LASTNAME => 'Lasty',
STATE => 'md',
ZIP => '20850',

ACCT => '5555555555554444',
EXPDATE => '1009',
CVV2 => '123',
};

my $res = pfpro($data);
if ($res->{RESULT} == 0) {
print "Woohooo! We charged the card!\n";


Generated by Jive SBS on 2010-06-13-07:00
                                                                  10
perl code for HTTPS



}

use Data::Dumper;

print Dumper($res);
print $IN->header;
print qq|FOO|;




Basically, instead of changing the HOST => test server bit, you just have to import :



pftestmode pfdebug



..and then do:



    PayflowPro::pfdebug(1);
    PayflowPro::pftestmode(1);



Yay :D



Cheers



Andy

Message Edited by ultranerds on 10-16-2008 10:24 AMMessage Edited by PayPal_ToddS on 10-16-2008 10:47
AMMessage Edited by ultranerds on 10-16-2008 10:52 PMMessage Edited by ultranerds on 10-16-2008 10:52 PM




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                           11
perl code for HTTPS




         zjbub 12 posts since
Mar 25, 2009 28. Re: perl code for HTTPS Mar 25, 2009 2:02 PM

  in response to: ultranerds
I have this test code working perfectly. But when I implemented PayflowPro module in our
application and ran the mech test I got below error:



'500 SSL negotiation failed: error:1407E086:SSL
routines:SSL2_SET_CERTIFICATE:certificate verify failed'



What I did in the application:



use PayflowPro qw(pfpro pftestmode pfdebug);

$ENV{HTTPS_CA_FILE} = '/some_directory/ca-bundle.crt';
 PayflowPro::pftestmode(1);
 PayflowPro::pfdebug(1);



And then call PayflowPro::pfpro($data); with $data similar to what is listed here.



In our old code there's a call to PFProAPI::pfpro($data,$host,$port,$timeout). I have replace
that code with PayflowPro::pfpro($data);



How come the test code and real life application genereate different results?



Thanks,




Generated by Jive SBS on 2010-06-13-07:00
                                                                                           12
perl code for HTTPS




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 29. Re: perl code for HTTPS Mar 25, 2009 5:14 PM

   in response to: zjbub
zjbub



What Host URL are you using?



Todd



         zjbub 12 posts since
Mar 25, 2009 30. Re: perl code for HTTPS Mar 25, 2009 5:25 PM

    in response to: PayPal_ToddS We were using test-payflow.verisign.com. But with the new module PayflowPro I'm
not passing it into pfpro() anymore. I set pftestmode(1) and call pfpro($data) with only $data passed in. I use the cert
file that comes with the module. That probably is causing the error because without specifying any cert file the mech
tests ran successfully. If I set the $ENV{HTTPS_CA_FILE}='/some_path/ca-bundle.crt'; then the mech tests fail.


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 31. Re: perl code for HTTPS Mar 25, 2009 5:58 PM

   in response to: zjbub
That URL means you are using our older SDK which is now deprecated and will stop
working in the near future. I suggest you look at the Perl example from this post.



Todd



         zjbub 12 posts since
Mar 25, 2009 32. Re: perl code for HTTPS Mar 25, 2009 6:22 PM




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                      13
perl code for HTTPS



  in response to: PayPal_ToddS
I used the example for perl that you provided but still no luck. It gives me this error:



500 SSL negotiation failed: error:1407E086:SSL
routines:SSL2_SET_CERTIFICATE:certificate verify failed




Thanks.




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 33. Re: perl code for HTTPS Mar 25, 2009 6:40 PM

  in response to: zjbub
Just to verify, you are using the example from http://labs.mailermailer.com/downloads/
index.html?



Also, make sure you are using the host urls of pilot-payflowpro.paypal.com for testing and
payflowpro.paypal.com for production.

Message Edited by PayPal_ToddS on 03-25-2009 11:40 AM


         zjbub 12 posts since
Mar 25, 2009 34. Re: perl code for HTTPS Mar 25, 2009 6:44 PM

  in response to: PayPal_ToddS
Yes I used this example.



How do I add such a key on the server? I used the cert file that comes with the module. -
thanks.




Generated by Jive SBS on 2010-06-13-07:00
                                                                                             14
perl code for HTTPS




Generated by Jive SBS on 2010-06-13-07:00
                                            15
perl code for HTTPS




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 35. Re: perl code for HTTPS Mar 25, 2009 7:00 PM

  in response to: zjbub
The cert that is included in the file if you open it, is just a download of the certificates this
merchant had on his server and you can either import it into your keystore or go here to
obtain the latest certificates from VeriSign. You want to make sure you have the current root
and intermediate certificates.



For a Windows server, these should already be installed if you have all updates issued
by Microsoft installed. For other servers, you'll need to find out how to add them to your
keystore.



Also, I just re-read your post above:



"We were using test-payflow.verisign.com. But with the new module PayflowPro I'm not
passing it into pfpro() anymore. I set pftestmode(1) and call pfpro($data) with only $data
passed in. I use the cert file that comes with the module. That probably is causing the
error because without specifying any cert file the mech tests ran successfully. If I set the
$ENV{HTTPS_CA_FILE}='/some_path/ca-bundle.crt'; then the mech tests fail."



I am confused as you say you are using "test-payflow.versign.com" which would not
work with this code, but then you go an say "without specifying any cert file, the test ran
successfully".

Bottom-line is that you do not need that "cert" file if you already have the certificates
installed, so if it worked without it, no worries.




Generated by Jive SBS on 2010-06-13-07:00
                                                                                               16
perl code for HTTPS


Todd

Message Edited by PayPal_ToddS on 03-25-2009 12:00 PM


         zjbub 12 posts since
Mar 25, 2009 36. Re: perl code for HTTPS Mar 25, 2009 6:57 PM

  in response to: PayPal_ToddS Yes I am using pilot-payflowpro.paypal.com for testing.


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 37. Re: perl code for HTTPS Mar 25, 2009 7:02 PM

  in response to: zjbub Re-read my post above as I added more questions to it.


         zjbub 12 posts since
Mar 25, 2009 38. Re: perl code for HTTPS Mar 25, 2009 7:14 PM

   in response to: PayPal_ToddS I thought we had to have a cert file specified using the $ENV{HTTPS_CA_FILE}
variable. Without it the test passed but I got 'Client-SSL-Warning: Peer certificate not verified'.



          PayPal_ToddS 3,991 posts since
Jul 19, 2006 39. Re: perl code for HTTPS Mar 25, 2009 7:25 PM

  in response to: zjbub
Ok, then that goes back to my comments about obtaining the certificates from VeriSign. You
are missing the required certs for the SSL connection.



FYI, there are a couple expired certificates in that file. I suggest you export your certificates
from your server and create a new .crt file.



One last thing, this is an Open SSL issue, my "Google" will be your friend.

Message Edited by PayPal_ToddS on 03-25-2009 12:23 PMMessage Edited by PayPal_ToddS on 03-25-2009
12:25 PM


         zjbub 12 posts since
Mar 25, 2009 40. Re: perl code for HTTPS Mar 25, 2009 7:27 PM

  in response to: PayPal_ToddS




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                               17
perl code for HTTPS


The test-payflow.verisign.com host is what we used with the old PFProAPI. Now we are
going to change to using the new API PayflowPro which doesn't need us to explicitly set the
host to pilot-payflowpro.paypal.com. We just need to set pftestmode(1) and then it knows
which host to set.



The new API requires, I think, a cert file specified. But if I specify one the
tests would fail with this error: 500 SSL negotiation failed: error:1407E086:SSL
routines:SSL2_SET_CERTIFICATE:certificate verify failed. If I dont specify I get 'Client-SSL-
Warning: Peer certificate not verified'.



We are not on a windows server.



         peacemaker1820 4 posts since
Apr 1, 2009 41. Re: perl code for HTTPS Apr 1, 2009 7:28 PM

   in response to: PayPal_ToddS
I just installed the new PayflowPro.pm on Win 2003 Server. I've setup a text script and the
result I am getting is -1 which is "Failed to Connect to host."

I've made sure that my port 443 is open.

I've also tried posting the parameters straight through the browsers, but IE returns "page
cannot be displayed" and Firefox returns a blank screen.



Any ideas?

Thanks.



          PayPal_ToddS 3,991 posts since
Jul 19, 2006 42. Re: perl code for HTTPS Apr 1, 2009 7:38 PM

  in response to: peacemaker1820 YOu need to debug the code to see what exactly is happening. Basically the
code throws the old -1 error if there is a connection problem, you'll need to find out what the exception is. I think you
can turn on debugging to assist.




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                       18
perl code for HTTPS




         peacemaker1820 4 posts since
Apr 1, 2009 43. Re: perl code for HTTPS Apr 2, 2009 1:20 PM

  in response to: PayPal_ToddS
After turning debugging on below is what the request looks like. All fields seem to be in
place. Also, I am not including the path of the certificate ($ENV{HTTPS_CA_FILE} = 'C:\path
\to\my\ca-bundle.crt';) in my test runs. Should I? Is that a drop in, also?



HTTP Request: POST https://pilot-payflowpro.paypal.com/ Connection: close Host: pilot-pa




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 44. Re: perl code for HTTPS Apr 2, 2009 5:27 PM

  in response to: peacemaker1820
The way this is coded I believe you need access to the certificates bundled unless of course
you have them in your own keystore.



Unfortunately, what you provided does not show the actual exception that is occurring, but I
would assume it is SSL related.



Todd



         peacemaker1820 4 posts since
Apr 1, 2009 45. Re: perl code for HTTPS Apr 3, 2009 7:08 PM

  in response to: PayPal_ToddS
Finally!

It looks like "Everyone" or "Web Users" need Read and Write permissions to the .crt file on
Win 2003 IIS 6.0 using Perl.




Generated by Jive SBS on 2010-06-13-07:00
                                                                                              19
perl code for HTTPS




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 46. Re: perl code for HTTPS Apr 3, 2009 7:33 PM

  in response to: peacemaker1820 That would make sense. Glad you figured it out.


         peacemaker1820 4 posts since
Apr 1, 2009 47. Re: perl code for HTTPS Apr 7, 2009 12:36 PM

  in response to: PayPal_ToddS I always had the Read permissions ON. Why "Write" permissions, though, I don't
understand? It doesn't look like the file is being modified at all.


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 48. Re: perl code for HTTPS Apr 7, 2009 6:32 PM

   in response to: peacemaker1820 Have no idea why it would need "write" and as you noticed the file only gets
read. But this would be an IIS issue.


         tbbatccc 9 posts since
Aug 7, 2008 49. Re: perl code for HTTPS Jun 2, 2009 6:12 PM

Hi All:



I am looking to install the new PayFlowPro API (downloaded from mailermailer)



I have ActiveState 5.10 installed.



My question:

How do I go about actually installing the module using the ActiveState PERL installtion and
not the default (/usr/bin/perl) PERL installation.



thanks for any assistance!!




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                 20
perl code for HTTPS


ON EDIT: Never Mind

Message Edited by tbbatccc on 06-02-2009 11:12 AM


          4drob 2 posts since
Jul 27, 2009 50. Re: perl code for HTTPS Jul 27, 2009 6:24 PM

  in response to: mrsveteran

         mrsveteran wrote:

         Arg. I knew it was something simple. PayflowPro.pm does seem to be a
         drop-in replacement for PFProAPI.pm, however, you have to make SURE
         that you're sending USER, VENDOR, PARTNER, and PWD. I believe
         PFProAPI.pm only required USER and PWD, and I had added VENDOR but
         not PARTNER, hence error 26.



         Since I'm calling PayflowPro.pm from a cgi script, I temporarily edited line
         207 of PayflowPro.pm to change "warn" to "Print" so it would show the
         actual HTTPS request, and sure enough, PARTNER was missing.



         I hope this helps someone with the dreaded error 26. Other than this, vivek's
         module is awesome and seems to work perfectly. So far I've tried credit card
         sales and voiding transactions and both have worked flawlessly.



I was having the same issue and your post helped me fix it, thank you!



And thanks to vivek for the updates. :)



          jscipione 8 posts since
Jul 30, 2009 51. Re: perl code for HTTPS Jul 30, 2009 7:28 PM

I am using the PayFlowPro.pm Perl module to connect to Payflow Pro from a Perl script.
I have it working on Linux, but on Windows 2000 Server w/ IIS 5.1 the script hangs and
eventually times out. I have installed the ActivePerl 5.8 as well as the HTTP-Request, and




Generated by Jive SBS on 2010-06-13-07:00
                                                                                             21
perl code for HTTPS


LWP-UserAgent Perl Modules. I have tested that SSL connections are working from the
Windows server using Perl.



My script hangs on the line:



$res = pfpro($data); # send the pfpro data



Which is exactly the point where it runs the pfpro() function from the PayFlowPro.pm
module. Has anyone tested this script on Windows? Has anyone experienced their script
hanging while trying to connect on Windows? Is there something else that should be doing?



Thank you,

John Scipione



          ShogunDoDo 2 posts since
Jul 31, 2009 52. Re: perl code for HTTPS Jul 31, 2009 5:49 PM

I'm having a problem and getting the "The certificate chain did not validate, no local
certificate found, Cert Path". I'm running on a Linux Server, Fedora release 10 (Cambridge)
Fedora release 10 (Cambridge) Fedora release 10 (Cambridge). The code is in perl and
I'm using the PayFlowPro module. It's marked as version 2111 and matches the version on
CPAN. It came with a ca-bundle.crt. I also ran the supplied 'mkcabundle', which generated
an identical file. I've placed the ca-bundle.crt in my apache configuration directory, made it
read/write for the server userid and added the SetEnv PFPRO_CERT_PATH to the apache
configuration. All transactions fail with the 'chain did not validate' error.



In an earlier testing, a manual script worked using the original cert that was used with the
old PFProAPI.pm. This version has been running without problems since 2001. We are
converting because of the requirement to move to the new version. The manual script
would work against the test server without getting the 'chain did not validate' error, but would
always get declines when trying run against the live server.




Generated by Jive SBS on 2010-06-13-07:00
                                                                                              22
perl code for HTTPS




Any help would be appreciated.




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 53. Re: perl code for HTTPS Jul 31, 2009 6:43 PM

  in response to: ShogunDoDo The certificate issue on test-payflow.verisign.com is being done on purpose. Please
see the post at the top of the forum titled, "Important Notice Regarding The Payflow Gateway - Please Read! -
Updated: July 31, 2009".


          ShogunDoDo 2 posts since
Jul 31, 2009 54. Re: perl code for HTTPS Jul 31, 2009 10:55 PM

For what its worth, I picked up the Roots.zip and tried using 72fa7371.cer and7d453d8f.cer
and could not make either work as the ca-bundle.crt, always getting the "The certificate
chain did not validate ...".



Interestingly , if I put the 72fa7371.cer in a new directory, renamed it 72fa7371.0, and pass
that to the PayflowPro.pm module, I get through, but every transaction has been declined.




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 55. Re: perl code for HTTPS Aug 3, 2009 6:24 AM

   in response to: ShogunDoDo The certificate would not have anything to do with your transactions being declined,
that is something else. Are you sure you are not using real credit card numbers or amounts greater than 999.99 on
the test server?


          4drob 2 posts since
Jul 27, 2009 56. Re: perl code for HTTPS Aug 3, 2009 3:50 PM

  in response to: PayPal_ToddS
All was going well until we noticed our account was short quite a bit of funds. For some
reason I can't understand, some authorizations are being set to 'N' or duplicate transaction




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                23
perl code for HTTPS


types. These authorizations then cannot be captured. There are a few authorizations that
are actually duplicates (due to a script we run that tries different expiration dates for credit
cards we keep on file for an auto pay system) but by far the majority do not have actual
duplicate authorizations.



This only started to happen after I updated the PF perl module. I'm really at a loss and any
help is greatly appreciated. Thanks!



          jscipione 8 posts since
Jul 30, 2009 57. Re: perl code for HTTPS Aug 3, 2009 10:55 PM

  in response to: jscipione
For anyone else using the PayflowPro.pm Perl module on Windows with ActivePerl I have
found a workaround to my issue and would like to post it here so that future web developers
can benefit from my pain. This issue I was having involves not being able to establish an
SSL connection despite the fact that the SSLeay.dll and libeay32.dll libraries are installed.
To impliment my fix, first install those .dll files in your Perl bin directory and make sure that
they are readable by the IIS user. You can do this using ppm if you wish but you have to
manually specify that package location. Next, you must update the PayflowPro.pm script in
the following way. Find the lines that read:



use LWP::UserAgent;
use HTTP::Request;



and replace them with the following:



use Cwd;
use FindBin;
my $lastdir = getcwd();
chdir($FindBin::RealBin);
use Crypt::SSLeay;
use LWP::UserAgent;



Generated by Jive SBS on 2010-06-13-07:00
                                                                                                   24
perl code for HTTPS


use HTTP::Request;
chdir($lastdir);



This will change directory into your Perl bin directory and then load the required modules.
Otherwise, the Crypt::SSLeay module will not load correctly. You must explicitly import
the Crypt::SSLeay package or it the PayFlowPro.pm script will not be able to find it. I think
that this is caused by a bug in ActivePerl on Windows where a .dll file that is loaded by
another Perl module is not accessable outside of that module. So if LWP::UserAgent calls
Crypt::SSLeay (which is what it does if you do not specifically use it) then PayflowPro.pm will
_not_ be able to access Crypt::SSLeay. Note that this is _not_ a problem on FreeBSD/Linux.



          jscipione 8 posts since
Jul 30, 2009 58. Re: perl code for HTTPS Aug 3, 2009 11:30 PM

  in response to: jscipione
It appears that the cwd business in uneccessary, just make sure to explicitly call `use
Crypt::SSLeay` on Windows using Active Perl. Not necessary on Linux/FreeBSD.



John Scipione



          PayPal_ToddS 3,991 posts since
Jul 19, 2006 59. Re: perl code for HTTPS Aug 4, 2009 6:30 AM

  in response to: jscipione
4drob



The X-VPS-Request-ID is not being changed; hence the duplicate transactions.



Todd



         Lee_Curtis 6 posts since
Aug 4, 2009 60. Re: perl code for HTTPS Aug 4, 2009 7:27 PM




Generated by Jive SBS on 2010-06-13-07:00
                                                                                             25
perl code for HTTPS



I'm trying to implement the new HTTPS interface using Perl on an AIX system. I've
downloaded the PayflowPro-2111 and have tried, unsuccessfully, to run it. I'm not surprised
that it didn't run since I am not a Perl developer, but, I haven't been able to identify where to
locate the required components, the LWP::Crypt components specifically. I'm not sure this
will even work on AIX.



Has someone already implemented this on an AIX box using Perl and would you be willing
to assist me in getting this working?



Thanks in advance.

LC



          jscipione 8 posts since
Jul 30, 2009 61. Re: perl code for HTTPS Aug 4, 2009 8:11 PM

  in response to: Lee_Curtis
Use cpan to install the required modules, LWP::UserAgent, HTTP::Request, and
Crypt::SSLeay. cpan should work on AIX but it may not be installed by default.



         originalgeek 15 posts since
Mar 23, 2009 62. Re: perl code for HTTPS Aug 13, 2009 6:05 AM

  in response to: jscipione
Hi, I'm curious about a comment in the PayflowPro.pm module:



  TAXAMT=>'0.00',              # no tax charged, but specifying it lowers cost



Can someone please explain this to me? Which cost is lowered? And why is explicitly
passing '0.00' different than the assumed zero of passing nothing? Thanks.



        PayPal_ToddS 3,991 posts since




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                26
perl code for HTTPS


Jul 19, 2006 63. Re: perl code for HTTPS Aug 17, 2009 7:03 PM

  in response to: originalgeek TAXAMT is only for reporting purposes or for Level 2 Data. If passing Level 2 Data, it
could help reduce your transaction costs with your bank if you pass all Level 2 Data even if zero.Message Edited by
PayPal_ToddS on 08-17-2009 12:03 PM


         originalgeek 15 posts since
Mar 23, 2009 64. Re: perl code for HTTPS Aug 20, 2009 8:21 PM

   in response to: PayPal_ToddS One last question, if I make authorizations on the old SDK, will the captures and/or
future credits against the HTTPS interface (via this perl module) work properly? Thanks.


          PayPal_ToddS 3,991 posts since
Jul 19, 2006 65. Re: perl code for HTTPS Aug 21, 2009 5:46 PM

   in response to: originalgeek
Yes. The SDK is only a means to send/receive data.



          boody 7 posts since
Jul 8, 2007 66. Re: perl code for HTTPS Aug 21, 2009 5:55 PM

How can we pass the IP of the client/customer for purposes of passing through the fraud
filter?



          PayPal_ToddS 3,991 posts since
Jul 19, 2006 67. Re: perl code for HTTPS Aug 21, 2009 6:00 PM

   in response to: boody Refer to the Payflow Pro Developer's Guide and the Fraud Protection Services Guide here.


         acutchin 1 posts since
Aug 21, 2009 68. Re: perl code for HTTPS Aug 24, 2009 10:22 PM

   in response to: PayPal_ToddS
I'm working on replacing our legacy PFProAPI implementation with the new PayFlowPro
module. I have figured out how to charge against the test gateway and am ready to start
integrating this module with our production billing script.



However, I have a question about retry logic. I believe the old API handled retry logic, and
PayflowPro::pfpro does not. Is this correct? If so, has anyone written a usable script that
performs retry logic?




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                  27
perl code for HTTPS




Thanks for any advice!



-- Aaron



          PayPal_ToddS 3,991 posts since
Jul 19, 2006 69. Re: perl code for HTTPS Aug 25, 2009 12:55 AM

  in response to: acutchin
The old sdk had a type of retry logic but not like is available now. There are some examples
with retry logic in PHP, but the concept is the same. If you do not receive a response, wait
a few seconds, resubmit with same request Id up to a number of times. I would say 3 or 4
max.



Always look for DUPLICATE=1 being returned so you understand the response is not a new
response, but from one already processed.



          jscipione 8 posts since
Jul 30, 2009 70. Re: perl code for HTTPS Aug 25, 2009 7:05 PM

   in response to: PayPal_ToddS Just remember to change the X-VPS-REQUEST-ID variable each time so that you
do not get a duplicate transaction back. I find the easiest way to make sure that the X-VPS-REQUEST-ID gets set to
a unique value every time is to just set it to the output of the time() function.


         originalgeek 15 posts since
Mar 23, 2009 71. Re: perl code for HTTPS Aug 25, 2009 7:10 PM

  in response to: jscipione You might want to use $$ . time() in case multiple processes try to generate X-VPS-
REQUEST-ID in the same second.


         cstapert 1 posts since
Aug 26, 2009 72. Re: perl code for HTTPS Aug 26, 2009 5:59 PM

  in response to: originalgeek
I'm on a FreeBSD box (4.6.1) running perl 5.6.1. The script runs fine but never connects to
paypal:




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                  28
perl code for HTTPS




perl ./test.pl
HTTP Request:

POST https://pilot-payflowpro.paypal.com/
Connection: close
Host: pilot-payflowpro.paypal.com
Content-Length: 500
Content-Type: text/namevalue
X-VPS-CLIENT-TIMEOUT: 30
X-VPS-REQUEST-ID: 1251309112S82790
X-VPS-VIT-INTEGRATION-PRODUCT: MailerMailer PFPro
X-VPS-VIT-INTEGRATION-VERSION: 2111
X-VPS-VIT-OS-NAME: freebsd
X-VPS-VIT-OS-VERSION: 4.6-release
X-VPS-VIT-RUNTIME-VERSION: 5.006001

FIRSTNAME[6]=Firsty&TRXTYPE[1]=S&INVNUM[5]=82790&DESC4[7]=FRT0.00&
LASTNAME[5]=Lasty&PWD[12]=password&STATE[2]=md&ACCT[16]=
5555555555554444&DESC[18]=Test invoice
82790&SHIPTOZIP[5]=20878&CITY[7]=Anytown&USER[4]=user&EXPDATE[4]=1009&
CVV2[3]=123&PARTNER[8]=VeriSign&ZIP[5]=20878&AMT[5]=32.23&PONUM[11]=
82790-82790&CUSTCODE[11]=82790a82790&COMMENT1[15]=Comment 1
82790&STREET[14]=123 Any`Street&COUNTRY[2]=us&COMMENT2[15]=Comment 2
82790&TAXAMT[4]=0.00&TENDER[1]=C&VENDOR[8]=VeriSign&VERBOSITY=MEDIUM

Running request, 3 left
Running request, 2 left
Running request, 1 left
HTTP communication error: 500 Can't connect to pilot-payflowpro.paypal.com:443 ()
pfpro answer:
RESPMSG => Failed to connect to host
RESULT => -1
X-VPS-REQUEST-ID => 1251309112S82790



Generated by Jive SBS on 2010-06-13-07:00
                                                                                    29
perl code for HTTPS




Any suggestions on where I should be looking? -- Craig




          PayPal_ToddS 3,991 posts since
Jul 19, 2006 73. Re: perl code for HTTPS Aug 26, 2009 6:02 PM

  in response to: cstapert See the 3rd post here and verify you have the certificates installed on your server.


          jscipione 8 posts since
Jul 30, 2009 74. Re: perl code for HTTPS Aug 26, 2009 10:42 PM

  in response to: cstapert
I have written a perl test script that is much more complete than that. You simply have to
enter your username, password, partner, and vendor into the appropriate variables. You can
run the result from the command line or preferably from your webserver as it will output an
html response. This script has been tested on FreeBSD 6.2 with Perl 5.8. I cannot garentee
that it will work in Perl 5.6 but it should provided you have the necessary Perl modules
installed.



Script is below:




#!/usr/bin/perl use LWP::UserAgent; use HTTP::Request; use Config; use strict; my $user = ''; my $pwd =



Message Edited by PayPal_ToddS on 08-26-2009 03:42 PM


         Lee_Curtis 6 posts since
Aug 4, 2009 75. Re: perl code for HTTPS Aug 27, 2009 3:25 PM

  in response to: jscipione
How do the new root certificates fit in/replace the ca.bundle that was included with this
perl module? If the new ones are installed using the standard IBM AIX utilities, then all I




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                  30
perl code for HTTPS


have to do to my script is change my cert path from the bundle location to the default install
location and use one of these cert names? Does this sound correct?



thanks,

LC



         Lee_Curtis 6 posts since
Aug 4, 2009 76. Re: perl code for HTTPS Aug 27, 2009 5:13 PM

  in response to: Lee_Curtis
Has anyone else had a problem with this line of code in PayflowPro.pm module?



my $request_id=substr(time . $data->{TRXTYPE} . ($data->{INVNUM} || $data->{ORIGID} ||
'NOID'),0,32);



It appears that my install is always taking the NOID route, even though I'm assigning the
ORIGID.



Also, if I make a change to the PayflowPro.pm module, do I have to do anything else for the
change to take effect?



Any thoughts?

LC



         Lee_Curtis 6 posts since
Aug 4, 2009 77. Re: perl code for HTTPS Aug 27, 2009 7:33 PM

  in response to: Lee_Curtis
I figured out my NOID issue. The name/value string that had been passed to the original
perl script was no longer being parsed into an array by the new script.



Generated by Jive SBS on 2010-06-13-07:00
                                                                                             31
perl code for HTTPS




Now that I have that resolved, all, I hope, that is left is getting the certs current and verified.



LC



          jscipione 8 posts since
Jul 30, 2009 78. Re: perl code for HTTPS Aug 27, 2009 7:44 PM

   in response to: Lee_Curtis
did you change the PayflowPro.pm module at all? I have created an updated version and I
would like to integrate any changes into mine and at some point post the result somewhere.




         Lee_Curtis 6 posts since
Aug 4, 2009 79. Re: perl code for HTTPS Aug 27, 2009 10:17 PM

   in response to: jscipione
I didn't change PayflowPro.pm at all, I left it alone. I added the logic below to my calling Perl
script to parse the name/value string and create a hash array and then passed that to pfpro.




$arglist = $ARGV[2] || push @error, 'Parameters are blank!'; @params = split("&",$arglist) ; foreach $i (@



I know it's not pretty, but it got the job done. Any suggestions to clean up the code are
welcomed. I'm not a Perl programmer, so I just hacked this together.



         quarta77 3 posts since
Sep 2, 2009 80. Re: perl code for HTTPS Sep 2, 2009 10:38 PM

   in response to: Lee_Curtis hey , has anyone tried to run the test.pl script? i get "Segmentation fault" after i run it. i
set the USER, VENDOR, PARTNER and PWD variables.




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                         32
perl code for HTTPS




          jscipione 8 posts since
Jul 30, 2009 81. Re: perl code for HTTPS Sep 2, 2009 10:49 PM

   in response to: quarta77 The only reason I could think that you would get a segmentation fault is if Perl is not
installed or the path in the test.pl script is not pointing to where your perl binary is installed.


         quarta77 3 posts since
Sep 2, 2009 82. Re: perl code for HTTPS Sep 2, 2009 10:54 PM

   in response to: jscipione
checked that. thats not it. it seems to be dying on :



$response = $ua->request($r);



I also checked to see if LWP::UserAgent and HTTP::Request were installed and they are.



Any thoughts?



         originalgeek 15 posts since
Mar 23, 2009 83. Re: perl code for HTTPS Sep 2, 2009 11:21 PM

   in response to: quarta77 Crypt::SSLeay too. My suggestion is to make sure all your packages (perl, openssl, etc.)
are up to date. Also, it may be helpful if you let us know what OS/version you are running.


         quarta77 3 posts since
Sep 2, 2009 84. Re: perl code for HTTPS Sep 3, 2009 2:20 PM

   in response to: originalgeek
Issue was that the server i was testing on didnt support https with LWP. I tested it on a
production server and it worked fine. Sorry for the confusion and thanks for the support.




1 2 3 ... 6 Previous Next




Generated by Jive SBS on 2010-06-13-07:00
                                                                                                                      33

								
To top