A collection of opinions, thoughts, tricks and misc. information.
Yep. I'm back. Again after a little while. I just don't have all that much to give anybody yet, and don't like coming up here and writing when I have nothing interesting to say.
So I downloaded the documentation for Paypal's API yesterday, hoping to easily get some good Paypal programming into my project. I need something very simple:
- Person wants something, person selects it.
- Person wants to pay for that thing, and clicks button to do so.
- Person gets the options to pay via their paypal account, or through a credit card
- Information entered
- Information confirmed
- Confirmation Sent
Simple enough, right? I took a look at the documentation, and was overwhelmed, for the first time in a while. There were thousands of pages of information, and sorting through it all was just not an option. For something as simple as the above, it shouldn't take a thousand pages. So I searched around the paypal developer's section. I found the paypal SDK (available for several different languages, my language this year is PHP), and I downloaded it. I imported it into my project manager, and voila, 5.8 Megs of a wonderfully organized PEAR installation. Oh. I haven't yet written about my thoughts of PEAR. I'll do that soon... But for the meantime, I just don't like it. If I'm going to be using code, I'd much rather it be available to me like my other code is, not through some installable module...
So the PEAR stuff is disabled on my PHP installation, and I didn't feel like recompiling. So I continue my search, and enter the PayPal developer's forum. May I say how much useless, incomplete information lies within those walls? I did find a few posts that got me started, and finally realized that there was no way I would be getting through this without learning how to use SOAP. My first stop was the PHP manual, which told me that I needed to enable SOAP on my PHP install... I quickly opened up vi:
Saved the file on my server, and opened it up....
'--with-zlib' '--with-bz2' '--enable-calendar' '--with-jpeg-dir'
'--with-tiff-dir' '--with-gd' '--with-png-dir' '--with-zlib-dir'
'--enable-sockets' '--with-tidy' '--with-gmp' '--with-openssl'
DAMN! I need to recompile for that native PHP5 SOAP support, don't I!? ARGH!
$ su -c removepkg PHP
$ cd /source/php5
$ make clean
$ ./configure --prefix=/package --EVERYTHING + --enable-soap
$ su -c make install
$ cd /package
# makepkg PHPwithSOAP.tgz
# installpkg PHPwithSOAP.tgz
Okay. After restarting Apache, I had PHP with SOAP. I read the documentation at php.net more thoroughly, and got a pretty good idea of what I was doing. Now I may not yet be an expert with SOAP, but the following just seemed a little long:
$params = array(
$params = array('DoExpressCheckoutPaymentRequest'=>$params);
Now why the heck would they make me waste the bandwidth and send them a string as long as "DoExpressCheckoutPaymentRequestDetails?" Can't they make that (and quite a few others) a little smaller? ARGH! Well, a few hours messing with my SOAP requests to Paypal, I finally got something working. I can now click a Pay now with Paypal button, and have a test account charge 100 dollars to a fake user. And the amount goes through! The only problem is the assloads of configuration I'm going to have to do to make this a good script that I can actually use for my sites!