question

adil avatar image
adil asked David Marginian answered

Subtotal not updating correctly for atomic orders.

I have made an atomic order with one line item $45.

then i added another line item with negative price (-$45).

total is not updating , so i called the order update api and updated the total to (0).

then i called order get api and the result seemed perfect like below (total is 0, negative line item is there).

{
    "href": "https://sandbox.dev.clover.com/v3/merchants/WAR2P9Z6AWV21/orders/JBMG1XJKSTD7T",
    "id": "JBMG1XJKSTD7T",
    "currency": "USD",
    "employee": {
        "id": "3V4N3T7G2GSB4"
    },
    "total": 0,
    "paymentState": "OPEN",
    "taxRemoved": false,
    "isVat": false,
    "state": "OPEN",
    "manualTransaction": false,
    "groupLineItems": false,
    "testMode": false,
    "createdTime": 1624604798000,
    "clientCreatedTime": 1624604792000,
    "modifiedTime": 1624604829000,
    "lineItems": {
        "elements": [
            {
                "id": "E7436PM0W7Y3P",
                "orderRef": {
                    "id": "JBMG1XJKSTD7T"
                },
                "item": {
                    "id": "P8FW7FSSCBCTJ"
                },
                "name": "1 Hour Off-Peak",
                "alternateName": "",
                "price": 4500,
                "unitQty": 1000,
                "unitName": "piece",
                "itemCode": "PHO",
                "printed": false,
                "createdTime": 1624604798000,
                "orderClientCreatedTime": 1624604792000,
                "exchanged": false,
                "refunded": false,
                "isRevenue": true
            },
            {
                "id": "VHJJCW43E72ZC",
                "orderRef": {
                    "id": "JBMG1XJKSTD7T"
                },
                "name": "adil's membership redemption",
                "price": -4500,
                "printed": false,
                "createdTime": 1624604827000,
                "orderClientCreatedTime": 1624604792000,
                "exchanged": false,
                "refunded": false,
                "isRevenue": true
            }
        ]
    }
}

But the problem is when i view the same order in android emulator it is showing the total as $45. why ?

also in the reciept it is not updated correctly. what should i do ?

reciept link: https://sandbox.dev.clover.com/r/JBMG1XJKSTD7T

1624606376602.png

REST APIEmulator
1624606376602.png (399.7 KiB)
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
David Marginian avatar image
David Marginian answered

We don't support negative amounts for line items. I am guessing register doesn't like that and is converting it to a postive number. If you need a negative item you would use a discount, not a normal line item.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community