//native
type Square = {
token: string;
};
/**
* DismissTerminalAction
* Dismisses a Terminal action request if the status and type of the request permits it.
See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.
*/
export async function main(auth: Square, action_id: string) {
const url = new URL(
`https://connect.squareup.com/v2/terminals/actions/${action_id}/dismiss`,
);
const response = await fetch(url, {
method: "POST",
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 235 days ago