0

Create a billing price list entry

by
Published Oct 17, 2025

Creates a new billing price list entry.

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 billing price list entry
7
 * Creates a new billing price list entry.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		billingPriceList?: { key?: string; id?: string; href?: string }
16
		currency?: {
17
			exchangeRateDate?: string
18
			exchangeRateTypeId?: string
19
			exchangeRate?: number
20
			baseCurrency?: string
21
			txnCurrency?: string
22
		}
23
		priceType?: 'range' | 'tiered'
24
		flatAmountFrequency?: 'oneTime' | 'useBillingTemplate' | 'includeWithEveryInvoice'
25
		usageQuantityResetPeriod?: 'afterEachRenewal' | 'afterEachInvoice'
26
		roundingType?: 'standard' | 'roundUp' | 'roundDown'
27
		isQuantityRecurring?: false | true
28
		variableUnitDivisor?: string
29
		tieredPricingType?: 'volume' | 'step' | 'absolute'
30
		item?: { key?: string; id?: string; name?: string; href?: string }
31
		lines?: {
32
			key?: string
33
			id?: string
34
			href?: string
35
			startDate?: string
36
			flatAmount?: string
37
			variableUnitRate?: string
38
			includedUnits?: string
39
			memo?: string
40
			billingPriceListEntry?: { key?: string; id?: string; href?: string }
41
			tiers?: {
42
				key?: string
43
				id?: string
44
				href?: string
45
				beginQuantity?: string
46
				tierRate?: string
47
				billingPriceListEntryLine?: {
48
					key?: string
49
					id?: string
50
					href?: string
51
				}
52
				audit?: {
53
					createdDateTime?: string
54
					modifiedDateTime?: string
55
					createdBy?: string
56
					modifiedBy?: string
57
					createdByUser?: { key?: string; id?: string; href?: string }
58
					modifiedByUser?: { key?: string; id?: string; href?: string }
59
				}
60
			}[]
61
			audit?: {
62
				createdDateTime?: string
63
				modifiedDateTime?: string
64
				createdBy?: string
65
				modifiedBy?: string
66
				createdByUser?: { key?: string; id?: string; href?: string }
67
				modifiedByUser?: { key?: string; id?: string; href?: string }
68
			}
69
		}[]
70
		audit?: {
71
			createdDateTime?: string
72
			modifiedDateTime?: string
73
			createdBy?: string
74
			modifiedBy?: string
75
			createdByUser?: { key?: string; id?: string; href?: string }
76
			modifiedByUser?: { key?: string; id?: string; href?: string }
77
		}
78
		status?: 'active' | 'inactive'
79
	} & {}
80
) {
81
	const url = new URL(
82
		`https://api.intacct.com/ia/api/v1/objects/contracts/billing-price-list-entry`
83
	)
84

85
	const response = await fetch(url, {
86
		method: 'POST',
87
		headers: {
88
			'Content-Type': 'application/json',
89
			Authorization: 'Bearer ' + auth.token
90
		},
91
		body: JSON.stringify(body)
92
	})
93
	if (!response.ok) {
94
		const text = await response.text()
95
		throw new Error(`${response.status} ${text}`)
96
	}
97
	return await response.json()
98
}
99