What order are fees applied in?

37 views
Skip to first unread message

Arjun Nandkishore

unread,
Jul 18, 2016, 8:10:06 AM7/18/16
to deliverydotcom API V2
Apologies in advance for a somewhat fiddly post. I'm trying to understand what order fees/surcharges are applied in. As a test, I sent a GET request to /customer/cart/13431/ (which is one of the test merchants) without adding any items to cart. Relevant part of the response (lets call it response A):

    "subtotal":0,
    "tax":0.13,
    "total":3.6,
    "discount":0,
    "discount_percent":0.15,
    "fees":
        [
        {
            "name":"Healthy SF Surcharge",
            "value":1.54
        },
        {
            "name":"Convenience Fee",
            "value":0.18
        },
        {
            "name":"Delivery Fee",
            "value":1.75
        }
    ],



I then tried to compare this against the information I got about this merchant if I just do a GET request to /merchant/13431/ (with the same address supplied as in the cart request). Relevant part below (lets call this response B):

"fees":{
"sales_tax":0.08,
"delivery_charge":1.75,
"delivery_percent":0,
"other_fees":[
{
"description":"Convenience Fee",
"flat_fee":0,
"percent":0.1
}
]
}


I'm trying to match against the first response to see if I can understand how the fees are calculated, and use this to better filter restaurants based on user budgets etc (for instance, if the user wants to spend more/less, I know I can accommodate restaurants with lower/higher fees).

So, for instance, when the cart (response A) tells me that 'Convenience Fee' is $0.18 and the response B tells me that the convenience fee is 10%, I'm assuming the way this is working is:

10% * 1.75 = 0.18

where 1.75 is coming from the delivery charge. Is that right?

Beyond that, though, I'm lost. The only way I can make these numbers add up to the total shown in response A is that 1.75 + 1.54 + 1.8 + .13 = 3.6. However, this implies two things:
  1. The tax seems to be applied on top of all three other fees - this means that the tax of $0.13 is being charged on a pre-tax price (i.e. all the fees added together) of $3.47 - but that implies a tax rate of 4%, rather than the 8% suggested by response B, which means response B doesn't help me predict the tax rate that'll be applied
  2. The discount of 15% mentioned in response A isn't being applied anywhere?
Alternatively, if we assume that the $3.6 total is post-discount, then our pre-discount price is $4.24. If we subtract out our three fees, this leaves us with an unaccounted for amount of $0.77. Again, this means:

  1. The shown tax of $0.13 is incorrect, and its actually $0.77 in tax
  2. If so, then the true tax rate being applied here is 18% rather than 8%

I'm probably missing something obvious here, but help on exactly how these fees are all applied and in what order would be greatly appreciated. Thanks!

Tim O'Malley

unread,
Jul 18, 2016, 5:10:50 PM7/18/16
to deliverydotcom API V2
Hey Arjun,
We can answer this, but why are you asking? Anything we tell you would be subject to change, so it doesn't make sense for you to handle this logic on your side. We much prefer that you hit the GET cart endpoint and just show the user what we return. 

gregory hutchinson

unread,
Sep 23, 2016, 10:40:09 PM9/23/16
to deliverydotcom API V2
Hey Tim,

I have a similar question; the reason I care about the fees (maybe not to the degree that Arjun does above...) is that I'm building an app that will filter restaurants / menus / etc based on a budget the user provides pre-cart creation... so I guess, what I'd like to know is what is source of truth...
is the GET cart endpoint the full Truth (capital T) and if so it seems there isn't really anyway to determine what Im looking to do if I require knowing the all the fees before creating a cart (since I'm getting the users budget pre-cart creation...) 

Not sure if this is clear... I can try to clarify if needed...
I can provide more information as needed offline as well.


Cheers!

hkim

unread,
Sep 29, 2016, 2:31:11 PM9/29/16
to deliverydotcom API V2
Hi Arjun and Greg, 

Unfortunately, there is no part of our API that gives detailed enough fee information to explain all the details of the fee calculation. Also, some fees are completely based on the cart subtotal so it wouldn't be possible to set the fees breakdown until after a restaurant has been chosen and items selected. Thanks.

gregory hutchinson

unread,
Oct 1, 2016, 10:57:08 PM10/1/16
to deliverydotcom API V2
Ok thanks - looks like I'll have to just keep doing what I am currently doing and aborting the flow / restarting if we see a discrepancy in fees from what we originally had... until I can figure out a better UX for the type of app I'm building.

Appreciate the response.

Reply all
Reply to author
Forward
0 new messages