0

Update a bank transfer method

by
Published Oct 17, 2025

Updates a bank transfer method **Token scopes**: `worker:read`, `worker:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update a bank transfer method
4
 * Updates a bank transfer method
5
 **Token scopes**: `worker:read`, `worker:write`
6
 */
7
export async function main(auth: RT.Deel, id: string, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/payouts/contractors/methods/${id}`)
9

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

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

32
export interface Body {
33
	data: {
34
		address: {
35
			/**
36
			 * City name
37
			 */
38
			city: string
39
			/**
40
			 * State code
41
			 */
42
			state?: string
43
			/**
44
			 * Country code
45
			 */
46
			country: string
47
			/**
48
			 * Post code
49
			 */
50
			post_code: string
51
			/**
52
			 * First line of the address
53
			 */
54
			first_line: string
55
			[k: string]: unknown
56
		}
57
		/**
58
		 * Dynamic properties based on selected option. For example, if `selectedOption` is `swift_code`, payload may include `swiftCode`, `accountHolderName`, and `accountNumber`.
59
		 */
60
		payload: {
61
			[k: string]: unknown
62
		}
63
		/**
64
		 * Specifies if the method is the default payout method - if true, autowithdrawal will be enabled for the contractor using this method
65
		 */
66
		is_default?: boolean
67
		/**
68
		 * Name for method
69
		 */
70
		method_name?: string
71
		/**
72
		 * Specifies the type of payment method
73
		 */
74
		payment_method: 'bank_transfer'
75
		/**
76
		 * Specifies the type of bank transfer method. Maps from requirements type field
77
		 */
78
		selectedOption?: string
79
		[k: string]: unknown
80
	}
81
	[k: string]: unknown
82
}
83