0

Calculate Employee Costs Globally

by
Published Oct 17, 2025

Determine the total employment costs for an Employee of Record (EOR) arrangement across different countries, including salary, employer costs, benefits, and additional fees.

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Calculate Employee Costs Globally
4
 * Determine the total employment costs for an Employee of Record (EOR) arrangement across different countries, including salary, employer costs, benefits, and additional fees.
5
 */
6
export async function main(auth: RT.Deel, body: Body) {
7
	const url = new URL(`https://api.letsdeel.com/rest/v2/eor/employment_cost`)
8

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

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

31
export interface Body {
32
	data?: {
33
		/**
34
		 * The state or region within the country, if applicable.
35
		 */
36
		state?: string
37
		/**
38
		 * The base salary for the employee.
39
		 */
40
		salary: number
41
		/**
42
		 * The country where the employee is based.
43
		 */
44
		country: string
45
		/**
46
		 * A list of selected benefit plans for the employee.
47
		 */
48
		benefits?: {
49
			/**
50
			 * The ID of the benefits plan, if applicable.
51
			 */
52
			plan_id?: string
53
			/**
54
			 * The ID of the benefits provider.
55
			 */
56
			provider_id: string
57
			[k: string]: unknown
58
		}[]
59
		/**
60
		 * The currency in which the costs are calculated.
61
		 */
62
		currency: string
63
		[k: string]: unknown
64
	}
65
	[k: string]: unknown
66
}
67