ShiwakeDocs

Configuration

LedgerCoreOptions, BankingOptions, and BankingApiOptions.

The SDK is configured through three IOptions<T> types. All can be set via the DI extension methods or bound from IConfiguration.

LedgerCoreOptions

Controls the core HTTP client: where it talks to, how it authenticates, and how long it waits.

Prop

Type

Both BaseUrl and ApiKey are required. The SDK does not validate them at registration time. You'll find out they're wrong on the first request via a LedgerCoreException.

Setting via code

builder.Services.AddLedgerCoreSdk(options =>
{
    options.BaseUrl        = "https://api.shiwake.example.com";
    options.ApiKey         = Environment.GetEnvironmentVariable("LEDGER_KEY")!;
    options.TimeoutSeconds = 60;
});

Binding from appsettings.json

The section name is "LedgerCore" by default. Pass a second argument to override it.

{
  "LedgerCore": {
    "BaseUrl": "https://api.shiwake.example.com",
    "ApiKey": "sk_live_...",
    "TimeoutSeconds": 30
  }
}
builder.Services.AddLedgerCoreSdk(builder.Configuration);

BankingApiOptions

Options for the full banking API client. Intentionally sparse. Base URL and auth are inherited from LedgerCoreOptions.

Prop

Type

builder.Services.AddLedgerCoreBankingApi(options =>
{
    options.DefaultCreatedBy = "deposit-webhook";
});

BankingOptions

Controls how the simple banking client maps client ids to account codes and which platform account funds deposits. Only relevant if you register IBankingClient (the simple wrapper). The full IBankingApiClient does not use these settings.

Prop

Type

The derivation rule is literally $"{ClientAccountCodePrefix}{ClientId}". A client id of 42 with the default prefix becomes account code CLIENT-42.

The platform float account must already exist in the tenant before calling DepositAsync or WithdrawAsync. The banking client does not create it for you. That's a one-time bootstrap step, typically done via the Accounts API when provisioning a tenant.

Setting via code

builder.Services.AddLedgerCoreBanking(options =>
{
    options.PlatformFloatAccountCode = "MAIN-FLOAT";
    options.ClientAccountCodePrefix  = "WALLET-";
});

Binding from appsettings.json

AddLedgerCoreBanking does not have a configuration-binding overload, but you can bind it yourself:

{
  "LedgerCore": { /* ... */ },
  "LedgerCoreBanking": {
    "PlatformFloatAccountCode": "MAIN-FLOAT",
    "ClientAccountCodePrefix": "WALLET-"
  }
}
builder.Services.Configure<BankingOptions>(
    builder.Configuration.GetSection("LedgerCoreBanking"));
builder.Services.AddLedgerCoreBanking();

Why the banking defaults are what they are

The defaults (PLATFORM-FLOAT, CLIENT-{id}, Liability, Credit) match the convention used throughout this documentation and the Quickstart. If you follow the defaults, everything in the docs works as-is. If you override them, substitute accordingly in the examples.

Edit on GitHub

Last updated on

On this page