Order Calculation with Discount and Service Charges

We have a requirement to sell our products in perfect tens (fractional argument)

For example - We have product A of price 915, we apply a 10% discount and a 5% service charge, and we get a total of 865. To make it in perfect tens we need to remove the last digit 5.

So in square if we add 5 (amount) as a discount, the total goes to 859 and if we add 4 (amount) as a discount total goes to 861.

Please help us to make it 860.

When we’ve added a discount of 4

{
    "order": {
        "id": "s52VttHSYFJRrIiI8huID13SqYNZY",
        "location_id": "L4VN08BBCV0Z7",
        "line_items": [
            {
                "uid": "nKIQDKbH4fs3e0WKTSL2QC",
                "quantity": "1",
                "name": "Fanta",
                "base_price_money": {
                    "amount": 915,
                    "currency": "JPY"
                },
                "gross_sales_money": {
                    "amount": 915,
                    "currency": "JPY"
                },
                "total_tax_money": {
                    "amount": 0,
                    "currency": "JPY"
                },
                "total_discount_money": {
                    "amount": 95,
                    "currency": "JPY"
                },
                "total_money": {
                    "amount": 820,
                    "currency": "JPY"
                },
                "variation_total_price_money": {
                    "amount": 915,
                    "currency": "JPY"
                },
                "applied_discounts": [
                    {
                        "uid": "peLrCpSPCYrz3yYQ2huFqC",
                        "discount_uid": "wmK6WsKKXQDGCUkTI8D1PB",
                        "applied_money": {
                            "amount": 91,
                            "currency": "JPY"
                        }
                    },
                    {
                        "uid": "soajMUY5HFavHo9Bq5FjI",
                        "discount_uid": "QLbE0CSkFy7bIQEQVP5rAC",
                        "applied_money": {
                            "amount": 4,
                            "currency": "JPY"
                        }
                    }
                ],
                "item_type": "ITEM",
                "total_service_charge_money": {
                    "amount": 0,
                    "currency": "JPY"
                }
            }
        ],
        "discounts": [
            {
                "uid": "wmK6WsKKXQDGCUkTI8D1PB",
                "name": "Discount percent (ORDER)",
                "percentage": "10",
                "applied_money": {
                    "amount": 91,
                    "currency": "JPY"
                },
                "type": "FIXED_PERCENTAGE",
                "scope": "ORDER"
            },
            {
                "uid": "QLbE0CSkFy7bIQEQVP5rAC",
                "name": " Fractional Discount amount (ORDER)",
                "amount_money": {
                    "amount": 4,
                    "currency": "JPY"
                },
                "applied_money": {
                    "amount": 4,
                    "currency": "JPY"
                },
                "type": "FIXED_AMOUNT",
                "scope": "ORDER"
            }
        ],
        "created_at": "2024-05-24T06:29:04.184Z",
        "updated_at": "2024-05-24T06:29:04.184Z",
        "state": "OPEN",
        "version": 1,
        "total_tax_money": {
            "amount": 0,
            "currency": "JPY"
        },
        "total_discount_money": {
            "amount": 95,
            "currency": "JPY"
        },
        "total_tip_money": {
            "amount": 0,
            "currency": "JPY"
        },
        "total_money": {
            "amount": 861,
            "currency": "JPY"
        },
        "service_charges": [
            {
                "uid": "qQ8cNcJkl5qdrwArSznPkC",
                "name": "Surplus percent (ORDER)",
                "percentage": "5",
                "applied_money": {
                    "amount": 41,
                    "currency": "JPY"
                },
                "calculation_phase": "TOTAL_PHASE",
                "taxable": false,
                "total_money": {
                    "amount": 41,
                    "currency": "JPY"
                },
                "total_tax_money": {
                    "amount": 0,
                    "currency": "JPY"
                },
                "type": "CUSTOM",
                "treatment_type": "LINE_ITEM_TREATMENT",
                "scope": "ORDER"
            }
        ],
        "total_service_charge_money": {
            "amount": 41,
            "currency": "JPY"
        },
        "net_amounts": {
            "total_money": {
                "amount": 861,
                "currency": "JPY"
            },
            "tax_money": {
                "amount": 0,
                "currency": "JPY"
            },
            "discount_money": {
                "amount": 95,
                "currency": "JPY"
            },
            "tip_money": {
                "amount": 0,
                "currency": "JPY"
            },
            "service_charge_money": {
                "amount": 41,
                "currency": "JPY"
            }
        },
        "source": {
            "name": "POS regi"
        },
        "net_amount_due_money": {
            "amount": 861,
            "currency": "JPY"
        }
    }
}

When we’ve added a discount of 5

{
    "order": {
        "id": "QTcojUk3imyoY1DQpILfLoqEHJ9YY",
        "location_id": "L4VN08BBCV0Z7",
        "line_items": [
            {
                "uid": "o18u77vB89D3wyRqd07smB",
                "quantity": "1",
                "name": "Fanta",
                "base_price_money": {
                    "amount": 915,
                    "currency": "JPY"
                },
                "gross_sales_money": {
                    "amount": 915,
                    "currency": "JPY"
                },
                "total_tax_money": {
                    "amount": 0,
                    "currency": "JPY"
                },
                "total_discount_money": {
                    "amount": 96,
                    "currency": "JPY"
                },
                "total_money": {
                    "amount": 819,
                    "currency": "JPY"
                },
                "variation_total_price_money": {
                    "amount": 915,
                    "currency": "JPY"
                },
                "applied_discounts": [
                    {
                        "uid": "wjWI1spkh1CQkPCs5JCrT",
                        "discount_uid": "TCGKysPV2hmRTbbQHhzZXD",
                        "applied_money": {
                            "amount": 91,
                            "currency": "JPY"
                        }
                    },
                    {
                        "uid": "WWRlRbgg3yprgc84Ik6oG",
                        "discount_uid": "4zmeMnKxg1PXsVsNc0iW0B",
                        "applied_money": {
                            "amount": 5,
                            "currency": "JPY"
                        }
                    }
                ],
                "item_type": "ITEM",
                "total_service_charge_money": {
                    "amount": 0,
                    "currency": "JPY"
                }
            }
        ],
        "discounts": [
            {
                "uid": "TCGKysPV2hmRTbbQHhzZXD",
                "name": "Discount percent (ORDER)",
                "percentage": "10",
                "applied_money": {
                    "amount": 91,
                    "currency": "JPY"
                },
                "type": "FIXED_PERCENTAGE",
                "scope": "ORDER"
            },
            {
                "uid": "4zmeMnKxg1PXsVsNc0iW0B",
                "name": " Fractional Discount amount (ORDER)",
                "amount_money": {
                    "amount": 5,
                    "currency": "JPY"
                },
                "applied_money": {
                    "amount": 5,
                    "currency": "JPY"
                },
                "type": "FIXED_AMOUNT",
                "scope": "ORDER"
            }
        ],
        "created_at": "2024-05-24T06:29:58.710Z",
        "updated_at": "2024-05-24T06:29:58.710Z",
        "state": "OPEN",
        "version": 1,
        "total_tax_money": {
            "amount": 0,
            "currency": "JPY"
        },
        "total_discount_money": {
            "amount": 96,
            "currency": "JPY"
        },
        "total_tip_money": {
            "amount": 0,
            "currency": "JPY"
        },
        "total_money": {
            "amount": 859,
            "currency": "JPY"
        },
        "service_charges": [
            {
                "uid": "Brh0KyfCUKocO9XibCj85B",
                "name": "Surplus percent (ORDER)",
                "percentage": "5",
                "applied_money": {
                    "amount": 40,
                    "currency": "JPY"
                },
                "calculation_phase": "TOTAL_PHASE",
                "taxable": false,
                "total_money": {
                    "amount": 40,
                    "currency": "JPY"
                },
                "total_tax_money": {
                    "amount": 0,
                    "currency": "JPY"
                },
                "type": "CUSTOM",
                "treatment_type": "LINE_ITEM_TREATMENT",
                "scope": "ORDER"
            }
        ],
        "total_service_charge_money": {
            "amount": 40,
            "currency": "JPY"
        },
        "net_amounts": {
            "total_money": {
                "amount": 859,
                "currency": "JPY"
            },
            "tax_money": {
                "amount": 0,
                "currency": "JPY"
            },
            "discount_money": {
                "amount": 96,
                "currency": "JPY"
            },
            "tip_money": {
                "amount": 0,
                "currency": "JPY"
            },
            "service_charge_money": {
                "amount": 40,
                "currency": "JPY"
            }
        },
        "source": {
            "name": "POS regi"
        },
        "net_amount_due_money": {
            "amount": 859,
            "currency": "JPY"
        }
    }
}

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Apply Taxes and Discounts
Redeem Loyalty Points for a Discount (Walkthrough 1)
Square-Applied Order Discounts

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Our orders will let you override the price so you can make it a perfect tens. However if your going to apply any form of a percentage discount or service charge you will alway run into rounding issues given that we use bankers rounding to the half even. :slightly_smiling_face: