Skip to main content

Send Trial Activity

POST 

/client/users/:correlation_id/activity/trial/v2

Description

Used to send the current Purchase transaction to ES Loyalty to retrieve a point estimate. This API works in conjunction with the Near-Miss Prompt feature to advise consumers making purchases at Point-of-Sale or e-Commerce channels about a bonus offer or earning threshold that they are close to achieving. It also works with Anonymous Prompt to advise consumers when they have missed a reward because they have not swiped their loyalty card.

In more detail:

  • This request sends a "non-finalized" activity (a transaction detail) associated with a user.

  • The system returns detail about what the customer would have earned if this was sent as a real activity.

  • The difference in dollars between the amount spent and the amount that would have triggered a bonus offer or achieved an earning threshold is returned rounded off to two decimal places.

  • Optional Parameter - The callId can be optionally included to further specify the request that was made to the ES Loyalty Platform which flows through to reporting. It should be just as unique as the correlationId. If not provided, a GUID is generated in its place.

Request

Body

AttributeDefinitionFormatNotes
actionIdentifies purchase transactionStringRequired; for example, "PURCHASE" or "NON_POINT_REWARD"
channelIdentifies through which channel the transaction was invokedEnum: "STORE", "POS", "WEBSITE", "APP", "PARTNER"
localeThe locale of the member from the POS system.StringOptional. Currently "en-CA" or "fr-CA". If locale is set by the POS system in the Start Session request, this overrides locale set in the member provide and as the system default.
reservationTokenUsed for purchases that include redemption.StringThis attribute is optional.
transactionDateFull date and time of the transaction.StringDate of the Transaction (Full Date and Time) must be in an ISO-8601-compliant format, for example: 2022-01-17T13:48:59-04:00.
retailBannerA store grouping or type.StringTransactions will default if a single BU or banner exists (configuration). OAuth token controls how we process. This attribute is optional.
storeNumberUsed for targeting, analytics and support.String
tillNumberUse for analytics and support.NumberThis attribute is optional.
employeeCodeCSR of the transaction.NumberThis attribute is optional for operations, but required for analytics.
loyaltyIdUnique member identifier.NumberThis can be captured in the Start Session. This attribute is optional.
externalTransactionIDUnique identifier for transaction used by the client.StringOptional.
priceMatrixDesignates whether the transaction is retail or an employee purchase.Enum: "R" or "E"R = Retail
E = Employee
localeUsed to change the receipt message language response for this transaction. Defaults to the client's chosen language when not presentString"en-CA" for English.
"fr-CA" for French. Optional.
callIdRequest identifier.StringCan be auto-generated if none provided. Supports tracking specific calls to be captured within a specific session for analytics. (Secondary Correlation ID). This attribute is optional.
cartContaining array of saleLineItems.ObjectJSON Object containing array of saleLineItems.
saleLineItemsDescriptors for item in the cart.ArrayArray of JSON Objects.
subCategorySame subcategory as in Product feed.NumberCan be blank to force system to grab subcategory from product data. This is an optional attribute.
skuThe product identifier.NumberFor instance, may be scanned at Point of Sale.
quantityMeasure of product amount sold.NumberCan be partial value for unit of measure calculations where there is no directly-applicable SKU (for instance, rope sold by the foot).
originalSaleAmountThe Manufacturer's Suggested Retail Price for a product.NumberSingle-unit MSRP in pennies.
saleAmountMSRP less the discount, the actual sale price.NumberMSRP minus item discount in pennies.
storeCouponStore-based coupon.NumberThis is informational only, no active discounting occurs in ESL. This attribute is optional.
itemDiscountAmount discounted.NumberThis attribute is optional. In pennies.
mnfCouponManufacturer Coupon.NumberThis is informational only, no active discounting occurs in ESL. This attribute is optional.
promoCouponFlyer coupon.NumberThis is informational only, no active discounting occurs in ESL. This attribute is optional.
itemTaxTax on the item.NumberTax on the line item in pennies.
finalSaleAmountTotal sale amount for a specific product, the discounted price times the quantity purchased.Numberquantity * saleAmount
tagsAdditional information about the transaction.StringRequired, but can be empty.
itemCostTotal cost for a specific product, the cost per unit times the quantity purchased.Numbercost per unit * quantity. This attribute is optional.
totalSaleAmountTotal of all items sold on this transaction, including tax.NumberSummed up, tax included, total of all saleLineItems. In pennies.
couponCodesPurchase-level coupons.StringThis attribute is optional.
extendedDataClient keys needed for analytics of the transaction.ObjectMaximum 1KB, 1 level deep, 10 keys maximum. This is an optional attribute.
tenderJSON Object containing transaction tender used.ObjectContains one or more type of tender and details of each (as required).
{name}Name of type of tender.String."VISA", "LOYALTY", etc.
prefixPrefix of the card identifier.NumberUsually the IIN / First 6 numbers of the card. Used for partner-based offers. This attribute is optional.
idTypeType of the card identifier being passed in.String"TOKEN". This attribute is optional.
suffixSuffix of the card identifier.NumberUsually the last 4 digits. Used for partner-based offers. This attribute is optional.
amountTotal amount of the tender.NumberTotal amount of the tender that was spent using this specific card/tender.
LOYALTYReserved key that denotes in cents the dollars spent by exchanging for loyalty points.NumberUsed for redemption-based actions. This attribute is optional.
REWARDSReserved key that contains description of one or more non-loyalty points reward(s).ObjectContains total and items adjusted for each non-loyalty points reward
totalThe total amount of the reward in cents.Number
itemsAdjustedWhether or not the items have been adjusted in the reward points.Boolean

Response

To view the hierarchy, see the example Response.

AttributeDefinitionFormatNotes
earnedContains points earned on all applicable programs.ObjectBesides "loyalty," there may be other programs such as a partner program (and related object) with additional points awarded.
loyaltyContains points earned on the loyalty program.ObjectThe attributes would be the same for other programs (if any).
baseThe number of base rewards earned on the transaction.NumberBase points = points for any transaction based on spend.
bonusThe number of bonus rewards earned on the transaction.NumberBonus points = points for completing particular behaviour.
targetedThe number of points attributable to targeted offers.NumberTargeted points = points derived from targeted offer.
totalThe total of all points earned on the transaction.Number= base + bonus + targeted points
rewardsRewards awarded as non-loyalty points (for instance, in dollars).ObjectContains list of non-loyalty point rewards.
DOLLARDollar amount of reward.Number (in cents)Optional, can be 0
GAMEPLAYContains applicable game offers.ObjectIncludes {{gameOfferName}} field(s)
{{gameOfferName}}Name of one game offered.StringThere may be one or more of the game offers and associated game names
loyaltyIDLoyalty Card number for the session.NumberIf loyaltyId was not provided in the request, then this is the primary card number on the account
pointsRedeemedThe number of points redeemed.NumberAlways 0 for this type of request. To redeem points, use Send Finalize Transaction (with Redemption).
pointsEarnedTotalThe total of points earned after redemptions.Numbertotal minus pointsRedeemed
offerRewardsContains details of one or more offer rewards.Array containing an object for each offer reward.
offerDescriptionGeneral description of offer.StringFor instance, "Spend $20 and get 500 points." Optional.
offerDescription2Additional details of offer.StringFor instance, "Offer good through March 22."
promotionHeadlineHeadline under which offer is promoted.StringFor example: "Spend $20 and get 500 points." Optional.
offerCodeUnique code identifying offer.String
pointsEarnedPoints earned for this offer.NumberUsed only if points are earned as the reward
isTargetedFlags whether the transaction results from a targeted offer.Boolean: true or false
isDiscretionaryFlags whether the transaction is discretionary.Boolean: true or false
currencyCurrency used for this offer reward.StringFor instance, if the member is rewarded with game play, this will be "GAMEPLAY"
scopeContains details of one or more offer reward(s).ObjectContains type attribute and metadata object below
typeType of rewardStringFor instance, if the member is rewarded with game play, this will be "GAMEPLAY"
metadataContains details for the type of offer reward.ObjectFor example, for game play, contains gameID and gameProvider below for each game used as a reward
gameIDUnique identifier for game.String
gameIdentifierName of vendor providing the game.String
typeType of offer.StringFor example, "FLAT" or "PERCENTAGE" per qualifying item. Optional.
currencyThe currency for the reward.StringFor instance, "DOLLAR" required for dollar rewards.
rewardsEarnedTotal number of dollars earned for this offer.Number
amountNumber of dollars earned for each item in this offer.Number
scopeDetails about non-loyalty points reward.ObjectContains type, metadata, applyTo, and items attributes.
typeThe type of reward, either on the entire cart or on specific items within the cart.String"ITEM" or "CART"
metadataContains additional information about the dollar reward.Object
applyToSets whether to apply non-loyalty point reward to all items in cart.StringIf all items, set to "ALL". If only one item, set to "ONE".
itemsContains the SKUs for the items rewarded.ArrayEach in double quotation marks separated by commas.
dispositionDisposition of the non-loyalty points reward, whether it is awarded right away.String"INSTANT" or "BANKED".
appliedByDetermines whether the reward is applied by the loyalty system or the POS system.String"POS" or "LOYALTY".
partnerIDIdentification of a partner.StringUsed only with partner offerRewards, if relevant. Optional.
receiptMessageMessage to show on the receipt.StringThe message may differ depending on points earned, redeemed, both, or neither.
messageDetails of transaction not shown to consumer.StringProvides information about the transaction and any redemptions.
pointsBalanceTotal number of points currently attributed to this account.NumberRewards balance in points.
redeemableBalanceThe number of points that can currently be redeemed.Number
redeemablePointBalanceMaximum number of points that can currently be redeemed.NumberAn increment of a standard redemption amount. For example, with a pointsBalance of 110000, the user may be able to redeem 100000, or four increments of 25000.
householdObject containing information about the household to which the member belongs.ObjectOnly returned if the member is a member of a household.
idUnique identifier for the household.String
roleThe member's role in the household.Enum: "PRIMARY" or "SECONDARY"
balanceObject containing data about the balances available to the household.Object
totalPointsBalanceThe total points balance of the household.NumberThe sum of all member balances.
totalDollarBalanceThe total dollar balance of the household.NumberThe sum of all member balances.
totalAvailablePointBalanceThe total points available to the household.Number
totalAvailableDollarBalanceThe total dollars available to the household.Number
totalRedeemablePointBalanceThe total number of points that can currently be redeemed by the household members.Number
totalRedeemableDollarBalanceThe total number of dollars that can currently be redeemed by the household members.Number
minRedeemPointsThe minimum number of points that can be redeemed by the household.Number
maxRedeemPointsThe maximum number of points that can be redeemed by the household.Number
minRedeemDollarsThe minimum number of dollars that can be redeemed by the household.Number
maxRedeemDollarsThe maximum number of dollars that can be redeemed by the household.Number
promptMessageIDContains unique identifier for prompt message (such as near-miss).ArrayContains string with identifier value for prompt message
promptMessageContents of prompt message. Used, for instance, as near-miss prompt.StringFor example, "Customer is $4 short of qualifying for Spend 20 and get 500 points offer."
promptType of prompt message. Used, for instance, as near-miss prompt.StringFor instance, "REQUEST_ADD_PURCHASE" for a prompt indicating that the member can get rewards by spending more.
promptMessagesContains unique identifier(s) for prompt category. Used with "ANONYMOUS" prompt.ObjectContains an array that holds details for an anonymous prompt
{promptType}Contains unique identifier(s) for prompt(s) used for this prompt type.ObjectFor instance, "ANONYMOUS" array contains unique identifier(s) for anonymous prompt(s)
promptMessageIDWithin the "ANONYMOUS" object, unique identifier for the anonymous prompt message.String
promptMessageWithin the "ANONYMOUS" object, contents of prompt message. If locale is included in the request and set to "fr-CA", then the message is rendered in French. Points or dollars are calculated in back end, then displayed in message.StringFor instance, "You may be missing out on 500 points. Please present your loyalty card so that you can earn these points." The points or dollars shown are the accumulation of all rewards available on the transaction. This message may be slightly different for specific clients.
promptWithin the "ANONYMOUS" object, the type of prompt.StringFor example, "REQUEST_LOYALTY_SWIPE"

Error Responses

statusCodeerrorMessageerrorCodeDefinition
400 Bad RequestSession CallId has already been usedINVALID_REQUESTCannot reuse the same CallId that has been used before
400 Bad RequestCart cannot contain zero-quantity line itemsINVALID_REQUESTLine items in the cart must have a quantity of 1 or more
400 Bad RequestInvalid confirmation modeINVALID_REQUESTWhen confirmation is informed on request’s body, but confirmation.mode is different from ‘CART’
400 Bad RequestInvalid extended data: Exceeded data size limit for extended data: {dataSize} BytesINVALID_REQUESTWhen extendedData size exceeds the size limit. See the limit on ConfigType = EXTENDED_DATA, on Platform.DataSizeLimitInKb.
400 Bad RequestInvalid Extended data : Exceeded root level key limit for extended data : {numberOfKeys} keysINVALID_REQUESTWhen extendData exceeds number of attributes/keys limit. See the limit on ConfigType = ‘EXTENDED_DATA’, on Platform.TopLevelKeysLimit.

Request

Responses

200 - Trial Activity Sent

Response Headers
    Date
    Example: Fri, 02 Oct 2020 16:15:42 GMT
    Content-Length
    Example: 949
    Connection
    Example: keep-alive
    x-amzn-RequestId
    Example: c0271966-bcde-4b83-905d-7491793d0edb
    Referrer-Policy
    Example: no-referrer
    X-XSS-Protection
    Example: 1;mode=block
    Access-Control-Allow-Origin
    Example: *
    Expect-CT
    Example: max-age=86400
    Strict-Transport-Security
    Example: max-age=31536000
    Feature-Policy
    Example: vibrate 'none'; geolocation 'none'
    X-Frame-Options
    Example: sameorigin
    Content-Security-Policy
    Example: connect-src 'none';object-src https://*.cloudfront.net;script-src https://*.cloudfront.net
    x-amz-apigw-id
    Example: TynHPF42IAMF57w=
    cache-control
    Example: no-cache, no-store, must-revalidate
    X-Content-Type-Options
    Example: nosniff
    X-Amzn-Trace-Id
    Example: Root=1-5f77522e-57272eb82698fe096dec3346;Sampled=0