Skip to content

Show HN: use-stripe-subscription – easily add Stripe Billing to your React app

github.com/clerkinc
3 pointscolinclerk3 comments
On HN

Comments

Hey HN - in addition to the linked codebase, we wrote a blog about the general challenges involved with "refactoring" a backend-facing REST API to also provide a frontend-facing React API (of hooks and components): https://clerk.dev/blog/refactoring-stripes-api-for-frontend-...

What is the use case for your billing being directly tied to your front-end, and not the back-end? I'd think that opens up a much larger surface area for security problems?

The use case is just speed of development. We looked at several Billing implementations and found consistent patterns for exposing available plans and subscription management to the frontend.

use-stripe-subscription simply packages one implementation so your frontend team can consume it directly, instead of asking backend teams to reinvent the wheel.

It doesn't just re-expose Stripe endpoints, which would result in significant security concerns. This package clamps down the endpoints so the active customer can only see their own data and modify their own subscription.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.