//native
type Square = {
token: string;
};
/**
* BulkUpdateCustomers
* Updates multiple customer profiles.
This endpoint takes a map of individual update requests and returns a map of responses.
You cannot use this endpoint to change cards on file. To make changes, use the [Cards API]($e/Cards) or [Gift Cards API]($e/GiftCards).
*/
export async function main(auth: Square, body: { customers: {} }) {
const url = new URL(`https://connect.squareup.com/v2/customers/bulk-update`);
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