//native
type Square = {
token: string;
};
/**
* DeleteCustomerCustomAttributeDefinition
* Deletes a customer-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account.
Deleting a custom attribute definition also deletes the corresponding custom attribute from
all customer profiles in the seller's Customer Directory.
Only the definition owner can delete a custom attribute definition.
*/
export async function main(auth: Square, key: string) {
const url = new URL(
`https://connect.squareup.com/v2/customers/custom-attribute-definitions/${key}`,
);
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