SambaPOS Forum

English Boards => Support => Topic started by: aloupos on January 29, 2012, 10:10:06 am

Title: Custom Module, Credit Card processing using Samba
Post by: aloupos on January 29, 2012, 10:10:06 am
I've been using sambapos for the last 4 months in my restaurant in NYC.  It's incredibly stable, and pretty much does everything I need, except credit card processing.  In the US, most POS systems are integrated with merchant CC gateways, which makes transactions seamless and reduces errors. 

I posted a while back on this topic, and I know Emre you thought this was not something you were interested in implementing for the immediate future.  However, I'd like to take a stab at it myself, and of course donate the source code to the community. 

1.  Given the current architecture (2.xx), it seems best that I write in a new C# solution, so I don't need to worry about upgrades in the future.  The dev team can then consider if they want to integrate or not.  Any thoughts on this?

2.  If you agree with #1, I have an issue I hope you can help me solve.  I'd like the settlement screen (ticket payment)  to drive the transaction, so when a cashier presses the Credit button it will open a screen to capture the card details.  Is there a way (maybe through messaging server) I could get an event when that happens?  Ideally, that event would contain a reference to the ticket number and the amount the cashier typed before pressing credit. 

Many thanks in advance for your response and your awesome software!
Anthony
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on January 29, 2012, 11:59:12 am
Hey Anthony we missed you a lot ! Maybe you misunderstood me because I only wanted to state it is not something used in Turkey so I don't have much experience about the merchant integration and the PCI Compliance. If you can help us implementing a proper solution of course I'll appreciate it and help you with the SambaPOS integration.

OK. nevermind.. If it will be useful I can inject a dummy cc processor library on cc payment process and you'll have an idea about the integration. If you want you can also directly implement processing in that library. What do you think about it?

Footnote: You forgot sending installation photos :)
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on January 29, 2012, 01:32:52 pm
Emre -- likewise!  I was just thinking this morning that what you and your team have built is very very cool.  Not just the software, but really the community around it.   You've really brought together a community of people with interest in business, finance and hospitality from all over the world, working together to make something that's already great even better! 

The custom install I talked about earlier never happened.  I planned to fit a touch screen (without the case) into the bar directly, but I went through 3 touch screens and none of them worked.  I ended up buying a standard touch screen instead, easier but not as cool!  You can check out photos of the restaurant, and the custom bar, if you want at glowthai.com

Your idea about the dummy cc processor library is perfect.  If you do that, I'll write the integration to paynet systems, a merchant gateway in the US.  They use a standard API which could be leveraged across a number of payment gateways.  In this case I'm even happier that I can contribute something useful to you guys. 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on January 29, 2012, 03:48:26 pm
Awesome! I'll try to implement something tomorrow.
Thank you for the nice words. I believe we'll make lots of awesome things together.
When I first heard that custom bar project really excited me, I'm sorry to hear you had to cancel that. I hope you'll find another solution.
I visited the FB page.. Really cool atmosphere and dishes looks delicious. I also saw SambaPOS screen there. Very nice :)
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on January 30, 2012, 09:58:44 am
Cool, can't wait to get the update so I can start. 

On the bar, I may be getting some old touch screens from a friend.  You've motivated me to revisit the custom POS integration.  So many cool projects, so little time. 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on January 30, 2012, 12:08:49 pm
Anthony...
You can fetch latest state from googlecode repo and my sample implementation is ready to compile. You'll find CreditCardModule library in project. It will support multiple processors so when needed we'll be able to implement additional processors easily. John have something similar about integrating POS devices.

When this library loads we'll see an additional field on Local Settings screen for choosing and configuring default credit card processor.

I've implemented two sample dummy processors. Simple processor will demonstrate processor configuration, saving configuration values and basic interaction with operator. External processor demonstrates implementing custom UI. You can try adding a third processor by duplicating one of them.

I'll be waiting your questions..
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on January 31, 2012, 12:19:30 pm
Emre, Thanks for the speedy update.  I downloaded the source and started playing around with it last night.  As you expected, I have a few questions.  I'll fill you in on some background for cc processing in restaurants in the US first. 

Compared to Europe and Asia, we're still old school when it comes to processing credit cards.  Here's how it works in most restaurants in the US. 

[AUTH]First we run what's called a pre-auth, which basically asks the credit card company if the card holder has enough credit for the amount + a 20% gratuity.  We do this because the customer will manually write in the tip amount later.

[SIGN]Second, a receipt is printed that contains the tendered amount with a blank space for a tip and of course a signature.

[FORCE]This receipt is then returned to the cashier, who enters the tip information and runs the actual charge, called a Force.

[CLOSE]This ticket is completed, the cashier can re-purpose the table if in ala-carte mode. 

Q1.  Given the above, I need temporarily persist some credit card information, along with the state of the transaction.  I think it makes sense to attach this information to the ticket model.   How would you recommend I do that?

Q2.  The TIP that the customer gives should also be attached to the ticket.  I can just create a non-taxable item called Tip and add it to the ticket, but it seems like a bit of a hack.  Is there a good way to add the tip to the ticket?

Q3.  We'll likely need an additional management screen to perform voids of transactions.  This probably shouldn't be done through a ticket, as the ticket may have been closed by the time a mistake is discovered.  Also, it's a theft risk if cashiers can just void charges.  Where/How do you recommend I add that? 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on January 31, 2012, 01:37:00 pm
A I've said earlier my experience about it is limited so I'll ask a question. Even keeping cc numbers in memory is risky. Shouldn't merchant store pre-authorized credit card numbers remotely? I think the process should be :
Pre authorization -> merchant returns a unique authorization number -> we complete process with that authorization number (not with the credit card number)...

Even I'm wrong with my assumption I think there is no need to persist credit card numbers anywhere. We can store card details in memory as a dictionary with a unique key until we need them for completing process. How it sounds?
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on January 31, 2012, 01:44:47 pm
That would certainly make a lot of sense, but the merchants I'm familiar with don't work that way.  Based on the following, it looks like we need to temporarily persist the credit card details: 

"FORCE – Indicates a closure of a previously PREAUTH (pre-authorized) transaction. A
FORCE requires all data fields submitted with the original pre-authorization plus the
additional variable named APPROVNUMBER. The value of this field is the original
transaction Approval Number returned as the value of Approv_Num." -- from the merchant API guide.

I agree that we don't need to persist anything in the database.  Is the best way to create a global dictionary with the ticket number and cc details? 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on January 31, 2012, 02:20:08 pm
Yes keeping it in a dictionary will be fine. So we'll need a CardDetails class for keeping required values in memory and add it in a dictionary keyed with ticket number. We can use SecureString class for storing Card numbers in memory for additional security.

CreditCardProcessingData contains Ticket property for passing actual ticket data. If we talk for External credit card implementation you can store it in a private variable and instead of calling "PaymentProcessed" event you can call _ticket.PublishEvent(EventTopicNames.PaymentSubmitted); for closing ticket without completing the payment. So on first click to credit card button you'll pre-auth it, print receipt and close ticket. On second click to credit card button you'll check dictionary and if you can find preauth data with ticket number you'll force payment and remove preauth data.

Of course that will mean we should complete cc processing from the terminal we started the process. If we enable CC processing for a single computer it will be fine. For voiding payments we should store processed payment data elsewhere... SambaPOS permits payments with multiple credit cards so... hmm... If you think it will work as I described I can improve my implementation, tomorrow.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on January 31, 2012, 03:40:24 pm
We're on the same page in terms of workflow and where to store the cc details.  The swiped card data can be pretty large, and I'd rather not parse it if I don't have to, but a SecureString should be fine. 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: JohnS on January 31, 2012, 09:26:56 pm
Since this is API based, maybe looking at payment addons used with oscommerce web based shopping cart may help with integration with different merchants.

Title: Re: Custom Module, Credit Card processing using Samba
Post by: jenem on February 01, 2012, 02:03:06 am
In the UK we use chip and pin devices {my brother is a cash only business).
Also all the card numbers except the last four are replace by *

ie on receipt,  card number **** **** **** 1234

Edgar

Title: Re: Custom Module, Credit Card processing using Samba
Post by: JohnS on February 01, 2012, 02:20:41 am
I'm investigating a system to connect the EFTPOS terminal to SamaPOS. SambaPOS will send the total to the EFTPOS terminal, then swipe the card and enter pin or sign. Confirmation is sent back to SambaPOS and the EFT receipt can then be added into the POS receipt. The system also supports Merchant Gateways and multiple EFTPOS terminals.

This is an Australian product, if you don't want the Merchant Gateways then it should work worldwide with most EFTPOS terminals.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on February 01, 2012, 08:19:10 am
Anthony I improved External Processor as we talked and submitted latest sources. I'll be happy if you can have a look and let me know your questions / suggestions..
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on February 04, 2012, 09:48:59 am
Emre -- the improvements to external processor are perfect.  I'm following the patterns you've set there, which were a bit of a learning curve but helped me a lot to not soil your seriously clean code.  :)

John, I'm integrating to the authorize.net api, which seems to be the standard API for web commerce.  My merchant vendor, paynet -- which is not directly affiliated with authrorize.net has mirrored that api as well.  Most shopping carts use this api.  The only difference among these merchants is obviously the url, which I'll put in the settings. 

I'll implement this using an abstract class so we can plug in additional processors for chip and pin. 

Edgar, our notation for displaying credit card numbers is identical, so I'll follow suite. 

So far I've just about finished the UI elements, including forms for pre-authorize, authorize, manual credit card entry and tips. 

I still need to complete the api integration and print integration. 

Emre, obviously we use the standard printer templates, but we need to add some additional fields, for the name, credit card number, etc.  How should I proceed?
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on February 04, 2012, 10:09:55 am
Another question is the TIP.  Maybe I missed it, but can I add the TIP to the bill in code?
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on February 04, 2012, 02:39:09 pm
Anthony I hope you are having fun while implementing that.
Basically we'll create two service templates. One for Gratuity and the other one for Tip. User will enter Tip amount. We'll read Tip Service Template name from processor settings and add tip amount as a service like we did for gratuity. We'll use service templates because on Work Period Reports we need to see these amounts separately. We can also print them in detail.

I'll improve printing for sending custom tag values. I'll wait your fist commit for implementing it.
Thanks.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on February 04, 2012, 02:43:06 pm
I'm asking it to be able to ensure I'm not misunderstanding something. Are gratuity and the tip same thing or they are separate amounts?
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on February 04, 2012, 02:56:28 pm
Nope.  They're the same.  Let's just call it Gratuity from now on. 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on February 07, 2012, 04:33:26 am
There is an implementation for fixed amount Gratuity at external processor implementation. Basically we need to create a service template named "Gratuity" and configure the external processor for using this template while calculating gratuity. If fixed rate gratuity is configured as 0 than we can ask user for the gratuity amount at force stage.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on February 07, 2012, 07:11:13 am


I think that will work fine.  I just did the first commit, which includes the GUI, Paynet interface and some workflow changes.  Can you take a look and see if you agree with my implementation so far?

Also, there's one scenario we didn't think of that's pretty important.  That's splitting the bill across credit cards.  In this case, we would need to pre-auth more than 1 card, issue receipts for customers to sign and write gratuity, then go back to the ticket and force all transactions.  I think we need to store the card data and the amount in an array or dictionary attached to the ticket until the ticket is closed. 

Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on February 07, 2012, 08:08:52 am
Anthony, Where did you uploaded your commit? People created lots of test clones so I couldn't find yours..
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on February 07, 2012, 08:42:56 am
Actually, I tried to commit the changes back to your trunk, but I'm getting a 404 error from hg.  I've never used googlecode before.  Any ideas: 

C:\Documents and Settings\anthony\sambapos2\sambapos>hg push
pushing to https://code.google.com/p/sambapos
searching for changes
http authorization required
realm: Google Code hg Repository
user: aloupos
password:
abort: HTTP Error 404: Not Found
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on February 07, 2012, 11:39:05 am
Never mind, I created a clone and pushed to it. 

https://aloupos@code.google.com/r/aloupos-credit-card/

everything should be there.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on February 07, 2012, 06:58:26 pm
Anthony, Yes, you'll work on a clone and I'll merge your changes to main repository so you won't overwrite my changes :)

I reviewed your code and it seems great. On first version we can skip multiple credit card processing and manual cc number entry. After you complete force implementation I'll merge it with main repo and implement custom printing for gratuity. After completing the first workflow cycle we can think about the multiple cc processing and manual cc number entry. I have an idea about multiple processing but first I need to improve ticket printer for printing barcode.. If it sounds fine to you I'll be waiting for your merge request.. You can continue submitting on your clone. After I merge it with main repo with my changes you'll create a new clone again and continue implementing from latest state.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on February 07, 2012, 09:19:21 pm
Fantastic, I'll wrap up the force, upload and send a request to merge. 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: jeni on April 05, 2012, 09:58:25 pm
Your software has really some good and advanced features, it’s really awesome. But have you include some encryption technique in it while inserting the credit card no.


Title: Re: Custom Module, Credit Card processing using Samba
Post by: kenerly on August 20, 2012, 10:56:35 am
So can you process credit card payments with samba now?
Title: Re: Custom Module, Credit Card processing using Samba
Post by: aloupos on August 21, 2012, 12:28:35 pm
Most of the work is done, but new rules for PCI compliance that will begin to be enforced in the US (and probably already are in Europe) will mean we need to re-think some of the workflows. 
Title: Re: Custom Module, Credit Card processing using Samba
Post by: EricAllen on September 06, 2012, 07:46:19 am
I know you all have put in a lot of hard work on this so you'll probably hate me for asking this. Is there any chance of just interfacing with a service like Datacap or Verifone terminals in the meantime? Thanks as always for the great software.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on September 06, 2012, 09:18:40 am
Hello Eric. I'll be happy to implement support for them but the problem is I even don't know what Datacap terminal is and what it does. In my country (Turkey) there is no such terminal so I can't access someone for help. Of course I can do it by accessing service provider, reading sheets, etc. but that needs a lot of personal time to invest.

Open source projects should not have such problems. People other than restaurant owners does not care how useful SambaPOS is or how it works. They look at the community attention before deciding helping us or not. Of course everybody wants to know their help will be useful for a lot of people. I frequently ask for user comments, photos or any other positive action for attracting more people to the project so more developers, experts or companies who creates services such as Datacap will want to help us.  For now community remembers us when something does not work.

I hope this will change someday and instead of begging for help under every request I'll know how to fulfill them.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: DQ on November 27, 2013, 12:52:42 pm
Guys,
   I have added partial support for Verifone Omin 3750 terminal.

Here is a blog post which I used to implement.
http://cgeers.com/2008/05/18/payment-solutions-the-omni-3750-terminal/#more-33 (http://cgeers.com/2008/05/18/payment-solutions-the-omni-3750-terminal/#more-33)

https://github.com/rohitjoshi/SambaPOS-2/tree/contribs-fork (https://github.com/rohitjoshi/SambaPOS-2/tree/contribs-fork)

I still need to do some testing before use in production.
Title: Re: Custom Module, Credit Card processing using Samba
Post by: emre on November 30, 2013, 05:46:00 am
Great! Let us know your results.