Use the Toast orders API to attach loyalty program information to a check. This is useful for order-and-pay-at-the-table and kiosk-style ordering workflows, where a guest might not decide to use their loyalty account until the payment step.
Online ordering integrations often submit loyalty information,
discounts, and payments together in a single POST
request to the /orders endpoint of the orders API.
Tableside kiosk and order-and-pay-at-the-table orders work differently where a guest starts ordering before they've added their loyalty account to their order.
The following steps describe the workflow used by these locations to create an order, apply loyalty, and apply discounts.
-
POSTa request to the orders API/ordersendpoint to create the order and check. -
Add loyalty program information to the check when the guest is ready to redeem rewards or accrue loyalty. For more information, see Updating the applied loyalty information for a check.
-
Add loyalty discounts by sending a
POSTrequest to the/orders/endpoint. For more information, see Applying loyalty discounts.{orderGuid}/checks/{checkGuid}/appliedDiscounts -
Add payment details to the check by sending a
POSTrequest to/orders/endpoint. For more information, see Adding payments to an existing check.{orderGuid}/checks/{checkGuid}/payments
Attaching a payment triggers the redemption of any pending loyalty discount.
To update the loyalty information for a check, send a
PATCH request to the
/orders/v2/checks/
endpoint of the orders API. The request body is a JSON
{checkGuid}/appliedLoyaltyInfoAppliedLoyaltyInfo object. The procedure below explains how
to update the loyalty information for a check.
To update the applied loyalty information for a check
-
Locate the Toast platform GUID of the check you're updating. For more information, see Finding an order or check GUID.
-
Build a JSON
AppliedLoyaltyInfoobject with the values you want to set. For more information, see AppliedLoyaltyInfo values. -
Send a
PATCHrequest to the/orders/v2/checks/endpoint. Include the{checkGuid}/appliedLoyaltyInfoToast-Restaurant-External-IDheader with the location's identifier, and theAppliedLoyaltyInfoobject as the request body.
A successful request returns a 200 status with the
full, updated Check object.
|
Note |
|
You can't update a check whose status is
|
Use the following values to build the
AppliedLoyaltyInfo object for your request.
|
Value |
Description |
|---|---|
|
|
The identifier for the loyalty program account. The format depends on the loyalty vendor. For example, this may be a loyalty card number, or, for some integrations, a guest's phone number. |
|
|
The loyalty program service provider. One of
|
|
|
A masked representation of the
|
|
|
A response-only Toast platform identifier for the loyalty transaction. This is set once the loyalty vendor confirms the transaction. |
|
|
A response-only description of the loyalty transaction to print on the guest's receipt, for example "Earned 27 points." Maximum 255 characters. |
|
Note |
|
If the check already has loyalty information, the
|
The following example shows an AppliedLoyaltyInfo
request body for a PATCH request to the
/orders/v2/checks/
endpoint.
{checkGuid}/appliedLoyaltyInfo
{
"loyaltyIdentifier": "6000101001599474",
"vendor": "INTEGRATION"
}{
"guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entityType": "Check",
[contents omitted]
"appliedLoyaltyInfo": {
"loyaltyIdentifier": "6000101001599474",
"vendor": "INTEGRATION",
"maskedLoyaltyIdentifier": "************9474",
"accrualFamilyGuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"accrualText": "Earned 27 points."
},
[contents omitted]
}Once loyalty information is attached to a check, add any applicable loyalty discounts. The procedure below describes how to add a loyalty program discount to a check.
To add a loyalty program discount to a check
-
Look up the reward the guest is redeeming using your own connection to the loyalty vendor. The Toast orders API doesn't include a lookup or search endpoint for loyalty rewards. You need the vendor's
referenceIdfor the discount before submitting a request to the/orders/endpoint.{orderGuid}/checks/{checkGuid}/appliedDiscounts -
Build a JSON
AppliedDiscountobject with aloyaltyDetailsobject containing thevendorandreferenceId. -
Send a
POSTrequest to the/orders/endpoint with the{orderGuid}/checks/{checkGuid}/appliedDiscountsAppliedDiscountobject as the request body.
Examine the response. If the discount is valid, its
processingState is PENDING_APPLIED. It remains
in this state until payment is attached to the check.
The following table describes the fields included in the
loyaltyDetails object.
|
Value |
Description |
|---|---|
|
|
The loyalty program service provider. Use
|
|
|
The identifier of the loyalty program discount that's recognized by the loyalty program service provider. The Toast platform transmits this identifier to the service provider to determine the discount's validity and amount. |