0

Create a summary

by
Published Oct 17, 2025

Creates a new AR summary.

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 summary
7
 * Creates a new AR summary.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		name?: string
16
		summaryCreationType?: 'system' | 'manual'
17
		glPostingDate?: string
18
		recordType?: 'invoice' | 'payment' | 'adjustment' | 'discount' | 'overpayment'
19
		totalAmount?: string
20
		state?: 'open' | 'closed'
21
		parent?: { key?: string; id?: string; href?: string }
22
		preventGLPosting?: false | true
23
		isQuickPaymentSummary?: false | true
24
		status?: 'active' | 'inactive'
25
		entity?: { key?: string; id?: string; name?: string; href?: string }
26
	} & {}
27
) {
28
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/accounts-receivable/summary`)
29

30
	const response = await fetch(url, {
31
		method: 'POST',
32
		headers: {
33
			'Content-Type': 'application/json',
34
			Authorization: 'Bearer ' + auth.token
35
		},
36
		body: JSON.stringify(body)
37
	})
38
	if (!response.ok) {
39
		const text = await response.text()
40
		throw new Error(`${response.status} ${text}`)
41
	}
42
	return await response.json()
43
}
44