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