Get transfer
One script reply has been approved by the moderators Verified

This endpoint gets a transfer by ID.

Currently, the API can only return transfers for the following payment rails:

  • ACH
  • DOMESTIC_WIRE
  • CHEQUE
  • INTERNATIONAL_WIRE
Created by hugo697 170 days ago
Submitted by hugo697 Bun
Verified 170 days ago
1
//native
2
type Brex = {
3
  token: string;
4
};
5
/**
6
 * 
7
Get transfer
8

9
 * 
10
This endpoint gets a transfer by ID.
11

12
Currently, the API can only return transfers for the following payment rails:
13
- ACH
14
- DOMESTIC_WIRE
15
- CHEQUE
16
- INTERNATIONAL_WIRE
17

18
 */
19
export async function main(auth: Brex, id: string) {
20
  const url = new URL(`https://platform.brexapis.com/v1/transfers/${id}`);
21

22
  const response = await fetch(url, {
23
    method: "GET",
24
    headers: {
25
      Authorization: "Bearer " + auth.token,
26
    },
27
    body: undefined,
28
  });
29
  if (!response.ok) {
30
    const text = await response.text();
31
    throw new Error(`${response.status} ${text}`);
32
  }
33
  return await response.json();
34
}
35