orykevinO
Convex Community10mo ago
13 replies
orykevin

Polar Component

Hi Guys, I am using Polar component to handle the subscriptions, and I want to trigger onSubscriptionUpdated, when I tried it, it's not working

this is my code :
polar.registerRoutes(http, {
path: "/polar/events",
onSubscriptionCreated: async (ctx, event) => {
console.log("Subscription created", event);
},
onSubscriptionUpdated: async (ctx, event) => {
console.log("Subscription updated", event);
if(event.data.status === "active") {
ctx.runMutation(internal.v1.userToken.handleActivedSubscription, {
userId: event.data.customer.metadata.userId as Id<"users">,
productKey: event.data.product.metadata.key as string,
});
}
},
});

I tried to log it but it's not triggering either, did anyone have this problem too?
Was this page helpful?