Web Hosting Talk







View Full Version : PHP Ecommerce - BOA Merchant Account


rackgeek
03-18-2005, 01:56 PM
Hello:

Good day. I have a few projects already in place, and need some feedback input here. Since i have read plenty of threads on here about people very knowledged in "PHP" and associated technologies.

Now my question here is, has anybody on here done any type of development using PHP with Bank Of America's merchant gateway to process credit cards? and have tied that to their web applications? does PHP need some type of special modules to accomplish this?

Thank you!

mfonda
03-18-2005, 03:41 PM
You shouldnt need any special modules, it looks like it just uses an XML API. XML is very easy to process in PHP, especially in PHP5. You will just need to build and send XML requests, and parse the XML responses. This shouldnt be too hard to do.

For sending/recieving requests, I would recommend using PEAR::HTTP_Request, it makes things much easier. http://pear.php.net/package/HTTP_Request

Corey Bryant
03-18-2005, 04:43 PM
I think they use CyberSource - which is a strong gateway. Their website should provide you actually with the coding. Some gateways (like LinkPoint and Verisign) require a DLL to be registered on the server. Not too sure about Cybersource though.

You might even take a look at osCommerce: CyberSource payment module (http://www.oscommerce.com/community/contributions,1641/page,6) for some help as well.

Roy@ENHOST
03-18-2005, 09:14 PM
OK, I have a BOA account.
I still need some sort of merchant account to accept payment online right? Just want to make sure.
If all BOA accounts comes with the ability to accept CC by default, that would be awesome!!!
:D

rackgeek
03-18-2005, 09:21 PM
Thanks! for the response back Mfonda & Coreybryant.

I do have a question for Mfonda. How hard is it to learn XML? i only have a vague idea of it. Although i'm a .net developer, and i'm aware that the .net platform is almost totally XML. I don't have the ability to define sources in XML. Do you develop these type of scripts Mfonda? i need a custom made one for this site. I can do it in ASP.net, but my client requires it to be in open source technologies I.E. PHP/MySQL.

I figured Cybersource was a good gateway Corey. I have a lot of high profile clients using it, and i get a lot of feedback.

So, would it profit me to learn a whole new technology? "XML"

Thanks!

Roy@ENHOST
03-18-2005, 09:28 PM
Here is my code for posting a request:


function post_it($datastream, $url) {

$url = preg_replace("@^http://@i", "", $url);
$host = substr($url, 0, strpos($url, "/"));
$uri = strstr($url, "/");
$reqbody = "";
foreach($datastream as $key=>$val) {
if (!empty($reqbody)) $reqbody.= "&";
$reqbody.= $key."=".urlencode($val);
}
$contentlength = strlen($reqbody);
$reqheader = "POST $uri HTTP/1.0\r\n".
"Host: $host\n". "User-Agent: PostIt\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: $contentlength\r\n\r\n".
"$reqbody\r\n";
$socket = fsockopen($host, 80, $errno, $errstr);

if (!$socket) {
$result["errno"] = $errno;
$result["errstr"] = $errstr;
return $result;
}

fputs($socket, $reqheader);

while (!feof($socket)) {
$result[] = fgets($socket, 4096);
}

fclose($socket);

return $result;

}

$data["foo"] = "some";
$data["bar"] = "data";

$result = post_it($data, "http://cpanelskindepot.com/scripts/xmlserver.php");

if (isset($result["errno"])) {
$errno = $result["errno"];
$errstr = $result["errstr"];
echo "<B>Error $errno</B> $errstr";
exit;
} else {

for($i=0;$i< count($result); $i++) echo $result[$i];

}



Sorry I didn't have the time to make it more generic.
Hopefully you can make use of it somehow or someone can help you out with it.

rackgeek
03-18-2005, 09:36 PM
Roy:

Thanks! for the code snippet. I'll give that a try, at least it'll put me on the right track. For collecting feedback... did you code this yourself? or did you contract this out for a developer?

Also the people On WHT are very helpful and prompt :)

Thank you! so much for the help.

Corey Bryant
03-19-2005, 10:31 AM
Originally posted by Roy@ENHOST
OK, I have a BOA account.
I still need some sort of merchant account to accept payment online right? Just want to make sure.
If all BOA accounts comes with the ability to accept CC by default, that would be awesome!!!
Yes Roy - you still need a merchant account and an electronic payment gateway to accept credit cards :)