4WS Suite
Home
API Reference
  • Data mangement API
  • Documents API
Home
API Reference
  • Data mangement API
  • Documents API
Fourwayshop
  1. Use cases
  • Four Way Shop API
  • Before start develop
  • Why we use Resource-oriented design
  • Technical Prerequisites
  • Concepts
    • Date Handling
    • Managing Languages
    • Handling Field Updates and Null Values in Service Requests
    • ISO Code
    • Vat rates
    • Product structure
    • Product Images
    • Product dimensions
    • Product pricing
    • Dimension group vs Dimension grouping
    • Subjects overview
    • Documents structure
  • Best Practices
    • Best Practices for Error Handling in External System
    • How Testing callback response
    • Best Practices for delopers
  • Data management
    • Authentication
    • Rate Limits
    • Paginated Responses
    • Getting Started
    • API Changelog
    • Use cases
      • Cataloging a Dimension
      • Creating a New Product
      • Retriving a product details
      • Defining Product Pricing
      • Updating External System Product Catalog
      • Activate product variants and add barcodes to SKUs
      • Move a Barcode from One Product to Another
    • API
      • Login
        • login
      • Product
        • Brand
          • Get All Brands
          • Get A Brand
          • Insert brand
          • Update brand
        • Season
          • Get All Seasons
          • Get A Season
          • Insert season
          • Update season
        • Attribute
          • Get All Attribute Types
          • Get Attribute Type
          • Get Attribute
          • Insert attribute
          • Update attribute
        • Hierarchy
          • Insert hierarchy
          • Update hierarchy
        • Dimension groups
          • Insert dimension group
          • Update dimension group
        • Dimension
          • Insert dimension
          • Update dimension
          • Delete dimension
        • Product
          • Get products
          • Get product
          • Get product grouping
          • Get SKU's barcodes
          • Get product stock
          • Insert product
          • Update product
        • Activate dimensions on products
          • Insert active dimensions
          • Delete active dimensions
        • Barcode
          • Get SKU from barcode
          • Generate missing barcodes
          • Generate missing barcode for SKU
          • Insert barcode
          • Delete barcode
        • Prices
          • Get product prices
        • Price dimension groupings
          • Get Dimension Price Grouping
          • Get All Dimension Price Grouping
          • Insert dimension grouping
          • Update dimension grouping
          • Delete dimension grouping
        • Assortment
          • insert product assortment
          • delete product assortment
        • Image
          • Get images
          • Add image
          • Replace image
          • Delete image
        • Supplier
          • Get Item suppliers
          • Insert item supplier
          • Delete item supplier
          • Update item supplier
        • Custom category
          • Get Custom code
          • Insert Custom code
          • Update Custom code
        • Vat
          • Vat types
            • Get VAT type
            • Get VAT types
          • VATs
            • Get VATs
            • Get VATs by type
            • Get VAT
          • Vat rates
            • Get VAT rates
            • Get single VAT rates
        • Stock
          • Insert stock
          • Get stock
      • Price lists
        • Get price lists
        • Get price lists by type
        • Get price list
        • Get prices from price list
        • Get entities from price lists
        • Insert Price List
        • Insert Product Price
        • Insert Entity On Price Lists
        • Update price list
        • Delete all product prices
        • Delete single product price
        • Delete entity from a price lists
      • Supplier
        • Supplier contacts
        • Supplier addresses
        • Get Suppliers
        • Get A Specific Supplier
        • Insert supplier
        • Update supplier
      • Entities
        • Get entities
        • Get entity
        • Insert entity
        • Update entity
      • Miscellaneous
        • Get requests rate limits
      • Catalog
        • Get Catalogs details
        • Get Catalog details by Code
        • Get products by Catalog Code
      • Export
        • Get bulk CSV Export
  • Documents
    • Authentication
    • Paginated responses
    • Managing API Callbacks
    • Document notifications
    • Customer promo data notifications
    • Use cases
      • Updating External System Stock
      • E-commerce Recipt Processing
      • E-commerce Return Receipt Processing
      • E-commerce Order sale Processing
      • E-commerce Return Order Processing
      • E-commerce Order Handling and Internal Stock Transfer
      • E-commerce & Gift Card
      • Creating a free entry
      • Retrieving a Document by Identifier
      • Cart Validation Service
      • Sale and Shipping costs
      • Handling Line Item Discounts
      • Managing Price Forcing in Cart Items
      • Purchase Order Registration
      • Supplier Goods Entry From Purchase Order
      • Update an Orchestrated Order
      • New Orchestrated Return Orders
    • API
      • Document Manager
        • Orders
          • Save Sale Order
          • Save Return Order
        • Orchestrated Orders
          • Orchestrated Order
          • Orchestrated Return order
          • Orchestrated Update order
        • Cart
          • Cart Validation
          • Cart Full Validation
        • Sales
          • Save receipt
          • Salve only Order
          • Replace or update sale
          • Get last digital order
        • Warehouse
          • Save Entry from supplier
          • Save Transfer document
          • Save Free Entry
        • Purchase
          • Save Purchase
        • Get Document
        • Update Document external references
      • Customer
        • Get Customer
        • Set Customer Opt-in
      • Loyalty vouchers
        • Get customer loyalty vouchers
        • Get loyalty vouchers at a time interval
        • Get last loyalty vouchers
      • Giftcard
        • Get Giftcard
        • Update Giftcard
        • Generate Gift Card Barcode
        • Gift Card PDF Generation
      • Stock
        • Get Stock
        • Get last stock
        • Insert Stock
  • 🚫 KeepIT
    • Authentication
    • Use cases
    • Articles (deprecated)
      • Get Articles
      • Insert/Update dimensional groups
      • Insert/Update price groupings
      • Insert/Update dimensions
      • Insert/Update attributes
      • Insert/Update hieararchies
      • Insert/Update seasons
      • Insert/Update articles
      • Insert/Update Articles Master data
      • Insert/Update Lists
      • Insert/Update Dimensions Groups
      • Create EAN13 barcode
      • Insert/Update Barcode
      • Assign dimensions to groupings
    • Price Lists (deprecated)
      • Insert price list
      • Add entity to price list
      • Add item price to price list
      • Insert sale profile
      • Insert sale period
      • Add item price to sale period
    • Stock (deprecated)
      • Get Stock
      • Get Stock Date
      • Get Stock CSV
      • Insert/Update Stock
    • Sales (deprecated)
      • Insert/Update sales
      • Delete sales
      • Upload printer sales archive
    • Deposit (deprecated)
      • Insert/Update deposits
    • Services
      • Insert/Update services
      • Delete services
    • Points
      • Insert/Update points
      • Calculate and Insert/Update Points
      • Delete points
    • Subjects
      • Check customers
      • Anonymize customers
      • Get subject data
      • Get customer discount
      • Insert/Update customer
      • Insert/Update billing customers
      • Insert/Update CRM customer
      • Insert/Update children
      • Change/Replacement card
      • Insert CRM user
    • Giftcards & Vouchers
      • Get giftcard
      • Insert/Update giftcards
      • Insert/Update Vouchers
    • Missed Opportunity
      • Get Lost Opportunities
      • Insert/Update missed opportunities
      • Delete missed opportunity
    • Documents (deprecated)
      • Insert documents
      • Get document
    • Catalogs
      • Get Catalog
      • Insert/update catalog
      • Insert/Update hierarchies item catalog
      • Insert/Update entity clusters
    • Suppliers (deprecated)
      • Insert/Update tailor
      • Insert/Update supplier
    • Export (deprecated)
      • Get Items Export
      • Get Barcodes Export
      • Get Prices Export
      • Get Customers Export
      • Get Suppliers Export
      • Get Sales Export
      • Get Movements Export
      • Get Vouchers Export
    • Configuration Mobile Shop (deprecated)
      • Insert/Update Entities
      • Insert Seller
    • Mappings
      • Insert Mappings
      • Get Mappings
  1. Use cases

Handling Line Item Discounts

Handling Line Item Discounts#

Overview#

This document outlines the process for managing line item discounts within the cart of an e-commerce platform. The e-commerce system allows the application of discounts to individual products (line items) when sending the cart for validation or saving the sale.

Discount Fields#

When applying a discount to a line item, the following fields should be used:
discount: This field specifies the value of the discount applied to the line item. Depending on the type of discount (discountType), this value can be either a percentage or a fixed amount.
If discountType is set to P (percentage), the value in discount should represent a percentage (e.g., 10 for a 10% discount).
If discountType is set to N (value), the value in discount should represent a fixed monetary amount (e.g., 10 for a $10 discount).
discountType: This field indicates the type of discount being applied. It can take on one of the following two values:
P: Represents a percentage-based discount.
N: Represents a fixed value discount.
discountReason: This field contains the code representing the reason for the discount. The discount reasons are pre-defined within the system and can be configured in the suite. These discount reasons can also be utilized by Mobile Shop to enable sales associates to apply manual discounts.
discountReasonDescription: This field provides a description of the discount reason code. It should clearly explain why the discount was applied to the line item.

Example#

Here is an example of how these fields would be populated in a cart's line item:
Row percentage discount
Row amount discount
In this case, a 10% discount has been applied to the line item because the discountType is set to "P". The discount value can be seen in the discountPerc attribute, while the discount code and reason are provided in the discountReason and discountReasonDescription attributes, respectively.
{
"transactionId": "{% faker datatype.uuid %}",
"movementType": "V",
"barcodeInfo": "{{ean13}}",
"currency": "EUR",
"currencySymbol": "€",
"branchCode": "9999",
"entityCode": "501",
"docNumberDigital": "{% faker random.numeric %}",
"docNumber": "TICKET_{% faker random.numeric %}",
"endDate": "2024-07-22 10:07:49",
"startDate": "2024-07-22 10:07:49",
"deliveryDate": "2024-07-22 10:07:49",
"clientDenomination": "Mario Rossi",
"discountsManualCumulative": "N",
"registerCode": "1",
"clientId": "11111",
"ticket": 240905,
"rounding": 2,
"onlineValidation": "Y",
"seller": "Marco Bianchi",
"sellerId": 1001,
"filling": "FIRST",
"callback": "https://webhook.site/782f0878-03b5-47ff-86b3-0f555bdca511",
"items":
[
    {
        "rowId": "{% faker datatype.uuid %}",
        "rowType": "ITEM",
        "barcode": "8058251375998",
        "barcodeType": "EAN13",
        "unitPrice": 215,
        "qty": 1,
        "qtyType": "N",
        "itemState": "SERVER_OK",
        "taxRate": 22,
        "vatCode": 4,
        "rowVat": 34.89,
        "rowTotal": 193.5,
        "description": "Descrizione del prodotto",
        "discount": 30,
        "discountType": "P",
        "discountReason": "SC_RIGA_PERC",
        "discountReasonDescription": "Sconto riga percentuale",
        "itemType": "PRODUCT",
        "itemSubtype": "ITEM",
        "qtaConfirmed": "Y",
        "movementType": "V",
        "printerDepartmentCode": 1,
        "havingTailoring": "N",
        "itemCode": "033---00000",
        "currencySymbol": "€",
        "currency": "EUR",
        "rounding": 2,
        "oldUnitPrice": 215,
        "priceList": "80",
        "rowOrder": 1,
        "channel": "IN_STORE"
    }
],
"totals":
{
    "total": 193.5,
    "vat":34.89,
    "grandTotal": 193.5,
    "allowance": 0,
    "alreadyPayed": 0,
    "taxableIncome": 193.5,
    "digitalGrandTotal": 0,
    "totalDeposits": 0,
    "totalDepositsVat": 0
}
}

Validation and Save Process#

When the e-commerce system sends the cart for validation (Cart Validation Service) or to save the sale (for example E-commerce Recipt Processing with 4ws.trade or E-commerce Order sale Processing with 4ws.trade), each line item with an applied discount should include these fields. The system will use this information to correctly process the discount, ensuring it is reflected in the total sale and recorded for future reference.
Discount reasons
All discount reasons must be pre-configured in the suite to ensure consistency and accuracy in reporting and auditing. Sales associates applying manual discounts through Mobile Shop should select from these pre-defined reasons to maintain uniformity across all platforms.
Modified at 2024-08-14 20:30:38
Previous
Sale and Shipping costs
Next
Managing Price Forcing in Cart Items
Built with