The expected cash deposit for a restaurant is the currency amount of cash that should be available to be removed from a restaurant and deposited in a bank or other financial institution for a business day. You can calculate the expected deposit for a business day using information about cash transactions that you get from the orders API and information about cash collected and cash payments that you get from the cash management API. For more information about the orders API, see Orders API overview.
The following lists describe the components of the expected cash deposit for a Toast POS restaurant.
Cash Included in the Expected Deposit
-
Cash payments for checks (cash drawer transactions).
-
Cash collected from restaurant employees (for example, at the end of their shifts).
-
Cash added to a restaurant cash drawer in a cash in operation. This is not a part of routine Toast POS operation.
Cash Deducted from the Expected Deposit
-
Cash removed from a restaurant cash drawer to pay for a pre-configured expense in a pay out operation.
-
Cash removed from a restaurant cash drawer to pay employee gratuities in a tip out operation.
-
Cash removed from a restaurant cash drawer in a cash out operation. This is not part of routine Toast POS operation.
The following procedure explains how to calculate the expected deposit for one restaurant business day.
Calculating the Expected Deposit for One Business Day
-
Get the list of payment GUIDs for the business day by sending a
GET
request to thepayments
endpoint of the orders API. Include thepaidBusinessDate
parameter to specify the business day. -
Get detailed information about each payment by sending a GET request to the
payments/
endpoint of the orders API.{guid}
Calculate the sum of the
amount
values for each payment that has thetype
CASH
. The following example shows theamount
andtype
values for a payment.{ "entityType": "OrderPayment", [contents omitted] "amount": 26.51, [contents omitted] "type": "CASH", [contents omitted] }
-
Get detailed information about each cash entry for the business day by sending a
GET
request to theentries
endpoint of the cash management API. Include thebusinessDate
parameter to specify the business day. Theentries
endpoint returns a JSON array ofCashEntry
objects. Calculate the sum of the
amount
values for each cash entry that has anytype
value other thanCASH_COLLECTED
. Pay out, tip out, and cash out entries have negative amounts. The following example shows theamount
andtype
values for a cash entry.[ { "entityType": "CashEntry", [contents omitted] "amount": -50.75, [contents omitted] "type": "PAY_OUT" } ]
Note
The only exception to omitting cash entries of
type
CASH_COLLECTED
is an undoneTIP_OUT
. When a restaurant employee undoes aTIP_OUT
cash entry, the system posts aCASH_COLLECTED
cash entry for the same amount and areason
value ofUndo Tip Out
. You should include undone tip outs in your calculations of your expected cash deposits.-
Calculate the sum of the total cash payments (see Step 3) and the total non-payment cash entries (see Step 5). The result is the expected cash deposit for the business day.
The following example shell script calculates the expected cash deposit for one restaurant on one business day. The script uses the jq utility to get information from Toast API JSON response data. For more information about the jq utility, see the jq web site. This example script is intended as an illustration of the procedure for calculating expected deposits and is not suitable for production use.
Shell script to calculate the expected cash deposit for one business day
#!/bin/bash # Set parameters for Toast API requests. SERVER="https://[toast-api-hostname]
" CLIENT_ID="my-client
" CLIENT_SECRET="tbKr17l*!dMUE1hU3a3F
" # Must be URL encoded RESTAURANT_GUID="B42C2273-B35A-42E4-9D9E-B0538312E18B
" BUSINESS_DATE="20180307
" # Hold the authentication token and reuse it. AUTHENTICATION_TOKEN="" # Define functions for this example script. authenticate () { # Get an authentication token for Toast API requests. curl -X POST \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=client_credentials&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}" \ -s -o authentication-response~ \ ${SERVER}/usermgmt/v1/oauth/token # Hold the authentication token and reuse it. AUTHENTICATION_TOKEN=`jq -r '.access_token' authentication-response~` } get_payments () { # Get a list of the payment transactions for a business day. curl -X GET \ -H "Authorization: Bearer ${AUTHENTICATION_TOKEN}" \ -H "Toast-Restaurant-External-ID: ${RESTAURANT_GUID}" \ -s -o my-payments~ \ "${SERVER}/orders/v2/payments?paidBusinessDate=${BUSINESS_DATE}" # Find the number of payment record GUIDs in the JSON array # returned by the payments endpoint. NUMBER_OF_PAYMENTS=`jq '. | length' my-payments~` # Get detailed information about each payment. PAYMENT_NUMBER=0 while [[ "${PAYMENT_NUMBER}" -lt "${NUMBER_OF_PAYMENTS}" ]] do PAYMENT_GUID=`jq -r .[${PAYMENT_NUMBER}] my-payments~` # Run the get_payment function. Pass one payment GUID as an argument. get_payment ${PAYMENT_GUID} PAYMENT_NUMBER=$((${PAYMENT_NUMBER}+1)) done } get_payment () { # Get detailed information about one payment transaction. curl -X GET \ -H "Authorization: Bearer ${AUTHENTICATION_TOKEN}" \ -H "Toast-Restaurant-External-ID: ${RESTAURANT_GUID}" \ -s -o my-payment~ \ "${SERVER}/orders/v2/payments/${1}" # If the type of the payment is CASH, add its amount to the total # cash transactions for the business day. TRANSACTION_TYPE=`jq -r .type my-payment~` if [[ ${TRANSACTION_TYPE} == "CASH" ]] then # Find the currency amount of the cash transaction. CURRENT_TRANSACTION=`jq -r .amount my-payment~` # Add the current transaction amount to the total for the business day. TOTAL_CASH_TRANSACTIONS=`echo \ "${TOTAL_CASH_TRANSACTIONS}+${CURRENT_TRANSACTION}" | bc` fi } get_entries () {(16) # Get an array of the cash entries for the business day. curl -X GET \ -H "Authorization: Bearer ${AUTHENTICATION_TOKEN}" \ -H "Toast-Restaurant-External-ID: ${RESTAURANT_GUID}" \ -s -o my-cash-entries~ \ "${SERVER}/cashmgmt/v1/entries?businessDate=${BUSINESS_DATE}"(17) # Calculate the total of all entries except for the CASH_COLLECTED type. for CASH_ENTRY_AMOUNT in `jq '.[] | \ select(.type!="CASH_COLLECTED") | .amount' my-cash-entries~`(18) do TOTAL_CASH_ENTRY_ADJUSTMENTS=`echo \ "${TOTAL_CASH_ENTRY_ADJUSTMENTS}+${CASH_ENTRY_AMOUNT}" | bc`(19) done } # Run functions in this example script. # Run the authenticate function in this example script to get an # authentication token for API requests. authenticate # Run the get_payments function in this example script to get the # total cash payments (cash collected from customers)for the business day. TOTAL_CASH_TRANSACTIONS=0(20) get_payments # Run the get_entries function in this example script to get the total # cash entries for the business day, excluding cash collected. # This is typically a negative number. TOTAL_CASH_ENTRY_ADJUSTMENTS=0(21) get_entries # Calculate the total expected cash deposit by summing the cash collected # and the total of the cash entries (typically negative). EXPECTED_CASH_DEPOSIT=`echo \ "${TOTAL_CASH_TRANSACTIONS}+${TOTAL_CASH_ENTRY_ADJUSTMENTS}" | bc`(22) # Report the totals. echo "Total cash transactions: ${TOTAL_CASH_TRANSACTIONS}" echo "Total cash entry adjustments: ${TOTAL_CASH_ENTRY_ADJUSTMENTS}" echo "Expected cash deposit: ${EXPECTED_CASH_DEPOSIT}"
These parameters hold values that you need to get an authentication token and make Toast API requests. For more information, see Authentication and restaurant access. |
|
Send a GET request to the user management API to get an authentication token. For more information, see Authentication and restaurant access. Store the authentication token string in a script variable so that other example functions can use it. |
|
Send a GET request to the orders API to get a list of the GUIDs of each payment made during a business day. For each payment GUID, run another example shell script function to get detailed information about the payment. |
|
Specify the business day of the payments in the
|
|
Count the number of payment GUIDs for the business day. |
|
Run a separate function to get detailed payment information for each of the payment GUIDs for the business day. |
|
Get one GUID from the list. |
|
Run the example |
|
Increment a counter variable to move on to the next payment GUID. |
|
Send a |
|
The |
|
Get the type value for the payment. |
|
Only include |
|
Get the currency amount of the payment. |
|
Add the amount of the payment to the total amount of the cash payments for the business day. |
|
Send a |
|
Specify the business day of the cash entries in the
|
|
Get a list of the amounts of the entries that do not have
the |
|
Add each amount to the total cash entries for the business day. The amount values are negative or positive depending on whether the cash entry removes or adds cash to a restaurant cash drawer. |
|
Set the total of cash payments to zero and run the function that gets payments for the business day. |
|
Set the total of cash entries to zero and run the function that gets cash entries for the business day. |
|
Calculate the sum of total cash payments and total cash entries for the business day to get the expected cash deposit. |