//native
type Vercel = {
token: string;
};
/**
* Get Invoice
* Get Invoice details and status for a given invoice ID. See Billing Events with Webhooks documentation on how to receive invoice events. This endpoint is used to retrieve the invoice details.
*/
export async function main(
auth: Vercel,
integrationConfigurationId: string,
invoiceId: string,
) {
const url = new URL(
`https://api.vercel.com/v1/installations/${integrationConfigurationId}/billing/invoices/${invoiceId}`,
);
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 428 days ago