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,