Settings

Theme

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

github.com

3 points by colinclerk 4 years ago · 3 comments

Reader

colinclerkOP 4 years ago

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-...

codingdave 4 years ago

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?

  • colinclerkOP 4 years ago

    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.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection