Get ticket object in payment processor

In Q’s post,

, he is able to get ‘paymentTypeName’.

I’m looking to get the ticket object that is referenced here (albeit, a different process):

this

function x()
{
  var ticketData = Data.Get("ticket");

doesn’t seem to yield anything

How does one get the ticket object when using a payment processor?

Why do you need the ticket object when using a processor?

I’ve been thinking about this post:

If the ticket object is available to be parsed, then input can be asked for tip and then, via the API, a calculation and a payment can be added.

For my personal use, I am still working with exchange rate remainders. I would like to be able to get the remaining total and if it is <5 process the remainder as a rounding calculation.

When you say remainder is it showing it as change? Or is it a balance due?

Have you tried this yet?

No, I have not. I haven’t tested, but I’m thinking if there’s a partial payment that the remaining total is them posted to whatever the calculation is setup. I’d like for a something to evaluate the remaining total and process from there.

With respect to my use case scenario it would be the remaining total. If the remaining total is < 5.00 (or, in most cases, 0.08 I would like to just post that as a rounding calculation).


For the post referenced, here is what I’m thinking as a payment processor:

get the ticket ID or ticked UID and then load that as a terminal ticket. From there prompt for tip amount then addCalculationToTerminalTicket in the amount of what’s entered. If it’s a cash tip then a payment of cash (payTerminalTicket) should be added to the ticket so the drawer balances.

You wont be able to load a ticket as terminalticket if its already open and a payment has been initiated on a different terminal.

Ooo, I didn’t think of that.

Shoot…

However, if a unique ticket identifier is obtained then sql could be used to add a calculation. It’s getting an unique ticket identifier is where I’m stuck.

So, what data is passed to a payment processor?

You do not need the ticket ID from payment processor it is already understood that it is working with that ticket. You can access values from that ticket inside the script already. Use the Execute Script payment processor. Maybe toy around with whats available there.

I get that a ticket can’t be opened via the API when it’s open in the payment screen.

With the ticket ID or ticket UID, a SQL stored procedure could be called to create an account transaction linked to the ticket account transaction document and add a calculation, bypassing loading a terminal ticket.

Is the ticket ID/UID/object unavailable to the payment processor? I’ve tried ticketId, ticketID, TicketId, TicketID, etc. to no avail.

You do not need the ticket ID as functions to get data are already available for that ticket.

1 Like

What you are trying to do may not be possible through processors. Instead of doing this maybe we should find the reason for the remainder and look at solving that?

Man, Jesse, if I could figure it out, I’d be happier than a pig in shit.

I’ve gone though this thread multiple times and still am so confused:

I’ve played with the exchange rate that will work on small amounts (under 1000) but not for large amount (over 10000) and vice versa. I seem to have remainder of 0.08 Honduran Lempiras (0.0032 USD).

I already have a stored procedure that will insert into AccountTransactions, AccountTransactionValues, and Calculations. Like Q was talking about in that thread, we really don’t deal with 1 lempiras. So, anything under 5 should be rounded-off.

In order to execute the stored procedure to add a calculation I first need an identifier for the ticket.

like in Emre’s post about payment integrations, I’d like to be able to get the ticket object as shown here:

function getListOfTicketOrders(ticket) {
	// Sample for reading ticket and order data. 
	// If needed you can use it to read product names, prices, etc.

	var orders = ticket.Orders.ToArr(); 							// ToArray() converts a .net Array to JS Array so we can loop through orders.
	var result = '';                     							
	var total = 0;
	for (i = 0; i < orders.length; i++) {
		result = result + orders[i].Quantity 						// Reading order quantity
			+ ' x ' + orders[i].MenuItemName 						// Reading menu item name
			+ ' - ' + ticket.GetExactTotalFor(orders[i]) + '\r';	// Reading order total with discounts & services applied
	}
	result = result + 'Total: ' + ticket.TotalAmount + '\r';		// Ticket Total
	result = result + 'Remaining: ' + ticket.RemainingAmount;		// Remaining Total
	return result;
}

But I can’t seem to get anything from the ticket object (like ticket.RemainingAmount) when using a payment processor.

1 Like

Would it be possible to prompt for a value? For example to ask a question like " Would you like to add tip?" and enter a value. But not using the change , just asking any time when making a payment.

Thanks

That’s what brought me to thinking about working with a payment processor.

But I may have a different solution for you. I’ll post in your thread if I get it working.

1 Like

Yes you can prompt ask questions and enter a value and it can trigger a calculation. This can be done via Payment Processor

Would you mind showing me the way? Thanks

As to my original question, is the ticket object available from within a payment processor script? If so, what is the method to retrieve said object? Thanks much

You do not need the ticket object because you can access the ticket properties directly with a script and you do not need to load the ticket.

is this true elsewhere or just on payment processor script?