internalFunctionsCall.ts•557 B
import { action } from "./_generated/server";
import { internal } from "./_generated/api";
import { v } from "convex/values";
export const upgrade = action({
args: {
planId: v.id("plans"),
},
handler: async (ctx, args) => {
// Call out to payment provider (e.g. Stripe) to charge customer
const response = await fetch("https://...");
if (response.ok) {
// Mark the plan as "professional" in the Convex DB
await ctx.runMutation(internal.plans.markPlanAsProfessional, {
planId: args.planId,
});
}
},
});