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 314 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 392 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 395 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 523 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 558 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 596 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 596 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 745 days ago