raideno
raideno3mo ago

Convex Stripe

Hello everyone, I hope you're all doing good. I have been working on a convex plugin in order to sync stripe resources into the convex database and make it easy to have subscriptions and payments in convex. I would love to have your feedback, suggestions, bugs or any improvements you would like to see. GitHub: https://github.com/raideno/convex-stripe Documentation: https://raideno.github.io/convex-stripe Demo: https://convex-stripe.vercel.app Npm: https://www.npmjs.com/package/@raideno/convex-stripe
14 Replies
Jumping Back
Jumping Back3mo ago
Very interested Good luck 🤞
Waris
Waris3mo ago
This looks good
sam
sam3mo ago
This is a good ship! Thanks for sharing. 🙌🏾🙏🏽
clearfram3
clearfram32mo ago
The business case of Polar was that stripe was really complicated around subscriptions no? What would I be missing if I used this instead of polar?
raideno
raidenoOP2mo ago
I never used Polar so i won't be able to tell you. But when using this you'll directly have access to your stripe resources (products, prices, subscriptions, etc) as convex tables meaning that you benefit from convex's reactivity And on top of that there is a "pay" and a "subscribe" function that'll let you generate a link towards which to redirect your user for them to pay or subscribe and everything will be synced meaning that the moment they come back to your website you can just check into the convex tables if they have a subscription or if the payment was successful And since its all convex table you can also hook in triggers to the convex tables to automatically send emails when subscriptions ends, when a payment succeed, when there is discounts, etc, etc
clearfram3
clearfram32mo ago
For context, I haven't gotten to adding payments yet. I assume that Polar takes care of both paragraphs starting with "And..." @James Cowling based on the OSS sponsorship ideas in the recent AMA, this project looks like the perfect fit that could probably become an official convex component in the near future
raideno
raidenoOP2mo ago
Yes indeed, the polar components take care of both
clearfram3
clearfram32mo ago
Did more work and realized payouts are only supported by stripe Literally no one else—paddle, orb, lago, dodo, polar
ampp
ampp2mo ago
this is awesome, definitely need to swap out my old code when i get a chance.
raideno
raidenoOP2mo ago
thanks, if you run into any issue or need help please reach out
ampp
ampp2mo ago
the only issue i was seeing is i want to support a bring your own stripe key style setup, as it is id have to hack together something to make sure the stripe webhooks in are identified to the correct customer "namespace". So id have to make some modification to the stripe.addHttpRoutes(http);
raideno
raidenoOP2mo ago
and also to the checkout methods if you use them to generate a payment link associated to the customer’s stripe key ? (in case you use those methods) i’ll see a way to make the web hooks more modular and allow passing a custom function that’ll verify the stripe signature or just allow passing a custom secret key
ampp
ampp2mo ago
I think resend basically offers a more broken down way that just takes the RequestCtx
http.route({
path: '/resend-webhook',
method: 'POST',
handler: httpAction(async (ctx, req) => {
return await resend.handleResendEventWebhook(ctx, req)
}),
})
http.route({
path: '/resend-webhook',
method: 'POST',
handler: httpAction(async (ctx, req) => {
return await resend.handleResendEventWebhook(ctx, req)
}),
})
Then i could query my db for the keys then create a "new" stripe I intend to do this for nearly all components so i'm hoping its becoming a standard across components. definitely a paradigm shift to have all the stripe data synced, still trying to figure out how my tracked data in my tables would change. I'm going to want this to be a component for sure(going to start building one based off RAG) otherwise this would push my one project over 150 tables 😅
raideno
raidenoOP2mo ago
Okey i get it now But how are you going to know in the tables from which customer / stripe key a payment or a product originated ? We’ll need a new field for that right ? Maybe by passing the stripe project id or just your customerId would be simpler And also in the web hook how you’ll know which secret key to use ? Are you going to try all of them until one works ?

Did you find this page helpful?