//native
type Zoho = {
token: string;
};
/**
* Create a product
* Create a new product.
*/
export async function main(
auth: Zoho,
X_com_zoho_subscriptions_organizationid: string,
body: {
name: string;
description?: string;
email_ids?: string;
redirect_url?: string;
},
) {
const url = new URL(`https://www.zohoapis.com/billing/v1/products`);
const response = await fetch(url, {
method: "POST",
headers: {
"X-com-zoho-subscriptions-organizationid":
X_com_zoho_subscriptions_organizationid,
"Content-Type": "application/json",
Authorization: "Zoho-oauthtoken " + 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