import stripe from "npm:stripe@^11";
type Stripe = {
token: string;
};
export async function main(
sk: Stripe,
subscriptionId: string,
quantity: number
) {
const client = new stripe.Stripe(sk.token, {
apiVersion: "2022-11-15",
httpClient: stripe.createFetchHttpClient(),
});
return await client.subscriptionItems.createUsageRecord(subscriptionId, {
quantity,
});
}
Submitted by hugo697 419 days ago
import stripe from "npm:stripe@^11";
type Stripe = {
token: string;
};
export async function main(
sk: Stripe,
subscriptionId: string,
quantity: number,
) {
const client = new stripe.Stripe(sk.token, {
apiVersion: "2022-11-15",
httpClient: stripe.createFetchHttpClient(),
});
return await client.subscriptionItems.createUsageRecord(subscriptionId, {
quantity,
});
}
Submitted by admin 497 days ago
import stripe from "npm:stripe@^11";
type Stripe = {
token: string;
};
export async function main(
sk: Stripe,
subscriptionId: string,
quantity: number,
) {
const client = new stripe.Stripe(
sk.token,
{ apiVersion: "2022-11-15", httpClient: stripe.createFetchHttpClient() },
);
return await client.subscriptionItems.createUsageRecord(
subscriptionId,
{ quantity },
);
}
Submitted by admin 500 days ago
import type { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts";
import stripe from "npm:stripe@^11";
export async function main(
sk: Resource<"stripe">,
subscriptionId: string,
quantity: number,
) {
const client = new stripe.Stripe(
sk.token,
{ apiVersion: "2022-11-15", httpClient: stripe.createFetchHttpClient() },
);
return await client.subscriptionItems.createUsageRecord(
subscriptionId,
{ quantity },
);
}
Submitted by adam186 628 days ago
import type { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts";
import stripe from "npm:stripe@^11";
export async function main(
sk: Resource<"stripe">,
subscriptionId: string,
quantity: number,
) {
const client = new stripe.Stripe(
sk.token,
{ apiVersion: "2022-11-15", httpClient: stripe.createFetchHttpClient() },
);
return await client.subscriptionItems.createUsageRecord(
subscriptionId,
{ quantity },
);
}
Submitted by adam186 663 days ago
import type { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
import stripe from "npm:stripe@^11";
export async function main(
sk: Resource<"stripe">,
subscriptionId: string,
quantity: number,
) {
const client = new stripe.Stripe(
sk.token,
{ apiVersion: "2022-11-15", httpClient: stripe.createFetchHttpClient() },
);
return await client.subscriptionItems.createUsageRecord(
subscriptionId,
{ quantity },
);
}
Submitted by admin 701 days ago
import type { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
import stripe from "npm:stripe@11.7.0";
export async function main(
sk: Resource<"stripe">,
subscriptionId: string,
quantity: number,
) {
const client = new stripe.Stripe(
sk.token,
{ apiVersion: "2022-11-15" },
);
return client.subscriptionItems.createUsageRecord(
subscriptionId,
{ quantity },
);
}
Submitted by admin 701 days ago
import * as wmill from "https://deno.land/x/windmill@v1.34.0/mod.ts";
import Stripe from "https://esm.sh/stripe?target=deno";
export async function main(
stripe_con: wmill.Resource<"stripe">,
subscription_item_id: string,
quantity: number,
timestamp: number
) {
const token = stripe_con["token"];
const stripe = Stripe(
`${token}`,
{
httpClient: Stripe.createFetchHttpClient(),
},
);
const usageRecord = await stripe.subscriptionItems.createUsageRecord(
`${subscription_item_id}`,
{ quantity: quantity, timestamp: timestamp },
);
return await usageRecord.json();
}
Submitted by rossmccrann 850 days ago