//native
type Square = {
token: string;
};
/**
* SearchTerminalRefunds
* Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
*/
export async function main(
auth: Square,
body: {
query?: {
filter?: {
device_id?: string;
created_at?: { start_at?: string; end_at?: string };
status?: string;
};
sort?: { sort_order?: string };
};
cursor?: string;
limit?: number;
},
) {
const url = new URL(
`https://connect.squareup.com/v2/terminals/refunds/search`,
);
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 235 days ago