type Stripe = {
token: string;
};
/**
* Delete subscription items item
* Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
*/
export async function main(
auth: Stripe,
item: string,
body: {
clear_usage?: boolean;
proration_behavior?: "always_invoice" | "create_prorations" | "none";
proration_date?: number;
}
) {
const url = new URL(`https://api.stripe.com/v1/subscription_items/${item}`);
const response = await fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: new URLSearchParams(body as Record<string, string>),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 74 days ago
type Stripe = {
token: string;
};
/**
* Delete subscription items item
* <p>Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.</p>
*/
export async function main(
auth: Stripe,
item: string,
body: {
clear_usage?: boolean;
proration_behavior?: "always_invoice" | "create_prorations" | "none";
proration_date?: number;
}
) {
const url = new URL(`https://api.stripe.com/v1/subscription_items/${item}`);
const response = await fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: new URLSearchParams(body as Record<string, string>),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 202 days ago
type Stripe = {
token: string;
};
/**
* Delete subscription items item
* <p>Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.</p>
*/
export async function main(
auth: Stripe,
item: string,
body: {
clear_usage?: boolean;
proration_behavior?: "always_invoice" | "create_prorations" | "none";
proration_date?: number;
}
) {
const url = new URL(`https://api.stripe.com/v1/subscription_items/${item}`);
const response = await fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: new URLSearchParams(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 202 days ago