OrderAPI: OrderServiceCharge vs. OrderLineItemTax

Hi, I'm a developer working with Square OrderAPI. I have a question regarding how to add service charges to a checkout form that are visible to the customer during checkout. Ex: "To-Go Fee", "Delivery Fee", "Processing Fee" etc...

There are two methods I am trying to get the fees to show up on the checkout form. The first is to create an OrderServiceCharge object and add my service charge. In this example, I am calling it "Test Service Charge" and I expect to see it as a listed fee, on my checkout form.


However, I am required to pass in a CalculationPhase - either "SUBTOTAL_PHASE" or "TOTAL_PHASE" and in doing so, the end result is just the amount of that fee added to my subtotal or total. The name of the fee is not visible to the customer. This approach is not acceptable.


The next approach I tried is to create a OrderLineTaxItem. I called this item "Test Tax" and passed in my stringified value of 8.25. This method does show up on my form.


The thing I don't like about using OrderLineTaxItem for fees other than taxes and other variable/percentage fees is that you must calculate the percentage. For fixed fee's I can't gurantee I will always get the right precision to calculate the right amount of fee. 


So, what am I missing about OrderServiceCharge? How can I use that object without adding the calculatedPhase so that it the amount of the fee isn't just added to the total or sub-total?


Here is my code:

var order = new Order(
                  LocationId: squareAccountModel.Location.Id,
                  LineItems: lineItems,
                  Taxes: new List<OrderLineItemTax>
                      new OrderLineItemTax { Name = "Test Tax", Percentage = business.SalesTaxAmount.ToString() },
                  ServiceCharges: new List<OrderServiceCharge>()
                      new OrderServiceCharge { Name = "Test Service Charge", AmountMoney = new Money(1000"USD")}

Here is the screenshot generated from my code:

Annotation 2019-11-27 140002.jpg

Message 1 of 4

Hey @Knowtifyd. It looks like your post was caught in our spam filter, I'm sorry about that!


I've just escalated your post to our API team and I'll follow up here as soon as I can.


Seller Community Manager, Square

Did you find help in the Seller Community? Mark a Best Answer to help others!
Find step-by-step help in our Support Center
Message 2 of 4

We're having the same problem, was this ever resolved?

Message 3 of 4

You can resolve this by using the new Web Payments SDK.

Message 4 of 4