0

Add off-cycle payment

by
Published Oct 17, 2025

Add a new invoice line-item for the purpose of an off-cycle payment associated with a specific contract. This is typically used for exceptional payments outside the regular payment schedule. **Token scopes**: `off-cycle-payments:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Add off-cycle payment
4
 * Add a new invoice line-item for the purpose of an off-cycle payment associated with a specific contract. This is typically used for exceptional payments outside the regular payment schedule.
5
 **Token scopes**: `off-cycle-payments:write`
6
 */
7
export async function main(auth: RT.Deel, contract_id: string, body: Body) {
8
	const url = new URL(
9
		`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/off-cycle-payments`
10
	)
11

12
	const response = await fetch(url, {
13
		method: 'POST',
14
		headers: {
15
			'Content-Type': 'application/json',
16
			Authorization: 'Bearer ' + auth.apiKey
17
		},
18
		body: JSON.stringify(body)
19
	})
20
	if (!response.ok) {
21
		const text = await response.text()
22
		throw new Error(`${response.status} ${text}`)
23
	}
24
	return await response.json()
25
}
26

27
/* eslint-disable */
28
/**
29
 * This file was automatically generated by json-schema-to-typescript.
30
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
31
 * and run json-schema-to-typescript to regenerate this file.
32
 */
33

34
export interface Body {
35
	data?: {
36
		/**
37
		 * The amount of the off-cycle payment.
38
		 */
39
		amount: number
40
		/**
41
		 * A description or reason for the off-cycle payment.
42
		 */
43
		description: string
44
		/**
45
		 * The date the off-cycle payment is submitted, in ISO-8601 format (YYYY-MM-DD).
46
		 */
47
		date_submitted: string
48
		/**
49
		 * If true, the off-cycle payment will be automatically approved as part of the request.
50
		 */
51
		is_auto_approved?: boolean
52
		/**
53
		 * Id of an existing preset.
54
		 */
55
		hourly_report_preset_id?: string
56
		[k: string]: unknown
57
	}
58
	[k: string]: unknown
59
}
60