LavaBlast Software Blog

Help your franchise business get to the next level.
AddThis Feed Button

Sample C# code for BeanStream credit card processing

clock October 26, 2007 16:11 by author JKealey

The other day we started looking at various credit card payment gateways in order to be able to process transactions on one of our client’s e-commerce sites. After reading up on a few alternatives, we hoped to be able to implement an easy all-in-one solution such as PayPal’s Website Payments Pro. Unfortunately, this program is not available in Canada. Apparently it will be some time soon, but we can’t wait on them for e-commerce, obviously.

After looking round a bit more, we found a payment gateway popularity contest and since we had seen a bunch of programming samples for Authorize.NET, it interested us. However, once again, Canadians cannot use this payment gateway. We looked at PSIGate the most popular one in Canada and were interested by their offering but, in the end, our client decided to go with BeanStream, another Canadian firm. BeanStream offers Electronic Funds Transfer programs (EFT) which is very useful for collecting royalties from franchisees. I may post something concerning EFT later in the year.

In any case, we were a bit disappointed that the site was not full of technical information, programming samples, SDKs, etc.  We had to contact them to obtain a copy of the documentation, something we would not have expected from a technical company in the days of Web 2.0. Having to contact them increases their contact base but shows a certain lack in openness, something which is gaining stream nowadays. The integration process seemed straightforward, as expected. Send out a request and get a response back. We were a bit surprised that the requests were encoded as you would encode a query string instead of XML with a freely available XSD/DTD. The sample code provided was dirt simple VBScript (ASP) with other technologies that we don’t use.

Some would call us lazy, but we feel that re-inventing the wheel is not a mission one should waste time on. Therefore, we started googling for freely available code for C# for payment processing using BeanStream, figuring that if the company itself doesn’t make this code available, someone must have posted an article on The Code Project or at least that we could find some code on Google Code Search. We found some PHP and some Perl, but since we code in C#, this code was not useful for us. Therefore, we started our implementation from scratch for our own purposes.

The code that follows is the current state of our implementation. It has not yet been tested in production, but our unit tests are working. We discovered a SOAP API after signing up and used that instead of the query string format.  We implemented a bit of parameter verification to make it easier to integrate with our higher level structures, which don’t have strict field lengths. Hopefully you’ll find this code useful and will let us know if you find any flaws. In our code, we've subclassed this base class to insert logging and conversion from our object-oriented data structures.

We found that the documentation was not very good, especially for the SOAP API. There were tons of mistakes and inconsistencies but, worst of all, the documentation was only available in a PDF format from which we cannot copy-paste. Therefore, the 500+ error messages or 100+ country codes cannot be easily exported to an Excel spreadsheet in order to create lookup tables in our database. We're building multi-lingual systems and don't have the time to translate their 500+ error messages, so we chose a simple solution as seen in the code. All errors (and exceptions in our code) are mapped to large encompassing classes. Fortunately, we were put in contact with VERY helpful people who responded extremely rapidly to our technical questions.

The source code follows. If you're interested, download the attached zip file containing the c# source code. (5.82 kb)

kick it on

Have a unique selling proposition

clock October 1, 2007 16:37 by author EtienneT

If you are in the retail industry, chances are that you probably already know that you have to have a unique selling proposition to offer your clients.  But hey, what’s a unique selling proposition?  In the book Reality in Advertising, author Rosser Reeves defines a unique selling proposition (USP) as:

1. Each advertisement must make a proposition to the customer: "buy this product, and you will get this specific benefit."
2. The proposition itself must be unique - something that competitors do not, or will not, offer.
3. The proposition must be strong enough to pull new customers to the product. 

A franchisor needs to have something that will make its stores shine apart from the competition. As an example, let us discuss Teddy Mountain, one of our first clients here at LavaBlast. Teddy Mountain is a stuff-your-own teddy bear type of store. Stuffed animals have been around for years and are available it countless locations.  Some stores offer dirt cheap stuffed animals while others brand the bear with a particular tourist attraction such as the Eiffel Tower. Retailers in the stuff-your-own teddy bear industry sell more than just a physical teddy bear, they sell an experience and their selling proposition revolves around this custom-creation experience.

Teddy Mountain wanted to offer something more personal to the client to complement the experience.  They decided to offer birth certificates for each teddy bear they sell.  Simple idea, but this creates a strong bond between a child and their new teddy bear.  A picture of the child with their new friend would be taken and would be printed at the counter when the teddy bear was paid for.  One could think that this simple concept is insufficient to pull new customers to the product, yet in-store behavior has proven otherwise. Children are drawn towards the camera feed presented on the kiosk and often want to purchase a bear simply to get their picture taken.

The picture here shows the in-store kiosk being used by some children.  This kiosk has two screens with two webcams and prints in the color laser printer at the cash register.  The kiosk must be simple to operate because it is used mainly by children.   This is fairly simple software and other stores also produce certificates, but the kiosk appearance (touch screen interface, webcam, three-dimensional fixtures done by Studio Y Creations) adds to the child’s in-store experience and puts Teddy Mountain in a unique position.  Because we’ve integrated the certificate with the point of sale, the employees don’t have much overhead to deal with.  Coming up in the near future are many new features on the website that link the in-store experience with the online one, refining the brand’s uniqueness.

Teddy Mountain operates in an industry which is dominated by a giant and software alone cannot be the only unique selling proposition. Teddy Mountain experience is enriched by large-scale three-dimensional fixtures that attract children from the mall inside the store. These fixtures put a little bit of magic in the shopping experience and illuminate child birthday parties. There are other refinements that define Teddy Mountain; having a clear unique selling proposition is key to increasing sales but also to attract new franchise prospects. However, since our goal is to illustrate how LavaBlast is a piece of the puzzle, as opposed to selling you a franchise, we won’t go into more detail.

Month List


The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in