Adding Service charges in Line Item

We want to add Service charges on Line Items, we are able to add Service charges on the entire Order but not on a single Line Item.

Request

result = client.orders.create_order(
  body = {
    "order": {
      "location_id": "LR6QAWGZD3DDN",
      "customer_id": "7TTBK00HX1N05RAXS3ECQGHY1R",
      "line_items": [
        {
          "name": "tea",
          "quantity": "2",
          "item_type": "ITEM",
          "applied_service_charges": [
            {
              "uid": "101",
              "service_charge_uid": "101"
            }
          ],
          "base_price_money": {
            "amount": 500,
            "currency": "JPY"
          }
        },
        {
          "name": "Coffee",
          "quantity": "3",
          "item_type": "ITEM",
          "base_price_money": {
            "amount": 300,
            "currency": "JPY"
          }
        }
      ],
      "discounts": [
        {
          "uid": "101",
          "name": "line item",
          "percentage": "10",
          "scope": "LINE_ITEM"
        }
      ],
      "service_charges": [
        {
          "uid": "101",
          "name": "charge",
          "amount_money": {
            "amount": 150,
            "currency": "JPY"
          },
          "calculation_phase": "TOTAL_PHASE",
          "treatment_type": "LINE_ITEM_TREATMENT",
          "scope": "LINE_ITEM"
        }
      ]
    },
    "idempotency_key": "c9974015-2be5-4d7a-9da5-5755fd200e2b"
  }
)

if result.is_success():
  print(result.body)
elif result.is_error():
  print(result.errors)

Response

{
  "errors": [
    {
      "code": "BAD_REQUEST",
      "detail": "Unexpected calculation phase SURCHARGE_TOTAL_PHASE for applied service charge custom-surcharge:101.",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

This is correct. The service charge can be applied to an order but it’s not scoped to line items at this time. :slightly_smiling_face: