Search code examples
stripe-paymentssubscriptionpayment-processing

Handling Subscriptions with a Payment Processor (Stripe in my case)


I'm having a really hard time figuring out the responsibility of each system with subscriptions and recurring payments in Stripe. I'm building out a web application that allows anonymous users to search a list of "members". Members are users that are paying a monthly fee to be returned on that list. If a member's recurring billing fails I need that member to no longer be returned in the list. My app has a database with a lot of information on each member. I'm wondering the best way to keep the subscription status of all members on whether they have paid for the current month. Webhooks looked like an option but that isn't guaranteed to capture all events (example: my app is down). Am I missing something simple in the documentation? Is webhooks the best approach and then I have another daily process to check the status as a backup?


Solution

  • Listening for Subscription Events via webhooks is the best approach for this use case. Stripe will retry Event delivery to your Webhook Endpoint several times over an extended period of time if your app has downtime, so you shouldn't miss anything.

    You can also use the API to list Events if you want to confirm you haven't missed anything, but webhooks should be your primary source of truth.