//native
type Mollie = {
token: string;
};
/**
* Get invoice
* Retrieve a single invoice by its ID.
If you want to retrieve the details of an invoice by its invoice number, call the [List invoices](list-invoices) endpoint with the `reference` parameter.
> 🔑 Access with
>
> Access token with **invoices.read**
*/
export async function main(auth: Mollie, id: string) {
const url = new URL(`https://api.mollie.com/v2/invoices/${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.text();
}
Submitted by hugo697 428 days ago