//native
type Brex = {
token: string;
};
/**
*
Get transfer
*
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
*/
export async function main(auth: Brex, id: string) {
const url = new URL(`https://platform.brexapis.com/v1/transfers/${id}`);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 170 days ago