stripe icon indicating copy to clipboard operation
stripe copied to clipboard

Allow customizable HTTP.host?

Open linzjax opened this issue 7 years ago • 3 comments

I was hoping to use stripe-mock to test our billing process. Unfortunately, stripe-mock only accepts the latest version of the API (Related to Issue #110). The other issue is that stripe-mock let's you run a fake stripe API on your local machine, but the HTTP.host for this client is currently hardcoded to "api.stripe.com", which makes sense but does make it impossible to use stripe-mock.

I know updating to the latest API might be enough work to make this a non-starter, but I'd like to throw in a request for a customizable HTTP.host if possible.

linzjax avatar Mar 06 '19 20:03 linzjax

Hey @linzjax ,

I've added a branch here for this https://github.com/dmjio/stripe/pull/113. Maybe it would be possible to use stripe-mock as a forcing function to upgrade this library (which is by the way looong overdue).

dmjio avatar Mar 06 '19 23:03 dmjio

That was fast, thanks! So I spent yesterday trying out that branch to get it working and the customizable host works great. Unfortunately, turns out it also needs HTTP.secure to be False otherwise the TLS certificate freaks out.

~~The weird thing about the versioning is that you can run curl -d "[email protected]" http://localhost:12112/v1/customers -H "Authorization: Bearer sk_test_123" --header "Stripe-Version: 2014-10-07" And it will give you a response that's different from the 2019-02-19 version, it just must not be quite the correct one since it then throws a parsing errors, so not sure what version it's actually returning.~~ (I was comparing two different routes, ignore this)

I would certainly be stoked to see an updated version of this library (although we haven't updated the stripe version we're using since 2012 so you're still ahead of us...).

linzjax avatar Mar 08 '19 14:03 linzjax

@linzjax 2012 !? I thought I was in the dark ages with only supporting 2014 :)

Didn't mean to abandon this issue. I will update the #113 to make this possible. I attempted and found it was a little more effort than previously thought. Will update the nix scripts as well.

dmjio avatar Jul 22 '19 19:07 dmjio