0

Update an Order Entry tax detail

by
Published Oct 17, 2025

Updates an existing Order Entry tax detail by setting field values. Any fields not provided remain unchanged.

Script sage_intacct Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type SageIntacct = {
3
	token: string
4
}
5
/**
6
 * Update an Order Entry tax detail
7
 * Updates an existing Order Entry tax detail by setting field values. Any fields not provided remain unchanged.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	key: string,
12
	body: {
13
		key?: string
14
		id?: string
15
		href?: string
16
		status?: 'active' | 'inactive'
17
		taxUniqueId?: string
18
		taxRate?: 'standard' | 'reduced' | 'exempt' | 'zero' | 'federal' | 'provincial'
19
		amountToTax?: 'fullAmount' | 'amountWithinRange'
20
		description?: string
21
		taxPercent?: number
22
		taxLimit?: {
23
			minTaxable?: number
24
			maxTaxable?: number
25
			minTax?: number
26
			maxTax?: number
27
		}
28
		reverseCharge?: false | true
29
		useExpenseAccount?: false | true
30
		isSystemGenerated?: false | true
31
		accountLabel?: { id?: string; key?: string; href?: string }
32
		taxAuthority?: { id?: string; key?: string; href?: string }
33
		salesGLAccount?: { id?: string; key?: string; href?: string }
34
		taxSolution?: { key?: string; id?: string; href?: string }
35
	} & { id?: {} }
36
) {
37
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/tax/order-entry-tax-detail/${key}`)
38

39
	const response = await fetch(url, {
40
		method: 'PATCH',
41
		headers: {
42
			'Content-Type': 'application/json',
43
			Authorization: 'Bearer ' + auth.token
44
		},
45
		body: JSON.stringify(body)
46
	})
47
	if (!response.ok) {
48
		const text = await response.text()
49
		throw new Error(`${response.status} ${text}`)
50
	}
51
	return await response.json()
52
}
53