[web] PHP & Ecom

Started by
2 comments, last by leiavoia 13 years, 9 months ago
I have been a PHP developer for a little less than 6 years now, and somehow, have avoided e-com like the plague.

I'd like to sell licenses to my Flash games over my website, and after doing a modest amount of research on e-com, I have quickly become *overwhelmed* with third-party tools and systems.

I would like to find some sort of open source, secure, e-com DLL that I could just install on my server and tap into programmatically.

I've seen examples of this before, like with VeriSign's PC Charge system, where you can make a credit card payment (essentially) like this:

PcCreditCharge $charge = new PcCreditCharge();$charge->SetCardNumber("XXXX-XXXX-XXXX-XXXX");$charge->SetCardHolder("JOHN SMITH");// etc.// Submit paymentif($charge->Send()){    // Success!}else{    // Handle Error...}


PC Charge is expensive though. Is there anything like this that is: (1) PHP-compatible, (2) open source, (3) ultra-secure/PCI-compliant, etc., and (4) has the ability to make credit/debit card payments, as well as bank transfers, personal checks, etc.?

Thanks for any help here,
Ply
Advertisement
I've used Authorize.net in past. I haven't ever had any trouble with it in the last 4 years. They also do eCheck. They have a PHP "mockup" you can mostly cut and paste. The process basically boils down to this:

$vars = array( /* first name, last name, etc. */ );some_curl_setup_functions( blah );$response = send_data_via_curl( $vars );if ( $response['code'] == 1 ) { accepted }else { declined }


The point is, you don't need a big fancy set of PHP classes to handle this. If you've been PHP'ing for 6 years, you can easy write your own reusable class if you even need a class at all.

What you DO need is a credit card gateway. There's only a few of those and they all take their own parameters, all of which you can connect to using PHP (or anything else you can think of that can send HTTP requests).


Thanks for the tip, leiavoia.

Could you explain to me, programmatically, what a payment gateway is?

The problem with terms like "e-commerce" and "payment gateway" is that the minute you Google them, you start finding how-to resources for the layman. If I try to look up what a "payment gateway" is, I get a million about.com etc. links that aim at explaining e-commerce to old geezers that are just switching over from dial-up modems.

I am a PHP developer. Using that Authorize.net example above, can you give me an idea of:

(1) what is a "payment gateway" and how does it tie into Authorize.net's code from above?; and
(2) what is involved with obtaining and setting up (installing files etc.) a payment gateway; and
(3) an example of how I might connect to such a gateway via PHP
Programming code does NOT process a credit card. The actual processing of a credit card request is the job of a "gateway" or "credit card processor". What they do is take the CC# and other credentials you submit to them and send them off the appropriate credit card company (Visa, Mastercard, etc.) for the actual charge. They then reply back to you whether the charge was accepted or declined. Generally speaking you do not connect directly with credit card companies. Only the gateway does. You negotiate with the gateway. The gateway also handles all the fiddly-bits about different kinds of cards and card companies so that you don't have to.

So it looks like this:

Client > YourWebsite > Gateway > CCCompany

So, for instance, Authorize.net is a gateway (probably one of the largest, although i don't exactly comparison shop).

You connect to a gateway via an HTTPS request. You can do this via any code that provides this. In PHP, that probably means using cURL or similar. You could also use jQuery &#106avascript (not reliable) or anything else you can think of that can make an HTTP POST. Each gateway has their own API to connect with, so i can't give specific details. <br><br>You use a gateway by starting an account with them. They then give you access to their system using a userid and keys to connect with. You simply put all of this information in each HTTP request you make when processing a transaction.<br><br>... or you could just use PayPal :-)

This topic is closed to new replies.

Advertisement