Testing Stripe.com WebHooks With Requestb.in

SignalLeaf uses Stripe.com for billing. One of the cool things it does is provide web hooks to get events so that you can have your system do things in response to those events. Examples of events include customer creation, customer subscription changes, charges being made to a customer, charges failing, and a whole lot more. 

I find myself needing to use these webhooks (well, ok… I needed to be using them 6 months ago, but I’m here now and I’m finally getting it done) and began wondering how I could get sample data and sample requests – not just documentation or “Events & Webhooks” list on the Stripe site. I want to see the actual request headers, body and payload of the request as a web server will see it. Call me paranoid… I just don’t trust documentation and logs all that much – even from a company that I trust with my business. 

Enter, Requestb.in – an epic little service from Runscope that lets me set up a sandbox URL to receive HTTP requests and log all the pretty details that I want to see. 

Setting Up The Bin

To get stripe integration working, you need to create a bin first. Hit the Requestb.in site and click the big button

NewImage

I checked “private” for mine, cause I don’t want anyone else to be able to see the data. Once you have the bin created, you’ll see this nice big page with your URL and a ton of examples plastered all over it.

NewImage

Copy the URL out of that box and then head over to your Stripe.com account.

Set Up Your Web Hooks

Open your account preferences, and click on the Webhooks tab.

NewImage

Click the “Add URL” button in the bottom right. Add your bin’s URL.

NewImage

Since you’re interested in testing the web hooks to get access to the real data, make sure the “Mode” is set to test. Click the “Create” button when you’re done and it will show up in the list of webhooks.

NewImage

Test It

Now that you have it configured, you can do some testing. Set up subscriptions, test customers and all that jazz. For me, I had a bunch of test customers in my test mode already. So I just went in and invoiced one of them that had a subscription. Be sure you’re in test mode, first.

NewImage

After you do some stuff with a sample account and subscription or whatever else, hit refresh on the Requestb.in and you’ll see all the beautiful details of the request!

NewImage

From there, you can save the request details and use that as an example to build your code.

But Wait! There’s More!

Of course that isn’t all that Runscope can do – Requestb.in is only one tool that it provides as a service. Be sure to check out the rest of Runscope including what John Sheehan calls the “super-charged version” of request-capture.

Runscope seems like something that will be a regular part of my toolbox in the near future.


Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Derick Bailey

Derick Bailey is an entrepreneur, problem solver (and creator? :P ), software developer, screecaster, writer, blogger, speaker and technology leader in central Texas (north of Austin). He runs SignalLeaf.com - the amazingly awesome podcast audio hosting service that everyone should be using, and WatchMeCode.net where he throws down the JavaScript gauntlets to get you up to speed. He has been a professional software developer since the late 90's, and has been writing code since the late 80's. Find me on twitter: @derickbailey, @mutedsolutions, @backbonejsclass Find me on the web: SignalLeaf, WatchMeCode, Kendo UI blog, MarionetteJS, My Github profile, On Google+.
This entry was posted in API, Runscope, SignalLeaf, Stripe, Testing. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://john-sheehan.com/blog John Sheehan

    Great post Derick! For anyone who likes RequestBin but wish it updated as requests came in and had sharing and other stuff, check out our Request Capture feature of Runscope: https://www.runscope.com/docs/request-capture

    Edit: oops now I see the shout out at the end! :)