Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Easiest way I've seen to integrate Stripe (useautumn.com)
3 points by netswift on Jan 26, 2025 | hide | past | favorite | 2 comments


This might be a controversial take, but integrating Stripe has never made sense to me.

Theo Browne (@theo on X) summarizes it best: having to sync the state of a subscription with your app and Stripe is super annoying.

Here's a write up on how he does it, which is the best way I've seen so far. It relies on using a Stripe syncing function to update subscription status every time a relevant webhook event comes in from Stripe.

1. User clicks "Subscribe" button on frontend, triggering backend endpoint to generate Stripe checkout

2. Backend creates Stripe customer, stores customerId/userId mapping in database

3. Backend creates checkout session, returns it to frontend

4. User completes payment, gets redirected to /success page

5. /success page triggers backend to sync Stripe data for that customer

6. Backend fetches customerId from database (referred to as key-value/KV store), and syncs latest data from Stripe API using syncStripeDataToKV

7. After sync, frontend redirects user to final destination

8. On all relevant Stripe webhook events, sync again via syncStripeDataToKV

Thoughts? Is this just a skill issue or is Stripe's developer experience actually quite bad?


Personally I haven't found it hard to integrate Stripe. But haven't had the need to implement anything too complex and it's a one time process.

Maintaining it at scale on the other hand... that's a challenge.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: