Ecommerce with Beanstream

Ecommerce can be a complicated topic because it is expected to take into account the company's method of selling, marketing, inventory and processing cash.

The basics of communicating with an e-commerce gateway such as Beanstream, who also happens to reside in Victoria, Canada, is to provide a bunch of information that gets encoded to https://www.beanstream.com/scripts/process_transaction.asp via curl.


$merchant_id = '000000000'; // Replace with your merchant id
$sBeanstream = "requestType=BACKEND";
$sBeanstream .= "&errorPage=".urlencode("https://www.beanstream.com/samples/order_form.asp");
$sBeanstream .= "&merchant_id=$merchant_id";
$sBeanstream .= '&trnCardOwner='. urlencode($obj->credit_holder_name);
$sBeanstream .= '&trnCardNumber='. urlencode($obj->credit_card_number);
$sBeanstream .= '&trnExpMonth='. urlencode($obj->credit_expiry_month);
$sBeanstream .= '&trnExpYear='. urlencode($obj->credit_expiry_year);
$sBeanstream .= '&trnAmount='. urlencode($amount);
$sBeanstream .= '&ordEmailAddress='. urlencode($obj->credit_email_address);
$sBeanstream .= '&ordName='. urlencode($obj->credit_holder_name);
$sBeanstream .= '&ordPhoneNumber='. urlencode($obj->credit_phone_number);
$sBeanstream .= '&ordAddress1='. urlencode($obj->credit_address1);
$sBeanstream .= '&ordAddress2='. urlencode($obj->credit_address22);
$sBeanstream .= '&ordCity='. urlencode($obj->credit_city);
$sBeanstream .= '&ordProvince='. urlencode($obj->credit_province_state);
$sBeanstream .= '&ordPostalCode='. urlencode($obj->credit_postal_code);
$sBeanstream .= '&ordCountry='. urlencode($obj->credit_country);


// Process the Credit Card
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_URL,"https://www.beanstream.com/scripts/process_transaction.asp" );
curl_setopt($ch, CURLOPT_HEADER,1 );
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 4s
curl_setopt($ch, CURLOPT_POSTFIELDS,"{$sBeanstream}");
$txResult = curl_exec( $ch ); // DO IT
//echo '$sBeanstream=|'.$sBeanstream.'| $ch=|'.$ch.'| $txResult=|'.$txResult.'|'; die();
// clear result set
$txResult = str_replace("trnApproved", "&trnApproved", $txResult);
parse_str($txResult);
curl_close($ch);
return $trnApproved; // 1 is success

Note, Beanstream can provide you with a sandbox merchant id, so during development, you can use that merchant id.

To test if Beanstream is accepting your certificates, can use https://www.beanstream.com/scripts/debug.asp

Also, it is good to save the result string returned by Beanstream in a log table.

Great..

Great article, good job ! Software Akuntansi

It's a concentrated training

Mode homme

I did not know anything about that solution.
I'm used to working with magento. Thanks a lot for sharing this.
I'll find some information about mode homme.

Mode homme

I did not know anything about that solution.
I'm used to working with magento. Thanks a lot for sharing this.
I'll find some information about mode homme.

Your efforts on this topic

Your efforts on this topic are really cool. You are working really something great to promote information regarding this topic. dc limo

Seems to be a bit hard

Looks too hard for me..but I can try.Thanks for this post,is interesting!friv-4-school

I really liked your blog

I really liked your blog quite informative and interesting facts and figures you have discussed on your blog even the comments are very fruitful and helpful in enhancing the knowledge regarding the topic.
chamak challo || teri meri bodyguard || ra one songs

70-642 brain dumps == 70-643

70-642 brain dumps == 70-643 dumps == 70-646 braindumps == 70-647 exam dumps == 70-648 free braindumps == free 70-649 dumps == 70-652 braindump == free 70-659 dumps ==
Post very nicely written, and it contains useful facts. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement. Thanks for sharing with us

Good One..

Thank you for such a fantastic blog. Where else could anyone get that kind of info written in such a perfect way? I have a presentation that I am presently working on, and I have been on the look out for such information, and I many Thank to you.
Dui lawyer

Nice Blog...

Good post.You did a good work,and offer more effective imformation for us!Thank you.
video submission sites