Haskell-OpenAPI-Code-Generator/Stripe-Haskell-Library

Question: Trying out latest api version

Closed this issue · 2 comments

For trying out the the latest api version without pinning the version on my stripe account, this is where I would set it right?
https://stripe.com/docs/api/versioning

instance MonadHTTP Handler where
  httpBS req = HTTP.httpBS (HTTP.addRequestHeader "Stripe-Version" "2022-11-15" req)

I can't seem to make it work. It's still registering as the old api version in the stripe api logs

Hey there, I am not sure where the Handler type comes from you are referencing here. I am guessing that in your current implementation still the instance for IO is used. To make it work you probably have to create a newtype wrapper similar to our very own ClientT (see here) and implement the instance there. Maybe this is already what you are doing but then some context is missing in your question.

Another option would be to misuse the SecurityScheme (see here) as you are free to modify requests in there. You can define a "setStripeVersion" security scheme (which both sets your API token and the version header), wrap it in the Configuration and pass it to the call of endpoints.

Hope that helps 🙂

That definitely helps! Thanks!