0

Create a credit card account

by
Published Oct 17, 2025

Creates a new credit card account. Permissions and other requirements SubscriptionCash Management User typeBusiness, Employee, Project Manager PermissionsList, View, Add Credit card accounts

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 credit card account
7
 * Creates a new credit card account.
8

9

10
Permissions and other requirements
11

12
SubscriptionCash Management
13
User typeBusiness, Employee, Project Manager
14
PermissionsList, View, Add Credit card accounts
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		href?: string
26
		accountDetails?: {
27
			description?: string
28
			cardType?:
29
				| 'visa'
30
				| 'mastercard'
31
				| 'discover'
32
				| 'americanExpress'
33
				| 'dinersClub'
34
				| 'otherChargeCard'
35
			number?: string
36
			accountType?: 'credit' | 'debit'
37
			expirationMonth?:
38
				| '01'
39
				| '02'
40
				| '03'
41
				| '04'
42
				| '05'
43
				| '06'
44
				| '07'
45
				| '08'
46
				| '09'
47
				| '10'
48
				| '11'
49
				| '12'
50
			expirationYear?: string
51
			currency?: string
52
			billingAddress?: {
53
				addressLine1?: string
54
				addressLine2?: string
55
				addressLine3?: string
56
				city?: string
57
				state?: string
58
				postCode?: string
59
				country?: string
60
				countryCode?: string
61
			}
62
			debitCardCheckingAccount?: { id?: string; key?: string; href?: string }
63
		}
64
		accounting?: {
65
			offsetGLAccount?: { key?: string; id?: string; href?: string }
66
			financeChargeGLAccount?: { key?: string; id?: string; href?: string }
67
			financeChargeAPAccountLabel?: {
68
				key?: string
69
				id?: string
70
				href?: string
71
			}
72
			otherFeesGLAccount?: { key?: string; id?: string; href?: string }
73
			otherFeesAPAccountLabel?: { key?: string; id?: string; href?: string }
74
			defaultAccrualBasisGLJournal?: {
75
				key?: string
76
				id?: string
77
				href?: string
78
			}
79
			defaultCashBasisGLJournal?: { key?: string; id?: string; href?: string }
80
			employeeExpenseGLAccount?: { key?: string; id?: string; href?: string }
81
			employeeExpenseAccountLabel?: {
82
				key?: string
83
				id?: string
84
				href?: string
85
			}
86
			bankingTimeZone?:
87
				| 'GMT (Greenwich Mean Time) Dublin, Edinburgh, London'
88
				| 'GMT+00:00 Western Europe Time'
89
				| 'GMT+01:00 Western Europe Summer Time'
90
				| 'GMT+01:00 British Summer Time'
91
				| 'GMT+01:00 Irish Summer Time'
92
				| 'GMT+01:00 Central Europe Time'
93
				| 'GMT+01:00 Berlin, Stockholm, Rome, Bern, Brussels'
94
				| 'GMT+01:00 Lisbon, Warsaw'
95
				| 'GMT+01:00 Paris, Madrid'
96
				| 'GMT+01:00 Prague'
97
				| 'GMT+02:00 Central Europe Summer Time'
98
				| 'GMT+02:00 Eastern Europe Time'
99
				| 'GMT+02:00 Athens, Helsinki, Istanbul'
100
				| 'GMT+02:00 Cairo'
101
				| 'GMT+02:00 Harare, Pretoria'
102
				| 'GMT+02:00 Israel'
103
				| 'GMT+03:00 Eastern Europe Summer Time'
104
				| 'GMT+03:00 Baghdad, Kuwait, Nairobi, Riyadh'
105
				| 'GMT+03:00 Moscow, St. Petersburg, Volgograd'
106
				| 'GMT+03:30 Tehran'
107
				| 'GMT+04:00 Moscow Summer Time'
108
				| 'GMT+04:00 Abu Dhabi, Muscat, Tbilisi, Kazan'
109
				| 'GMT+04:30 Kabul'
110
				| 'GMT+05:00 Islamabad, Karachi, Sverdlovsk, Tashkent'
111
				| 'GMT+05:30 Bombay, Calcutta, Madras, New Delhi'
112
				| 'GMT+06:00 Almaty, Dhaka'
113
				| 'GMT+07:00 Bangkok, Jakarta, Hanoi'
114
				| 'GMT+08:00 Beijing, Chongqing, Urumqi'
115
				| 'GMT+08:00 Hong Kong SAR, Perth, Singapore, Taipei'
116
				| 'GMT+08:00 (Australian) Western Standard Time'
117
				| 'GMT+09:00 Tokyo, Osaka, Sapporo, Seoul, Yakutsk'
118
				| 'GMT+09:30 (Australian) Central Standard Time'
119
				| 'GMT+10:30 (Australian) Central Daylight Time'
120
				| 'GMT+09:30 Adelaide'
121
				| 'GMT+09:30 Darwin'
122
				| 'GMT+10:00 Brisbane, Melbourne, Sydney'
123
				| 'GMT+10:00 Guam, Port Moresby'
124
				| 'GMT+10:00 Vladivostok'
125
				| 'GMT+10:00 (Australian) Eastern Standard Time'
126
				| 'GMT+11:00  (Australian) Eastern Daylight Time'
127
				| 'GMT+12:00 Fiji Islands, Marshall Islands'
128
				| 'GMT+12:00 Kamchatka'
129
				| 'GMT+12:00 Magadan, Solomon Islands, New Caledonia'
130
				| 'GMT+12:00 Wellington, Auckland'
131
				| 'GMT+13:00 Nuku`alofa'
132
				| 'GMT+13:00 Samoa'
133
				| 'GMT-01:00 Azores, Cape Verde Island'
134
				| 'GMT-03:00 Brasilia'
135
				| 'GMT-03:00 Buenos Aires, Georgetown'
136
				| 'GMT-03:30 Newfoundland Standard Time'
137
				| 'GMT-02:30 Newfoundland Daylight Time'
138
				| 'GMT-04:00 Atlantic Standard Time'
139
				| 'GMT-03:00 Atlantic Daylight Time'
140
				| 'GMT-04:00 Caracas, La Paz'
141
				| 'GMT-05:00 Bogota, Lima'
142
				| 'GMT-05:00 Eastern Standard Time'
143
				| 'GMT-04:00 Eastern Daylight Saving Time'
144
				| 'GMT-05:00 Indiana (East)'
145
				| 'GMT-06:00 Central Standard Time'
146
				| 'GMT-05:00 Central Daylight Saving Time'
147
				| 'GMT-06:00 Mexico City, Tegucigalpa'
148
				| 'GMT-06:00 Saskatchewan'
149
				| 'GMT-07:00 Arizona'
150
				| 'GMT-07:00 Mountain Standard Time'
151
				| 'GMT-06:00 Mountain Daylight Saving Time'
152
				| 'GMT-08:00 Pacific Standard Time'
153
				| 'GMT-07:00 Pacific Daylight Saving Time'
154
				| 'GMT-09:00 Alaska Standard Time'
155
				| 'GMT-08:00 Alaska Standard Daylight Saving Time'
156
				| 'GMT-10:00 Hawaii'
157
				| 'GMT-11:00 Midway Island, Samoa'
158
				| 'GMT-12:00 Eniwetok, Kwajalein'
159
			disableInterEntityTransfer?: false | true
160
			useInEmployeeExpense?: false | true
161
		}
162
		reconciliation?: {
163
			lastReconciledBalance?: string
164
			lastReconciledDate?: string
165
			cutOffDate?: string
166
			inProgressBalance?: string
167
			inProgressDate?: string
168
			matchSequence?: { key?: string; id?: string; href?: string }
169
			useMatchSequenceForAutoMatch?: false | true
170
			useMatchSequenceForManualMatch?: false | true
171
		}
172
		department?: { key?: string; id?: string; href?: string }
173
		location?: { key?: string; id?: string; href?: string }
174
		vendor?: { key?: string; id?: string; href?: string }
175
		status?: 'active' | 'inactive'
176
		audit?: {
177
			createdDateTime?: string
178
			modifiedDateTime?: string
179
			createdBy?: string
180
			modifiedBy?: string
181
		}
182
		entity?: { key?: string; id?: string; name?: string; href?: string }
183
		bankingCloudConnection?: {
184
			name?: string
185
			bankName?: string
186
			status?:
187
				| 'notConnected'
188
				| 'connectionRequested'
189
				| 'inProgress'
190
				| 'pending'
191
				| 'pendingConfirmation'
192
				| 'connected'
193
				| 'authRequired'
194
				| 'verifyingAuth'
195
				| 'inactiveFeed'
196
				| 'inactiveClient'
197
				| 'canceled'
198
				| 'invalid'
199
				| 'canceling'
200
				| 'disconnecting'
201
			lastBankTxnDateTime?: string
202
			lastRefreshedDateTime?: string
203
			refreshStatus?: 'queued' | 'refreshing' | 'success' | 'partialSuccess' | 'failure'
204
			supportMultiAccountLinking?: false | true
205
		}
206
		financialInstitution?: { key?: string; id?: string; href?: string }
207
		ruleSet?: { key?: string; id?: string; href?: string }
208
	} & { accountDetails?: {}; accounting?: {} }
209
) {
210
	const url = new URL(
211
		`https://api.intacct.com/ia/api/v1/objects/cash-management/credit-card-account`
212
	)
213

214
	const response = await fetch(url, {
215
		method: 'POST',
216
		headers: {
217
			'Content-Type': 'application/json',
218
			Authorization: 'Bearer ' + auth.token
219
		},
220
		body: JSON.stringify(body)
221
	})
222
	if (!response.ok) {
223
		const text = await response.text()
224
		throw new Error(`${response.status} ${text}`)
225
	}
226
	return await response.json()
227
}
228