tansengming / stripe-rails

A Rails Engine for integrating with Stripe
MIT License
755 stars 123 forks source link

Manage Webhook Endpoints #141

Open tansengming opened 5 years ago

tansengming commented 5 years ago

The Stripe API allows management of webhoook endpoints through the API. I wonder if this might be a useful addition to the gem.

clwang commented 4 years ago

@tansengming - I was looking at this issue. I was wondering if there is support to manage which API version of the webhook you want to use when upgrading webhook versions. As stated by step number 2 here under webhooks. https://stripe.com/docs/upgrades#how-can-i-upgrade-my-api

tansengming commented 4 years ago

@clwang here's a way to force the API version with the ruby client https://github.com/stripe/stripe-ruby#configuring-an-api-version

clwang commented 4 years ago

@tansengming - This only controls the API version of the requests going to Stripe, but the webhooks API version is based off the version you set when setting up the webhook API endpoint. If you need to upgrade the API version for the webhook endpoint address, you need to recreate one. I was just seeing if there is a feature in the stripe-rails gem that would allow you to specify or reject webhook requests based off the a version you configure for testing or upgrade purposes.

tansengming commented 4 years ago

Hi @clwang apologies for giving you the wrong answer, then forgetting to get back to you with the right one.

The short answer is: No. Nothing in the gem let's you reject webhook requests based off a configured version. https://github.com/tansengming/stripe-rails/search?q=api_version&unscoped_q=api_version

The Stripe Webhook Docs do mention an optional api_version argument. So if someone decides to build this Webhook Endpoint management feature, it'll be a good place to start.

wonderer007 commented 4 years ago

@tansengming @clwang I am receiving https://github.com/tansengming/stripe-rails/issues/178 when application receive web hook from Stripe.

Can you please comment