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:
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:
- 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
- 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:
- The shown tax of $0.13 is incorrect, and its actually $0.77 in tax
- 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!