0

Update a vendor payment provider

by
Published Oct 17, 2025

Updates an existing vendor payment provider by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionAdministration, Accounts Payable, Sage Cloud Services, Outbound Payment Services User typeBusiness user with admin permissions PermissionsList, View, Subscribe, Configure Application Subscriptions List, View, Edit Vendors

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 a vendor payment provider
7
 * Updates an existing vendor payment provider by setting field values. Any fields not provided remain unchanged.
8

9

10
Permissions and other requirements
11

12
SubscriptionAdministration, Accounts Payable, Sage Cloud Services, Outbound Payment Services
13
User typeBusiness user with admin permissions
14
PermissionsList, View, Subscribe, Configure Application Subscriptions List, View, Edit Vendors
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	key: string,
23
	body: {
24
		key?: string
25
		id?: string
26
		href?: string
27
		paymentProvider?: {
28
			key?: string
29
			id?: string
30
			name?: string
31
			href?: string
32
		}
33
		vendor?: { key?: string; id?: string; name?: string; href?: string }
34
		state?:
35
			| 'requestInitiated'
36
			| 'inProgress'
37
			| 'requestReceived'
38
			| 'requestFailed'
39
			| 'awaitingAuthorization'
40
			| 'subscribed'
41
			| 'canceled'
42
			| 'suspended'
43
		preferredPaymentMethod?: {
44
			key?: string
45
			id?: string
46
			name?: string
47
			href?: string
48
		}
49
		status?: 'active' | 'inactive'
50
		audit?: {
51
			createdDateTime?: string
52
			modifiedDateTime?: string
53
			createdBy?: string
54
			modifiedBy?: string
55
		}
56
	} & { id?: {} }
57
) {
58
	const url = new URL(
59
		`https://api.intacct.com/ia/api/v1/objects/accounts-payable/vendor-payment-provider/${key}`
60
	)
61

62
	const response = await fetch(url, {
63
		method: 'PATCH',
64
		headers: {
65
			'Content-Type': 'application/json',
66
			Authorization: 'Bearer ' + auth.token
67
		},
68
		body: JSON.stringify(body)
69
	})
70
	if (!response.ok) {
71
		const text = await response.text()
72
		throw new Error(`${response.status} ${text}`)
73
	}
74
	return await response.json()
75
}
76