//native
type Square = {
token: string;
};
/**
* DeleteSnippet
* Removes your snippet from a Square Online site.
You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites that belong to a seller.
__Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
*/
export async function main(auth: Square, site_id: string) {
const url = new URL(
`https://connect.squareup.com/v2/sites/${site_id}/snippet`,
);
const response = await fetch(url, {
method: "DELETE",
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