0

Create a joint payee

by
Published Oct 17, 2025

Creates a new joint payee.

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 joint payee
7
 * Creates a new joint payee.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		name?: string
16
		printAs?: string
17
		bill?: { href?: string; key?: string; id?: string }
18
	} & {}
19
) {
20
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/accounts-payable/joint-payee`)
21

22
	const response = await fetch(url, {
23
		method: 'POST',
24
		headers: {
25
			'Content-Type': 'application/json',
26
			Authorization: 'Bearer ' + auth.token
27
		},
28
		body: JSON.stringify(body)
29
	})
30
	if (!response.ok) {
31
		const text = await response.text()
32
		throw new Error(`${response.status} ${text}`)
33
	}
34
	return await response.json()
35
}
36