0

Create a Purchasing tax detail

by
Published Oct 17, 2025

Creates a new Purchasing tax detail.

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
 * Create a Purchasing tax detail
7
 * Creates a new Purchasing tax detail.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		status?: 'active' | 'inactive'
16
		taxUniqueId?: string
17
		taxRate?: 'standard' | 'reduced' | 'exempt' | 'zero' | 'federal' | 'provincial'
18
		amountToTax?: 'fullAmount' | 'amountWithinRange'
19
		description?: string
20
		taxPercent?: number
21
		taxLimit?: {
22
			minTaxable?: number
23
			maxTaxable?: number
24
			minTax?: number
25
			maxTax?: number
26
		}
27
		reverseCharge?: false | true
28
		useExpenseAccount?: false | true
29
		isSystemGenerated?: false | true
30
		taxAuthority?: { id?: string; key?: string; href?: string }
31
		purchaseGLAccount?: { id?: string; key?: string; href?: string }
32
		taxSolution?: { key?: string; id?: string; href?: string }
33
	} & {}
34
) {
35
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/tax/purchasing-tax-detail`)
36

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