Reverses a credit card transaction.
1
//native
2
type SageIntacct = {
3
token: string
4
}
5
/**
6
* Reverse a credit card transaction
7
* Reverses a credit card transaction.
8
*/
9
export async function main(
10
auth: SageIntacct,
11
body: { key?: string; reversedDate?: string; memo?: string }
12
) {
13
const url = new URL(
14
`https://api.intacct.com/ia/api/v1/workflows/cash-management/credit-card-txn/reverse`
15
)
16
17
const response = await fetch(url, {
18
method: 'POST',
19
headers: {
20
'Content-Type': 'application/json',
21
Authorization: 'Bearer ' + auth.token
22
},
23
body: JSON.stringify(body)
24
})
25
if (!response.ok) {
26
const text = await response.text()
27
throw new Error(`${response.status} ${text}`)
28
29
return await response.json()
30
31