Skip to content

Check discount coupons

Through this call, it is verified if one or more discount coupons can be applied and the effects they produce on the sale.

Access method

POST activity/discountcouponcheck

Request structure

  • DiscountCouponCodes: (list). Array of discount coupons to check.
    • (string): Discount coupon identifier.
  • Sale: (object). Sale information.
    • Products: (list). Array of products.
      • Id: (string). Unique identifier of the product generated by the partner.
      • ProductId: (string). Product identifier.
      • Price: (decimal). Product price.
      • AccessDate: (date) Optional. Product access date.

Request example

{
    "DiscountCouponCodes": 
    [
        "CC20201%"
    ],
    "Sale": 
    {
        "Products": 
        [
            {
                "Id": "uniqueId",
                "ProductId": "v1swa4y7monf5",
                "Price": 25
            }
        ]
    }
}

Response structure

  • DiscountCoupons: (list). Discount coupon result summary.
    • Id: (string). Discount coupon identifier.
    • Code: (string). Discount coupon code.
    • Name: (string). Discount coupon name.
    • Description: (string). Discount coupon description.
    • IsValid: (boolean). true if the coupon is valid, otherwise false.
  • Sale: (object). Sale information.

    • Products: (list). Product list.
      • Id: (string). Unique identifier of the product generated by the partner. It is used to identify which specific product the discount applies to when there are several identical products in the cart.
      • ProductId: (string). Product identifier.
      • Price: (decimal). Final price after applying discounts.
      • Discounts: (decimal). Total discount applied.
      • PriceWithoutDiscounts: (decimal). Product price before applying discounts.
      • AppliedCoupons: (list). Applied coupons.

        • Id: (string). Discount coupon identifier.
        • Code: (string). Discount coupon code.
        • Discount: (decimal). Discount generated by the coupon.
        • AppliesTo: (byte). Indicates which price the discount is applied to.

          Possible values
          • 0: indicates that the discount has been applied to the original product price.
          • 1: indicates that the discount has been applied to the current product price (original price minus discounts generated by other discount coupons).
        • Name: (string). Discount coupon name.

        • Description: (string). Discount coupon description.
        • Order: (int). Discount coupon request order.
        • PriceModifierType: (byte). Indicates the discount type.

          Possible values
          • 1: percentage discount.
          • 3: absolute value discount.
        • PriceModifierValue: (byte). Applied discount amount. Its interpretation depends on the value of the PriceModifierType attribute.

  • Success (boolean): value that indicates whether the call was processed correctly or not.

  • Timestamp (dateTime): time at which the request was processed. ISO 8601 format (yyyy-MM-ddThh:mm:ss.fffffff).
  • ErrorMessage (string): error message explaining why the request was not successful. If it was correct, it will return null.
  • ErrorCodes (string[]): list of codes that identify the errors that occurred in the call.
  • ErrorEntityBreakDown (list): list that contains objects with the name and ID in case of error.
    • Id (string): identifier
    • Name (string): related name of the identifier.

Response example

{
    "DiscountCoupons": 
    [
        {
            "Code": "CC20201%",
            "IsValid": true,
            "Name": "Name",
            "Description": "A description",
            "Id": "a1swa4y5monf4"
        }
    ],
    "Sale": 
    {
        "Products": 
        [
            {
                "Id": "uniqueId",
                "ProductId": "v1swa4y7monf5",
                "AppliedCoupons": 
                [
                    {
                        "Id": "yik6xjaha6ye6",
                        "Code": "CC20201%",
                        "Discount": 0.25,
                        "AppliesTo": 1,
                        "Name": "Coca Cola 2020 1%",
                        "Description": "1 % de descuento sobre todo el carrito",
                        "Order": 1,
                        "PriceModifierType": 1,
                        "PriceModifierValue": 1
                    }
                ],
                "PriceWithoutDiscounts": 25,
                "Price": 25.25,
                "DiscountsAmount": 0.25
            }
        ],
        "PriceWithoutDiscounts": 25,
        "DiscountsAmount": 0.25
    },
    "Success": true,
    "Timestamp": "2021-02-18T17:02:27.8165916"
}