Endpoint to handle all promotion-related requests.

Takes in an optional JSON PromotionRequest body and performs a promotion operation defined by the specified Toast-Transaction-Type.

  • PROMOTION_VERIFY: Verifies whether a given promotion code is applicable to a check. Confirms that the promotion code is available for use, the check meets the criteria of the promotion, and that no other, conflicting promotions or discounts are applied.

    Each unique PROMOTION_VERIFY request has a unique GUID. Providers can cache a response based on a Toast-Transaction-GUID.

    If the request is valid (it is properly formatted and the promotion code can be applied), then the API returns a corresponding PromotionObject that is applicable to the check provided in the PromotionRequest. This PromotionObject contains the proper state of the promotion, including the amount to take off the check (as calculated by the provider), the name of the promotion, and the appliedDate. It is recommended that the provider use the appliedDate provided by the VerifyPromotionRequest.

    This operation must be idempotent, such that the same request must always get the same response (barring any separate apply/void requests). The provider should reserve a promotion code based on a PROMOTION_VERIFY response, and may wish to use a composite key of (check.guid, restaurant-external-guid). Providers should use the Toast-Transaction-GUID to prevent replayed requests from reserving the promotion more than once. Additionally, the Toast-Transaction-GUID acts as an identifier for the promotion in future requests.

    The average response time for a promotion verify request should be 500ms, with the maximum response time being 2s.

  • PROMOTION_REVALIDATE: Revalidates all AppliedPromotions provided on an RevalidatePromotionsRequest (in the promotionsToActOn field). This should check that all promotions in that field are still applicable to the provided check, and represent the correct amount. The promotions in promotionsToActOn are not APPLIED.

    If the PROMOTION_REVALIDATE request is valid (it is properly formatted and the promotion code can be applied), then the API returns a 200 response with a list of all AppliedPromotion objects from promotionsToActOn with up-to-date values. If the total discount of a promotion is different than what was provided, the corresponding AppliedPromotion response should have this new value.
    The promotions that are not included in `promotionsToActOn` are immutable because they have been APPLIED, and can no longer be removed from the check.

    If there are any promotions that are invalid, the API returns a 400 response with an `ErrorResponse` object. The `ErrorResponse` should contain all invalid promotions. Toast will resend a request to the revalidate endpoint after removing all invalidated promotions.

    This operation must be idempotent, such that the same request must always get the same response (barring any separate apply/void requests). If promotions are locked, their unlocking time should be refreshed upon this request. If promotion locks have expired, they should acquire a new lock.

    The average response time for a revalidate request should be 500ms, with the maximum response time being 2s.

  • PROMOTION_APPLY: Redeems all AppliedPromotions provided on an ApplyPromotionsRequest (in the promotionsToActOn field). If the redemption is successful, the API commits the transaction and returns a 200 response.

    Each unique PROMOTION_APPLY request will have a unique GUID, which will be referenced later to verify the state of a promotion code or to void a previously applied promotion code. If the request contains a Toast-Transaction-GUID that has already been committed or voided for a different check GUID, the API provider must return a 400 response with the appropriate ErrorResponse object. If there are any issues applying promotions, the API provider must return a 400 response, and we will revalidate our existing promotions.

    If the request is valid (it is properly formatted and the promotion code can be applied), then the API returns a list of AppliedPromotion objects that are applicable to the check provided in the PromotionRequest. Each AppliedPromotion object contains the proper state of the promotion, including the amount to be taken off the check (as calculated by the provider).

    This operation must be considered idempotent for multiple requests with the same Toast-Transaction-GUID and the same check GUID, for a 24 hour period (that is, it should apply once and only once).

    The average response time for an apply promotion request should be 500ms, with the maximum response time being 2s.

  • PROMOTION_STATUS: Responds with the PromotionObject or ErrorResponse that is associated with the provided Toast-Transaction-GUID, as well as the status of the redemption ("VERIFIED", "VOIDED", or "APPLIED"). If the transaction GUID is not associated with a promotion that was VERIFIED, the response code is 400.

    The average response time for a promotion status request should be 500ms, with the maximum response time being 2s.

  • PROMOTION_VOID: Voids supplied promotions from a VoidPromotionsRequest (in the appliedPromotions field). This endpoint is called when the entire check is voided, or the promotion is removed from the check. This endpoint is called on promotions that are verified as well as committed. If called on a non-committed promotion AND there is a lock placed on the promotion, the lock should be lifted, allowing another user to potentially use the promotion code. If the promotions have already been voided, then nothing should change for those.

    This call must be idempotent for multiple requests with the same Toast-Transaction-GUID. The Toast-Transaction-GUID may be used to cache a response, and to prevent a replay attack.

    The average response time for a promotion void request should be 500ms, with the maximum response time being 2s.

Request
header Parameters
Authorization
required
string <string>

Contains configured authorization information. This should be used by the client to verify the identity of the sender

Contains an OAuth bearer token in JWT (JSON Web Token) format.

Signature is to be verified by the partner with the public session verification key, available at https://[toast-api-hostname]/usermgmt/v1/oauth/token_key. The public session verification key can be cached by the partner, but Toast reserves the right to change the public key at any time. A refresh rate of once a day, and upon an unsuccessful validation of token, is recommended.

The token contains expiry date information. Requests older than the expiry date should be ignored.

The recommended Java implementation of JSON Web Token (JWT) is auth0 java-jwt.

The public key is provided in RSA format. Use the RSA256 algorithm to authorize the token.

Toast-Restaurant-External-ID
required
string <string>

The ID that identifies the restaurant for this configuration.

Toast-Transaction-GUID
required
string

The identifier of the promotion request. Based on the requestType, it is used for different functions:

  • PROMOTION_VERIFY requests use a new, unique GUID for each request to verify if a promotion code is applicable to a check. The Toast-Transaction-GUID is used to identify the new promotion in future requests.
  • PROMOTION_REVALIDATE requests use a new, unique GUID for each request to verify if promotions are still applicable to a check.
  • PROMOTION_APPLY requests use a new, unique GUID to commit promotion codes on a given check. If the same Toast-Transaction-GUID is used on the same check with the same promo codes, it should return the same result as before, without decrementing usage of the promotion code.
  • PROMOTION_STATUS requests, given an already used Toast-Transaction-GUID, will give status information for the transaction.
  • PROMOTION_VOID requests, given a unique Toast-Transaction-GUID, void promotion code usages.
Toast-Transaction-Type
required
string <string>

The type of operation.

Enum: "PROMOTION_VERIFY" "PROMOTION_REVALIDATE" "PROMOTION_APPLY" "PROMOTION_STATUS" "PROMOTION_VOID"
Request Body schema: application/json

A JSON PromotionRequest or VerifyPromotionRequest object containing information about an order and promotion code. Note: VerifyPromotionRequest is a subtype of PromotionRequest. If passed during a void, to void all promotions associated with it.

required
Array of objects (AppliedPromotion)

A list of promotions applied on the check, linked to their AppliedDiscount. Includes metadata about promotions.

required
object (Check)

A wrapper object with fields that allow reference to a Toast entity by Toast GUID.

checkGuid
string

The unique identifier of the check to which the promotions were applied.

object (PromotionObject)

An object to encapsulate information about a promotion.

orderOpenedBusinessDate
integer

The business date (yyyyMMdd) on which this order was opened.

orderOpenedDate
string <date-time>

The date the corresponding Order was opened.

Array of objects (AppliedPromotion)

Specific promotions that a request should act on (such as void or apply all of the supplied promotions).

requestBusinessDate
integer

The business date (yyyyMMdd) on which this request was created.

requestDateTime
required
string <date-time>

The date and time when this check request was made. If not specified, set to the current system time. Use ISO 8601 date and time format for all Toast APIs.

object (ExternalReference)

A wrapper object with fields that allow reference to a Toast entity by Toast GUID.

Responses
200

Returns a JSON PromotionObject representing the response if this was a PROMOTION_VERIFY or PROMOTION_APPLY request. Returns 200 for a successful PROMOTION_VOID request. promotion codes should only be "used up" on a PROMOTION_APPLY request.

400

Invalid request. Returns a JSON ErrorResponse to describe why the request was not valid. Reasons for an ErrorResponse can include a bad request (such as invalid format or missing information), or if the promotion code transaction being voided has never been seen.

401

Not properly authorized to make this request.

500

An unexpected internal error occurred.

post/promotion
Request samples
application/json
{
  • "check": {
    },
  • "checkGuid": "string",
  • "appliedPromotions": [
    ],
  • "newPromotion": {
    },
  • "promotionsToActOn": [
    ],
  • "requestDateTime": "2019-08-24T14:15:22Z",
  • "requestBusinessDate": 0,
  • "requestUser": {
    },
  • "orderOpenedDate": "2019-08-24T14:15:22Z",
  • "orderOpenedBusinessDate": 0
}
Response samples
application/json
{
  • "appliedDate": "2019-08-24T14:15:22Z",
  • "appliedBusinessDate": 0,
  • "promoCode": "string",
  • "name": "string",
  • "discountAmount": 0,
  • "referenceId": "string"
}