service charges with checkout api

hi -- I'm using checkout api and wanted to add shipping charges, but see an old post that it needed to be a line item.  I tried instead to make it a service charge, but despite appearing in the debug logging I was doing (and early errors due to bad input data), the generated checkout page never showed the service charge.  am I doing something wrong?  here's a snippet from my php code:

 

        $order_shipping = new \SquareConnect\Model\OrderServiceCharge();
        $order_shipping->setName($shipping_details['name']);
        $shipping_money = new \SquareConnect\Model\Money();
        $shipping_money->setAmount($shipping_details['cost'] * 100);
        $shipping_money->setCurrency("CAD");
        $order_shipping->setAmountMoney($shipping_money);
        $order_shipping->setCalculationPhase("SUBTOTAL_PHASE");
        $order_shipping->setTaxable(true);


        $shipping_tax = new \SquareConnect\Model\OrderLineItemAppliedTax();
        $shipping_tax->setTaxUid($taxUid);
        $order_shipping->setAppliedTaxes([$shipping_tax]);


        $order->setServiceCharges([$order_shipping]);

 

684 Views
Message 1 of 2
Report
1 REPLY 1
Square Community Moderator

Hey @rrrecords and welcome to the Community!

 

I checked in with our API team and unfortunately, service charges won't show as line items with the Checkout API.

 

They will be added to the total but won't show in the checkout itemization that the customer sees.

Ashley C
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
669 Views
Message 2 of 2
Report