//native
type Brex = {
token: string;
};
/**
* Create a new receipt match
*
The `uri` will be a pre-signed S3 URL allowing you to upload the receipt securely.
*/
export async function main(auth: Brex, body: { receipt_name: string }) {
const url = new URL(
`https://platform.brexapis.com/v1/expenses/card/receipt_match`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 170 days ago