diff --git a/src/Stripe.net/Infrastructure/Public/StripeClient.cs b/src/Stripe.net/Infrastructure/Public/StripeClient.cs
index 88d67632bd..f10585826e 100644
--- a/src/Stripe.net/Infrastructure/Public/StripeClient.cs
+++ b/src/Stripe.net/Infrastructure/Public/StripeClient.cs
@@ -20,6 +20,15 @@ public class StripeClient : IStripeClient
/// The client to use. If null, an HTTP client will be
/// created with default parameters.
///
+ ///
+ /// The base URL for Stripe's API. Defaults to
+ ///
+ ///
+ /// The base URL for Stripe's OAuth API. Defaults to
+ ///
+ ///
+ /// The base URL for Stripe's Files API. Defaults to
+ ///
/// if apiKey is null
///
/// if apiKey is empty or contains whitespace
@@ -27,7 +36,10 @@ public class StripeClient : IStripeClient
public StripeClient(
string apiKey,
string clientId = null,
- IHttpClient httpClient = null)
+ IHttpClient httpClient = null,
+ string apiBase = null,
+ string connectBase = null,
+ string filesBase = null)
{
if (apiKey == null)
{
@@ -47,6 +59,9 @@ public StripeClient(
this.ApiKey = apiKey;
this.ClientId = clientId;
this.HttpClient = httpClient ?? BuildDefaultHttpClient();
+ this.ApiBase = apiBase ?? DefaultApiBase;
+ this.ConnectBase = connectBase ?? DefaultConnectBase;
+ this.FilesBase = filesBase ?? DefaultFilesBase;
}
/// Default base URL for Stripe's API.
@@ -58,9 +73,9 @@ public StripeClient(
/// Default base URL for Stripe's Files API.
public static string DefaultFilesBase => "https://files.stripe.com";
- /// Gets or sets the base URL for Stripe's API.
+ /// Gets the base URL for Stripe's API.
/// The base URL for Stripe's API.
- public string ApiBase { get; set; } = DefaultApiBase;
+ public string ApiBase { get; }
/// Gets the API key used by the client to send requests.
/// The API key used by the client to send requests.
@@ -70,13 +85,13 @@ public StripeClient(
/// The client ID used by the client in OAuth requests.
public string ClientId { get; }
- /// Gets or sets the base URL for Stripe's OAuth API.
+ /// Gets the base URL for Stripe's OAuth API.
/// The base URL for Stripe's OAuth API.
- public string ConnectBase { get; set; } = DefaultConnectBase;
+ public string ConnectBase { get; }
- /// Gets or sets the base URL for Stripe's Files API.
+ /// Gets the base URL for Stripe's Files API.
/// The base URL for Stripe's Files API.
- public string FilesBase { get; set; } = DefaultFilesBase;
+ public string FilesBase { get; }
/// Gets the used to send HTTP requests.
/// The used to send HTTP requests.
diff --git a/src/StripeTests/Infrastructure/Public/StripeRequestTest.cs b/src/StripeTests/Infrastructure/Public/StripeRequestTest.cs
index 697943dabd..d21474c20b 100644
--- a/src/StripeTests/Infrastructure/Public/StripeRequestTest.cs
+++ b/src/StripeTests/Infrastructure/Public/StripeRequestTest.cs
@@ -12,10 +12,9 @@ public class StripeRequestTest : BaseStripeTest
public StripeRequestTest()
{
- this.stripeClient = new StripeClient("sk_test_123")
- {
- ApiBase = "https://client.example.com"
- };
+ this.stripeClient = new StripeClient(
+ "sk_test_123",
+ apiBase: "https://client.example.com");
}
[Fact]
diff --git a/src/StripeTests/StripeMockFixture.cs b/src/StripeTests/StripeMockFixture.cs
index 3c3fa1f159..fa0385a413 100644
--- a/src/StripeTests/StripeMockFixture.cs
+++ b/src/StripeTests/StripeMockFixture.cs
@@ -48,11 +48,9 @@ public StripeClient BuildStripeClient(IHttpClient httpClient = null)
return new StripeClient(
"sk_test_123",
"ca_123",
- httpClient: httpClient)
- {
- ApiBase = $"http://localhost:{this.port}",
- FilesBase = $"http://localhost:{this.port}",
- };
+ httpClient: httpClient,
+ apiBase: $"http://localhost:{this.port}",
+ filesBase: $"http://localhost:{this.port}");
}
///