stripe/stripe-js

Allow to setup API baseURL

Sembauke opened this issue · 3 comments

What happened?

In my integration tests, I use stripe-mock in a docker container to serve the Stripe APIs.

Stripe Java has a Stripe.overrideApiBase to setup API base URL to localhost:12111 when using stripe-mock to serve the Stripe APIs.

But I can not find such a function in the Stripe JS.

It is a feature request.

Environment

No response

Reproduction

No response

This package is a helper module for Stripe.js, which does not support using other API hosts, so that would not be possible to add here. I don't expect this to be something that gets added to the underlying Stripe.js functionality (similar to previous request around this).

Are you perhaps looking for stripe-node for a Node backend SDK? Using that, you can set the host during initialization (docs).

Thanks for your message @brendanm-stripe, I must have misunderstood the purpose of the module. Could you explain how it works a little?

Also, could you explain why adding a different base url wouldn't be possible? Not that I do not want to use stripe-node instead.

It's not possible to override the base url because this is not supported (and not expected to be added to) the underlying Stripe.js SDK. This module is a helper/wrapper for loading that Stripe.js SDK conveniently in module-based apps & build systems, and aims to provide TypeScript typings for it.