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.

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.

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.

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.

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.

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.

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