From bb878c2a8a2fe6a573ebfdb470e7e91f5c52961f Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 11 May 2026 15:46:36 -0400 Subject: [PATCH] fix: apply 6.35% CT Sales Tax to all order line items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tax was $0 on first production order — catalog items don't have tax configured in Square Dashboard. Apply it programmatically via an ad-hoc LINE_ITEM scoped tax on every line item. Delivery remains untaxed (service charge taxable: false). Co-Authored-By: Claude Sonnet 4.6 --- estore/src/lib/square.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/estore/src/lib/square.ts b/estore/src/lib/square.ts index 83347c7..427b873 100644 --- a/estore/src/lib/square.ts +++ b/estore/src/lib/square.ts @@ -310,15 +310,24 @@ export async function createSquareOrder(params: { }] : undefined + const CT_TAX_UID = 'ct-sales-tax' + const { result } = await client.ordersApi.createOrder({ idempotencyKey: params.idempotencyKey, order: { - locationId: process.env.SQUARE_LOCATION_ID!, - lineItems: params.lineItems.map((li) => ({ + locationId: process.env.SQUARE_LOCATION_ID!, + taxes: [{ + uid: CT_TAX_UID, + name: 'CT Sales Tax', + percentage: '6.35', + scope: 'LINE_ITEM', + }], + lineItems: params.lineItems.map((li) => ({ ...li, // Catalog object IDs only exist in production — strip them in sandbox // so Square treats each line item as a custom (ad-hoc) entry instead. catalogObjectId: isSandbox ? undefined : li.catalogObjectId, + appliedTaxes: [{ taxUid: CT_TAX_UID }], })), customerId: params.customerId, serviceCharges: serviceCharges,