0

Update a payment provider bank account

by
Published Oct 17, 2025

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

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

9

10
Permissions and other requirements
11

12
SubscriptionAdministration, Sage Cloud Services, Outbound Payment Services
13
User typeBusiness user with admin permissions
14
PermissionsList, View, Subscribe, Configure Application Subscriptions
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
		state?:
27
			| 'requestInitiated'
28
			| 'inProgress'
29
			| 'requestReceived'
30
			| 'requestFailed'
31
			| 'awaitingAuthorization'
32
			| 'subscribed'
33
			| 'canceled'
34
			| 'suspended'
35
		providerReferenceNumber?: string
36
		authenticationURL?: string
37
		checkStartNumber?: string
38
		isRebateAccount?: false | true
39
		remittanceEmail?: string
40
		bankAccount?: {
41
			key?: string
42
			id?: string
43
			currency?: string
44
			href?: string
45
		}
46
		paymentProvider?: { key?: string; id?: string; href?: string }
47
		href?: string
48
		audit?: {
49
			createdDateTime?: string
50
			modifiedDateTime?: string
51
			createdBy?: string
52
			modifiedBy?: string
53
		}
54
		status?: 'active' | 'inactive'
55
	} & { id?: {} }
56
) {
57
	const url = new URL(
58
		`https://api.intacct.com/ia/api/v1/objects/cash-management/payment-provider-bank-account/${key}`
59
	)
60

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