Referencing purchases/receipt in Automation - Script

Hi everyone,

I’m trying to configure a custom action on SambaPOS v5. Maybe someone did this one before and can help me out?

I figured out how to hook up functions to button clicks, and now I need to do something more advanced and couldn’t find documentation on it.

Screenshots 1 - 3 show the custom button, message and script that I created.

I’m trying to grab information about the purchases (highlighted in blue in screenshot 2) or even better the entire receipt in the script, let’s say to just print it out on the screen, how do I do that?

Thank you,
Maksim

You would need to make sure the ticket is submitted/saved that way it will be in the database and then pass the ticket id into the script then you can get data either through helper/samba API or SQL.
Have a look at my hotel PMS intergration for some ideas.
Search forum for NewBook PMS

1 Like

Thank you for the quick reply, I’ve found the post that you mentioned, going to read over it now.

If it’s on there look for the Room Post script which directly charges a ticket to the booking system room as a form of payment. It does the above where it saves ticket and passes the id to script.

1 Like

Yep, very useful thread there, all the scripts included too.
Just need to research more “basics” I guess, like how to actually save the ticket (couldn’t find in that thread). Are there some docs or is this information just scattered around the forum?

There is an action to do it, add the action to rule before the script call.

Allot of that topic happened before the API was available so some bits are a little hacky using SQL direct. It would be better to use the API where possible which is what I would do when I get round to a v2 intergration.

Hi again, hope you’re doing well,

Thank you for the previous answers, highly appreciate your help, I figured out how SQL files work and managed to look into .mdf files using MSSMS.

Can I kindly ask you a couple more questions?

  1. I would like to understand the overall customer receipt printing process (eg. where is all the information that is used in Receipt Templates taken from?). I presume once the order is paid for, it is saved in the database and some script is running to get all this info from the database and sends it to the printer.
  2. (This is linked to question 1.) Are there any scripts triggered to print a receipt?
  3. If the scripts are triggered, is it possible to modify them to send the same receipt info to an API instead of the printer. If the script is not triggered, would you know how can I achieve the same result?

Thank you in advance,
Regards,
Maksim

You can use GQL for that. Look up the integrators guide on forum.

Would be able to offer better advice if knew the use case and what the API at the other end needs.

Thank you, the guide seems very informative and I’ll have a look.

The use case is sending all the receipt info to a separate server using the process that I briefly explained in my questions (ie. sending the data at the moment the items are paid for). The POST endpoint on the server will just expect this data in JSON format.

Well depending on your system as didn’t give full details you could try port printer in samba or ip printer in Windows and make a print template that renders json.
My CCTV box has a port you can send data to and it overlays the data on video. I just made it like an IP printer in Windows and created a stopped down template with print on events like order added, void and no sale etc.

Thank you very much, the information about port printer was very useful, I ended up finding a URL printer functionality which seems to be more suitable for our use cases.

I set up the URL printer and I’m currently getting an error when trying to print to it, however printing receipts to notepad works. I’m going to create a new thread about the error I’m getting, as the question is outside of the topic of this thread.