//native
type SageIntacct = {
token: string
}
/**
* Delete a recurring invoice
* Deletes a recurring invoice. If a recurring invoice is no longer in use, you can delete it instead of ending the recurring schedule. For example, if a contract with a customer is permanently canceled, you can delete the recurring invoice for that customer.
Permissions and other requirements
SubscriptionAccounts Receivable
User typeBusiness
PermissionsList, View, Edit, Delete Recurring invoices
*/
export async function main(auth: SageIntacct, key: string) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/accounts-receivable/recurring-invoice/${key}`
)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago