...
If an error occurs when calling any of the Loyalty API endpoints, an error response will be returned with a standard response format (see below). Use the HTTP error code in coordination with the code field to determine the specific scenario that generated that error code, which will be listed in the corresponding endpoint documentation.
Info |
---|
Note that all error messages are returned in English. |
Format
RBI's loyalty API is set up to validate many different incentive and transaction related scenarios via a rules engine. As a result of trying to create a transaction via this API, one or many of these validations could fail, and resulting errors may be returned in the API response. These errors will follow a consistent structure when returned.
...
The error response will have a top level code
property set to RulesError
. The details of which rules failed will live in the details.ruleEvaluation
array. Each one of the objects within that array will contain the following properties that can be interpreted:
statusCode
<integer>: the HTTP error code returned with the response.isEngineError
<boolean>: indicates whether the error was generated by the Loyalty Engine.code
<string>: this will always be set toRulesError
, when the error comes from the loyalty engine.details
object that explains more information about the error(s).ruleEvaluation
array of objects that each specify error(s) found in the request.code
<string>: descriptive error code, used to differentiate error scenarios that return the same HTTP status code.ruleId
<string>: the ID of the rule that failed / caused an error, for example, “store-restrictions
“.message
<string>: human readable error message, in English. These are not designed for use in direct customer display.currentValue
<string> (optional): The value provided in the request that was used to evaluate the rule (if applicable).targetValue
<array> (optional): The expected value(s) used to evaluate the currentValue (if applicable). In the example below, a storeId of 12345 was provided in the transaction (this is the currentValue), but the incentive provided was set to restrict this offer redemption to only stores with ids 1234 or 2345 (the array in the targetValue).incentiveId
<string> (optional): The ID of the incentive (offer or reward) related to the rule failure (if applicable).isEngineError
<boolean>: indicated whether the error was detected by the Loyalty Engine. For internal RBI use.
errorCode
<string> (optional): legacy error code, always “ERR_BAD_REQUEST” and can be ignored.errorConfig
<object>: contains details about the error for internal RBI use.
Example Response
Code Block |
---|
{ "code": "RulesError", "details": { "ruleEvaluation": [ { "code": "invalid-service-mode", "currentValue": "TAKEOUT", "message": "Service mode is not in the list of valid "ruleId": "service-mode", "targetValue": [ "EAT_IN" ], "incentiveId": "3e9a71a8-75f8-493a-bb2a-e13f92052427" }, { "code": "invalid-store-id", "currentValue": "12345", "message": "Store is not in the list of valid stores", "ruleId": "store-restrictions", "targetValue": [ "1234", "2345" ], "incentiveId": "88a13d3f-e5af-4a23-8b32-3ed421662c62" } ], "isEngineError": true, "errorConfig": { "transitional": { "silentJSONParsing": true, "forcedJSONParsing": true, "clarifyTimeoutError": false }, "transformRequest": [ null ], "transformResponse": [ null ], "timeout": 0, "xsrfCookieName": "XSRF-TOKEN", "xsrfHeaderName": "X-XSRF-TOKEN", "maxContentLength": -1, "maxBodyLength": -1, "headers": { "Accept": "application/json, text/plain, */*", "Content-Type": "application/json", "x-api-key": "************************************HyaM", "x-region": "US", "x-request-id": "cla8q5fzx000e36i03wsmhejq", "User-Agent": "axios/0.26.1", "Content-Length": 1397 }, "method": "post", "data": "__REDACTED__", "url": "{{url}}" } }, "message": "Rule evaluation failed"} } |
...
Rule Evaluation Errors
Please find the list of all possible errors below. You will find each one's particular code, ruleId, and message.The most typical error returned by the Loyalty API is related to offer or reward evaluation rules. This section lists all possible rule evaluation errors that can be returned.
Subtotal Below Minimum Spend
The basket subtotal is below the minimum spend required for at least one offer contained in the basket.
code: below-minimum-spend
ruleId: minimum-spend
message: Invalid Incentive Object Provided. Purchase did not meet minimum spend configuration.
...