

Show HN: Stripe Tester - Gem To Test Stripe Webhooks Locally - luaybs
https://github.com/buttercloud/stripe_tester

======
fhirzall
Feras from buttercloud here (author is my co-worker).

We have a complex application that heavily interacts with webhooks - that's
what prompted us to create StripeTester. We can now easily spec out the
interactions and set expectations when a webhook is received. A side benefit
is that this can be used without connectivity and really cleans up our test
suite.

Previously, we used Requestbin for manual webhook testing, and made heavy use
of Mocha for stubbing. This required us to maintain fixtures and test data to
simulate Stripe's.

There's also [https://github.com/mindeavor/stripe-ruby-
mock](https://github.com/mindeavor/stripe-ruby-mock) that provides some
testing hooks (although repo says it's incomplete). We're planning on keeping
the webhook data up-to-date when Stripe releases newer versions.

------
sidchilling
What are the values in the body that is sent in a webhook? Are those dummy
values.

Mostly, in response of a Stripe webhook, one would want to do something based
on the id. For instance, for a charge failed event, one would like to retrieve
the customer for which the charge has failed and would retrieve the customer
details from Stripe. Dummy values will not help here.

Just thinking aloud, how would one use this? I have been in need for something
to test Stripe webhooks.

~~~
luaybs
You can specify values to overwrite the dummy data. For example:

StripeTester.create_event(:charge_failed, {"id" => "your_customer_id"})

This will overwrite the first occurrence of the key. I'm working towards
solving this issue. Maybe have the user specify which parent object the key is
in. Anyway, pull requests are welcome.

~~~
sidchilling
Ah.. okay.

------
aculver
Thank you so much! I maintain a gem for drop-in subscription support which
integrates with Stripe[1], and improving test coverage and implementing more
robust webhooks support has been on my to-do list for a few months now. Seeing
this on HN is like receiving a pull request for half of that work. Thanks,
again! :-)

[1]
[http://github.com/andrewculver/koudoku](http://github.com/andrewculver/koudoku)

------
jpadilla_
This is very awesome and super useful! When you rely heavily on Stripe events
it can get out of control. Stripe needs a doc with real world scenarios and
what events get called. I'm definitely going to try and port this to Python.

~~~
luaybs
This is exactly why we decided to make this gem. Looking forward to the port.

------
nayefmuhiar
Finally someone made this, great work

