Graphql Get Ticket State

Hi all.

I am currently finding my way around the graphql editor and what it is capable of.

I am planning to use Samba as a pos along side a piece of custom softare that will post the sales across as the activities are added on the other software,

I have found my way around creating a virtual terminal and adding tickets with the products I set up no problem. I intend to probably add the products eventually the same way instead of creating them in Samba and duplicating.

I would also like to be add a function in the other software that will mark each person as paid once the ticket is settled in Samba.

I would already have the uid of the ticket so I would think I would probably poll the ticket until the status has changed from unpaid.

Is there another way or is this even possible.

I have been trying a few things but the ticket id and the uid are 2 completley different things it appears and I dont know the ticket id from within graphql.

I would also like to be able to refesh the main server terminal after posting if possible as I have it set to select ticket for main pos. Im not sure if that is possible at the moment but I will take a look at that shortly.

Thanks for any help in Advance

In regards ‘polling’ could you not script from within samba triggered on automation like ticket closing/final payment rule to push data or trigger to your other system?


Thanks for the reply.

Yea that was my initial thought and would make it basically a webhook but I cannot see any way of pushing that out through samba automation.

If there is another state that I could monitor I could change that upon payment closing and poll that one but I would have thought that you should be able to get the ticket state.

I am just about to look through the queries on pmpos and see what is on there for checking if its closed. I think it is actually paid and closed though on pmpos, No checking.

My problem is that i dont want to pay the ticket through the other software. I want to push the product to the ticket and then let them add other products to the ticket in main terminal and then settle it there but I would really like to mark as paid in the other software


Ticket closing event should give you what you need.

Yer, so let samba notify your other software using script or similar on a ticket closed automation.
You could either specify paid or leave it generic that on ticket close ping your other software and then from other software dial in via api to check for updates.

Other software already has api and webhooks built in so I will have a look at the automation I can do when closing a ticket in Samba, I didnt know you could get the automation to do anything outside samba but the last time I played around with automation was v2.99 so its been a while.

If I can get it to just send an http post to the other api with the uid and a paid status that could be ideal,

I have not seen yet anywhere in samba that lists the uid ticket number of the ticket that was created via the terminal , It all just seems to be the normal ticket id but I will have a search through the forums for answers on that .


I was not sure if the “notifyTerminalTicketEvent on” would work in the correct direction also,

Not sure if that is sending to run an automation on specific event or would return a response on listed event

Not sure about that request.
With samba v5 you have scripts which use jscript (ms java as I understand it).
You can execute script with action or the {CALL:x.y} function.
If you want a topic on scripts see my hotel PMS intergration topic where I did a full intergration all from samba side using PMS systems API.

I had never used java/jscript before this project so starts slow but covers what you need.

Saying that is it’s just a basic http post you want there is probably a helper function you can use directly in the automation rule bypassing the script step altogether.


Thanks again I will have a read through, Hopefully it will give me some guidance.

Im sure I can get away with a simple post to mark the ticket paid as long as I can pass the correct ticket number back,

Been a little busy so far today so will hopefully get some time later this evening.

Agian many thanks for the guidance

An update into the progress.

First JTRTech I have to say Well Done on your work for that intergration and from someone who learns the same as you it was remarkable.

Back to me lol

I have gone for the easier option for me at the moment by using Graphql.

refreshing the main pos wa achieved with

mutation m6{postTicketRefreshMessage
(id:0) {

So that did the job very well of updating the main pos.

I have managed to create a terminal, create tickets, add line items to tickets, close the ticket, refresh and close the terminal.

All that went pretty straight forward.

The original point I wanted to get was finding out when the ticket was paid to update the other software. The work around at the moment is to call all tickets for the day that are paid and match the ID to the UID and check status. Once we see its paid then update the status in the other software.

Its a bit long winded and could have been done a lot easier if we knew the actual ticket id. We could just call that ticket id and check status.

Its my understanding that the ticket id is not created until the close funtion is run but it would be super cool if we had a return statement option on that mutation that would return it but there is nothing, Not sure if there are still requests for features on the Graphql side but I will look and see if I can submit one.

I cant see any other way in gql of returning the ticket id from the UID that the terminal creates, maybe that would be a better feature request or both. Search ticket on UID or ID.

I can see how this could be done in scripting and call the script on ticket close but its just a learning curve and speed is of the essence as they say.

I kept running into syntax errors trying to figure out the language and I dont seem to be able to find examples of scripting using the helpers and functions. All data grabbing seems to be sql queries (again not my strongest points lol) instead of the Data.get . I may have run into the same issues.

The simplist thing I could think of was again to use the web.postJson or web.postData as suggested.
Passing the paid status over via one of those methods would have been easy on the other side but again I could not find any examples to help me.

Im not sure how the ticketID is passed into the Script. I am assuming via the handler but again guessing really else how does the script know as to what ticket it is refering to.

I followed up because there is nothing worse than finding a post and it having no resoltion although Im not done with the scripting as I would like to know how to do it in there.

If anyone has any good examples of scripting I would love to read through and pick it back up,


It’s jscript and there are a ton of resources. I’ll list a few in a moment.

Thanks Jesse,

JS I can normally muddle through.

If you can find any exisitng scripts that have the helpers in that would be great.

There is ref to a beta time clock that apparently uses them but I cannot find it anywhere.

Search is your friend. First link that shows up when I typed helpers in search .

There is a HUGE amount of information in the forum about JS and the helpers available. Lots of samples of script use as well. Just take a look at search and also Tutorials Category