fix: apply 6.35% CT Sales Tax to all order line items
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 <noreply@anthropic.com>
This commit is contained in:
parent
5777788127
commit
bb878c2a8a
@ -310,15 +310,24 @@ export async function createSquareOrder(params: {
|
|||||||
}]
|
}]
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
|
const CT_TAX_UID = 'ct-sales-tax'
|
||||||
|
|
||||||
const { result } = await client.ordersApi.createOrder({
|
const { result } = await client.ordersApi.createOrder({
|
||||||
idempotencyKey: params.idempotencyKey,
|
idempotencyKey: params.idempotencyKey,
|
||||||
order: {
|
order: {
|
||||||
locationId: process.env.SQUARE_LOCATION_ID!,
|
locationId: process.env.SQUARE_LOCATION_ID!,
|
||||||
lineItems: params.lineItems.map((li) => ({
|
taxes: [{
|
||||||
|
uid: CT_TAX_UID,
|
||||||
|
name: 'CT Sales Tax',
|
||||||
|
percentage: '6.35',
|
||||||
|
scope: 'LINE_ITEM',
|
||||||
|
}],
|
||||||
|
lineItems: params.lineItems.map((li) => ({
|
||||||
...li,
|
...li,
|
||||||
// Catalog object IDs only exist in production — strip them in sandbox
|
// Catalog object IDs only exist in production — strip them in sandbox
|
||||||
// so Square treats each line item as a custom (ad-hoc) entry instead.
|
// so Square treats each line item as a custom (ad-hoc) entry instead.
|
||||||
catalogObjectId: isSandbox ? undefined : li.catalogObjectId,
|
catalogObjectId: isSandbox ? undefined : li.catalogObjectId,
|
||||||
|
appliedTaxes: [{ taxUid: CT_TAX_UID }],
|
||||||
})),
|
})),
|
||||||
customerId: params.customerId,
|
customerId: params.customerId,
|
||||||
serviceCharges: serviceCharges,
|
serviceCharges: serviceCharges,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user