Skip to content

Response Elements

Promotion Configuration version

The calculation response contains element SeqNr. This is the promotion configuraton version used for the calculation. This information is for troubleshooting purposes and has no impact on the functional result.

Reference to source element

In the response model references to the input are denoted with Ref.Uid. These values should be unique in the input model

Order of applied discounts

Ref.Tier is returned on result elements. Applied promotions are rewarded in this order.

BaseAmt

Ref.BaseAmt can be returned for specific discounts. E.g. employee discount. This source amount can be used to deduct of a yearly employee discount balance.

{
    "ConfigurationSequenceNumber": 3330,
    "Code": "Success",
    "LoyaltyResults": [
        {
            "Ref": {
                "Uid": "f3e9412ddc9f4c1d8ae7fb049c583b47",
                "Tier": 42500,
                "Code": "AIRMILES",
                "Gid": 1,
                "BaseAmt": 399
            },
            "Desc": "Air Miles",
            "Amount": 100,
            "Type": "Regular",
            "Program": "Airmiles",
            "Count": 1,
            "LoyaltyProgramId": "AIRMILES",
            "RecDesc": "",
            "Descriptions": [
                {
                    "Description": "Air Miles",
                    "LanCode": "nl-NL"
                }
            ],
            "ReceiptDescriptions": [
                {
                    "Description": "",
                    "LanCode": "nl-NL"
                }
            ]
        }
    ]
}

Warnings

Treazure Promo may return warnings. These do not prevent returning a calculation result but may have have implications. E.g. when certain input is expected because of another element this could be ignored in calculation.

{
    "ConfigurationSequenceNumber": 1862,
    "Code": "Success",
    "Warnings": [
        {
            "Message": "Language 'en-ZA' is not configured"
        }
    ]
}

Grouping

Treazure returns a grouping identifier, Ref.Gid. This identifier indicates that the discount calculation result should result in a split-up of the provided lines, because a discount only applies to a part of such a provided line.

For instance, a case whereby the following promotions exist:

  • Discount A; 10,- discount when buying 3
  • Discount B; 50% discount on the cheapest item

Both discounts apply (ie. they are not exclusive).

Take the following request:

{
    "Request": {
        "LanCode": "nl-NL",     
        "Sales": [
            {
                "Uid": "Sale001",
                "ArticleId": "10370",               
                "Amount": 20000,
                "Count": 4
            }
        ],
        "CalculationMoment": "2024-12-02T13:45:08.9412555Z",
        "SiteId": "0010"
    }
}

This yields the following response:

{
    "FinancialResults": [
        {
            "Ref": {
                "Uid": "Sale001",
                "Tier": -35000,
                "Code": "A",
                "Gid": 0
            },
            "Amount": 334,
            "Desc": "Discount A",
            "Count": 1,
            "Type": "Promotion"         
        },
        {
            "Ref": {
                "Uid": "Sale001",
                "Tier": -35000,
                "Code": "A",
                "Gid": 1
            },
            "Amount": 666,
            "Desc": "Discount A",
            "Count": 2,
            "Type": "Promotion"         
        },
        {
            "Ref": {
                "Uid": "Sale001",
                "Tier": 20000,
                "Code": "B",
                "Gid": 0
            },
            "Amount": 2333,
            "Desc": "Discount B",
            "Count": 1,
            "Type": "Promotion"         
        }
    ],
    "ConfigurationSequenceNumber": 33,
    "Code": "Success",
    "Summary": {
        "PerPemEntry": [
            {
                "Code": "A",
                "QtyThis": 1,
                "Type": "Financial"
            },
            {
                "Code": "B",
                "QtyThis": 1,
                "Type": "Financial"
            }
        ]
    }
}
The Gid-values indicate that the original order sale should be split up on the order. This result should be interpreted and processed as follows:

Article ID Line NO Gid Count Effective Discount
10370 1 0 1 3,34 (Discount A) + 23,22 (Discount B)
10370 2 1 2 6,66 (Discount A)
10370 3 Rest 1 None

Financial Results

Contains the financial discount results. These discounts should be subtracted from the input sale elements to calculate the new sales price.

{
    "FinancialResults": [
        {
            "Ref": {
                "Uid": "d8a0c89410844f8e9f671391a61b73a6",
                "Tier": -108750,
                "Code": "2354235",
                "Gid": 0
            },
            "TriggerCouponIds": [],
            "Display": "OnDetail",
            "Amount": 53,
            "Desc": "2 + 1 gratis",
            "Count": 1,
            "Type": "Promotion",
            "BookingType": "Sale",
            "RecDesc": "2 + 1 gratis",
            "Coupons": [],
            "Descriptions": [
                {
                    "Description": "2 + 1 gratis",
                    "LanCode": "nl-NL"
                }
            ],
            "ReceiptDescriptions": [
                {
                    "Description": "2 + 1 gratis",
                    "LanCode": "nl-NL"
                }
            ]
        }
    ]
}
Name Description Type
Amount The amount in centimes. Int
Desc The description of the discount, in the language provided in the request String
Count The number of times the promotion was triggered. Int
DiscountType The type of the applied financial discount. One of Promotion, EmployeeCard, CustomerCard, Plu (markdown), ReceiptAmount, LoyaltyManualAmount (a.o. Airmiles product discounts), AirMilesReceiptAmount Enum
TriggerCouponIds If the promotion was triggered by coupons, this element showswhich coupons were ‘used’. It is a reliable indication of which coupons need to be redeemed. String[]
DiscountId If a discount has been submitted the explicit code is shows in this element. String
TransactionAttributes The transaction attributes that were used by this financial promotion. Complex[]
Display The display level of the financial promotion, if specified in the promotion configuration. One of OnHeader or OnDetail (default) Enum
BookingType The booking type the promotion is setup for. This determines how the discount should be booked logically. String
RedeemedLoyaltyPoints Number of loyalty points that should be redeemed for this discount (Air Miles) Int

Warning

Please note that Display does not affect the way the discounts are specified: discounts will always be specified on detail level; this setting merely indicates that these discounts should be summarized and displayed to the customer on header level.

Shipping costs

Rewarded discount on shipping costs is a financial result but references a shipping cost input element.

Financial Calculation Results

This is to be used for representing the rewarded discounts to the customer. E.g. buy 2 get 1 free; in FinancialResult this is indicated as 50% discount on both items, on FinancialCalculationResult this is returned as 100%/0% discount.

Warning

Do not use this information to apply discount to order lines, just to display to the user.

Loyalty Results (Air Miles)

Customer receives loyalty/Air Miles points.

{
    "LoyaltyResults": [
        {
            "Ref": {
                "Uid": "9264b130e43f4aa6a9ff16c53edff2a8",
                "Tier": -141250,
                "Code": "001",
                "Gid": 1,
                "BaseAmt": 50
            },
            "Desc": "Loyaltyprogramma NL",
            "Amount": 100,
            "Type": "Regular",
            "Program": "Electronic",
            "Count": 1,
            "ProgramId": "IntersolveELoyalty",
            "LoyaltyProgramId": "97",
            "RecDesc": "Test Loyalty",
            "Descriptions": [
                {
                    "Description": "Loyaltyprogramma NL",
                    "LanCode": "nl-NL"
                }
            ],
            "ReceiptDescriptions": [
                {
                    "Description": "Test Loyalty",
                    "LanCode": "nl-NL"
                }
            ]
        },
        {
            "Ref": {
                "Uid": "1396b4d0038f42caa6f23119fc70acab",
                "Tier": -141250,
                "Code": "001",
                "Gid": 0,
                "BaseAmt": 650
            },
            "Desc": "Loyaltyprogramma NL",
            "Amount": 600,
            "Type": "Regular",
            "Program": "Electronic",
            "Count": 1,
            "ProgramId": "IntersolveELoyalty",
            "LoyaltyProgramId": "97",
            "RecDesc": "Test Loyalty",
            "Descriptions": [
                {
                    "Description": "Loyaltyprogramma NL",
                    "LanCode": "nl-NL"
                }
            ],
            "ReceiptDescriptions": [
                {
                    "Description": "Test Loyalty",
                    "LanCode": "nl-NL"
                }
            ]
        }
    ]
}

Issued Coupon Results

Customer should be issued a coupon/voucher.

{
    "IssuedCouponResults": [
        {
            "Ref": {
                "Uid": "10fffdc54d294dfbac1ea6a817aa9b68",
                "Tier": -210000,
                "Code": "CPN FakeNails",
                "Gid": 0
            },
            "CouponId": "5782893434534",
            "Desc": "Coupon Kunstnagels 15% korting",
            "PaperCut": true,
            "Print": true,
            "ReceiptTextId": "6",
            "RecDesc": "Kortingsbon 15% Nepnagels!!",
            "StartDateTime": "2024-12-09T00:00:00",
            "EndDateTime": "2025-05-08T23:59:59",
            "Count": 1
        }
    ]
}

Properties:

  • CouponId Logical coupon ID
  • Count Number of coupons to issue
  • PaperCut Whether coupon requires paper cut and is printed on separate slip. Instruction for POS.
  • Print Whether coupon is to be printed. Instruction for POS.
  • ReceiptTextId Reference to receipt text
  • StartDateTime Coupon validity start
  • EndDateTime Coupon validity end

Coupon issue

This result is just an instruction, no coupons are actually issued. Use Coupon Issue endpoint to actually issue individual coupons.

Discount voucher

Customer should be issued a monetary discount voucher which can be redeemed on a next purchase.

Type/Value Results

Generic type for custom behavior. This type can be used for extended, non-predefined behavior.

{
    "TypeValueResults": [
        {
            "Ref": {
                "Uid": "bfe3352b6368428fa553fb4e78186071",
                "Tier": 140000,
                "Code": "Park",
                "Gid": 0
            },
            "Type": "",
            "Value": "",
            "Desc": "Buy for R1000 or more and receive free parking",
            "RecDesc": "Buy for R1000 or more and receive free parking",
            "Descriptions": [
                {
                    "Description": "Buy for R1000 or more and receive free parking",
                    "LanCode": "en-ZA"
                }
            ],
            "ReceiptDescriptions": [
                {
                    "Description": "Buy for R1000 or more and receive free parking",
                    "LanCode": "en-ZA"
                }
            ]
        }
    ]
}

Extra Article Results

Customer should be offered an item for a reduced price, or free. The available items are returned as well as the quantity of items.

{
    "ExtraArticleResults": [
        {
            "Ref": {
                "Uid": "4599d6d2bf174755a0e8c0e7b2a23b3e",
                "Tier": -105000,
                "Code": "SCO1",
                "Gid": 0
            },
            "Price": 0,
            "Options": [
                {
                    "ArticleId": "1490010",
                    "ColorId": "*",
                    "SizeId": "*",
                    "AddWithoutQuestion": true
                }
            ],
            "Desc": "Gratis artikel webtekst",
            "TriggerCouponIds": [],
            "RecDesc": "Gratis artikel bontekst",
            "Coupons": [],
            "Count": 1,
            "Descriptions": [
                {
                    "Description": "Gratis artikel webtekst",
                    "LanCode": "nl-NL"
                }
            ],
            "ReceiptDescriptions": [
                {
                    "Description": "Gratis artikel bontekst",
                    "LanCode": "nl-NL"
                }
            ]
        }
    ]
}
Name Description Type
Price The price for the item. Int
Options The options to choose from. Array

Note that you have to add elements to your basket with the explicit price as indicated in this result.

On this added item you have to keep track of the issed promotion code Ref.Code. This way you can maintain state. Subsequent /Calculate requests will keep returning this rewarded promotion and this way you know you already added the free item to the transaction. This also allows you to remove items from your basket when the promo conditions do not longer apply (e.g. when customer removes items from basket).

Pre-Calculate Results

Contains results of the requested pre-calculate elements.

Name Description Type
PreCalculateResultElementKey Reference to input element string
PreCalculateResultAmount Approximation of rewarded discount amount int
Unlock Whether this element unlocks a sale boolean

Example request:

{
    "Request": {
        "Sales": [
            ...
        ],
        "TransactionAttributes": [          
            {
                "Uid": "80c2475de51846fc815fc3420e8a7cdc",
                "Value": "LOYALTY-VOUCHER-1",
                "PreCalculate": true
            }
        ]
    }
}

Example response:

{
    "PreCalculateResults": [
        {
            "Uid": "80c2475de51846fc815fc3420e8a7cdc",
            "DiscountAmount": 100
        }
    ]
}

This response indicates this specific voucher would give 1,- discount (approximated).

Properties:

Name Commentary
Uid Reference to input element
DiscountAmount Pre-calculated discount
Unlock Whether the input element would unlock a sale
BonusPointResults To be collected bonus points
TransactionAttributeUids Other voucher input elements that would together with the specified input element trigger the result

Message Results

Customer should be displayed a message.

{
    "MessageResults": [
        {
            "Ref": {
                "Uid": "",
                "Tier": -129875,
                "Code": "Melding ALC-DE"
            },
            "Desc": "Melding Alcohol",
            "Msg": "",
            "Key": "37",
            "RecDesc": "",
            "Descriptions": [
                {
                    "Description": "Melding Alcohol",
                    "LanCode": "de-DE"
                }
            ]
        }
    ]
}

Remove Lock Results

Indicates that a sales blockage can be removed. Customer should be able to purchase an item that is locked.

Example:

"RemoveLockResults": [
    {
        "Ref": {
            "Uid": "53287cce77db46fb908d394f73f06ef1",
            "Tier": -127187,
            "Code": "mock-code",
            "Gid": 1
        },
        "UnlockCode": "mock-unlock-code",
        "Count": 1,
        "Descriptions": [
            {
                "Description": "mock-description",
                "LanCode": "nl-NL"
            }
        ]
    }
]

Properties:

Name Commentary
UnlockCode The specific unlock code. This matches the code that is defined on item
Count Number of items to unlock
Descriptions Promotion descriptions

Summary

Contains summarized information about the calculation result, grouped by promotion code.

{
    "Summary": {
        "PerPemEntry": [
            {
                "Code": "001",
                "QtyThis": 1,
                "Type": "Loyalty",
                "PrintAlways": false,
                "IsHybrid": false
            },
            {
                "Code": "01234",
                "QtyThis": 1,
                "Type": "Financial"
            },
            {
                "Code": "631",
                "QtyThis": 1,
                "Type": "Financial"
            }
        ]
    }
}
  • Code Promotion code
  • QtyThis Number of times this promotion is rewarded in this basked
  • CountLimit Limit of the number of times this promotion can be rewared
  • CountPrior Number of times this promotion was rewarded before
  • Type Promotion type