Developer-friendly & type-safe Csharp SDK specifically catered to leverage formance API.
It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps:
- 🛠 Make your SDK feel handcrafted by customizing it
- ♻️ Refine your SDK quickly by iterating locally with the Speakeasy CLI
- 🎁 Publish your SDK to package managers by configuring automatic publishing
- ✨ When ready to productionize, delete this section from the README
Formance Stack API: Open, modular foundation for unique payments flows
This API is documented in OpenAPI format.
Formance Stack offers one forms of authentication:
- OAuth2 OAuth2 - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.
- SDK Installation
- SDK Example Usage
- Available Resources and Operations
- Error Handling
- Server Selection
- Authentication
To add the NuGet package to a .NET project:
dotnet add package formance
To add a reference to a local instance of the SDK in a .NET project:
dotnet add reference src/formance/formance.csproj
using formance;
using formance.Models.Components;
var sdk = new Formance(security: new Security() {
ClientID = "<YOUR_CLIENT_ID_HERE>",
ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
});
var res = await sdk.GetVersionsAsync();
// handle response
Available methods
- GetOIDCWellKnowns - Retrieve OpenID connect well-knowns.
- GetServerInfo - Get server info
- ListClients - List clients
- CreateClient - Create client
- ReadClient - Read client
- UpdateClient - Update client
- DeleteClient - Delete client
- CreateSecret - Add a secret to a client
- DeleteSecret - Delete a secret from a client
- ListUsers - List users
- ReadUser - Read user
- GetVersions - Show stack version information
- GetInfo - Show server information
- GetLedgerInfo - Get information about a ledger
- CountAccounts - Count the accounts from a ledger
- ListAccounts - List accounts from a ledger
- GetAccount - Get account by its address
- AddMetadataToAccount - Add metadata to an account
- GetMapping - Get the mapping of a ledger
- UpdateMapping - Update the mapping of a ledger
RunScript- Execute a Numscript⚠️ Deprecated- ReadStats - Get statistics from a ledger
- CountTransactions - Count the transactions from a ledger
- ListTransactions - List transactions from a ledger
- CreateTransaction - Create a new transaction to a ledger
- GetTransaction - Get transaction from a ledger by its ID
- AddMetadataOnTransaction - Set the metadata of a transaction by its ID
- RevertTransaction - Revert a ledger transaction by its ID
- CreateTransactions - Create a new batch of transactions to a ledger
- GetBalances - Get the balances from a ledger's account
- GetBalancesAggregated - Get the aggregated balances from selected accounts
- ListLogs - List the logs from a ledger
- GetInfo - Show server information
- ListLedgers - List ledgers
- GetLedger - Get a ledger
- CreateLedger - Create a ledger
- UpdateLedgerMetadata - Update ledger metadata
- DeleteLedgerMetadata - Delete ledger metadata by key
- GetLedgerInfo - Get information about a ledger
- CreateBulk - Bulk request
- CountAccounts - Count the accounts from a ledger
- ListAccounts - List accounts from a ledger
- GetAccount - Get account by its address
- AddMetadataToAccount - Add metadata to an account
- DeleteAccountMetadata - Delete metadata by key
- ReadStats - Get statistics from a ledger
- CountTransactions - Count the transactions from a ledger
- ListTransactions - List transactions from a ledger
- CreateTransaction - Create a new transaction to a ledger
- GetTransaction - Get transaction from a ledger by its ID
- AddMetadataOnTransaction - Set the metadata of a transaction by its ID
- DeleteTransactionMetadata - Delete metadata by key
- RevertTransaction - Revert a ledger transaction by its ID
- GetBalancesAggregated - Get the aggregated balances from selected accounts
- GetVolumesWithBalances - Get list of volumes with balances for (account/asset)
- ListLogs - List the logs from a ledger
- ImportLogs
- ExportLogs - Export logs
- OrchestrationgetServerInfo - Get server info
- ListTriggers - List triggers
- CreateTrigger - Create trigger
- ReadTrigger - Read trigger
- DeleteTrigger - Delete trigger
- ListTriggersOccurrences - List triggers occurrences
- ListWorkflows - List registered workflows
- CreateWorkflow - Create workflow
- GetWorkflow - Get a flow by id
- DeleteWorkflow - Delete a flow by id
- RunWorkflow - Run workflow
- ListInstances - List instances of a workflow
- GetInstance - Get a workflow instance by id
- SendEvent - Send an event to a running workflow
- CancelEvent - Cancel a running workflow
- GetInstanceHistory - Get a workflow instance history by id
- GetInstanceStageHistory - Get a workflow instance stage history
- GetServerInfo - Get server info
- ListTriggers - List triggers
- CreateTrigger - Create trigger
- ReadTrigger - Read trigger
- DeleteTrigger - Delete trigger
- TestTrigger - Test trigger
- ListTriggersOccurrences - List triggers occurrences
- ListWorkflows - List registered workflows
- CreateWorkflow - Create workflow
- GetWorkflow - Get a flow by id
- DeleteWorkflow - Delete a flow by id
- RunWorkflow - Run workflow
- ListInstances - List instances of a workflow
- GetInstance - Get a workflow instance by id
- SendEvent - Send an event to a running workflow
- CancelEvent - Cancel a running workflow
- GetInstanceHistory - Get a workflow instance history by id
- GetInstanceStageHistory - Get a workflow instance stage history
- PaymentsgetServerInfo - Get server info
- CreatePayment - Create a payment
- ListPayments - List payments
- GetPayment - Get a payment
- UpdateMetadata - Update metadata
- ListTransferInitiations - List Transfer Initiations
- CreateTransferInitiation - Create a TransferInitiation
- GetTransferInitiation - Get a transfer initiation
- DeleteTransferInitiation - Delete a transfer initiation
- UdpateTransferInitiationStatus - Update the status of a transfer initiation
- ReverseTransferInitiation - Reverse a transfer initiation
- RetryTransferInitiation - Retry a failed transfer initiation
- ListPools - List Pools
- CreatePool - Create a Pool
- GetPool - Get a Pool
- DeletePool - Delete a Pool
- AddAccountToPool - Add an account to a pool
- RemoveAccountFromPool - Remove an account from a pool
- GetPoolBalances - Get pool balances
- CreateAccount - Create an account
- PaymentslistAccounts - List accounts
- PaymentsgetAccount - Get an account
- GetAccountBalances - Get account balances
- CreateBankAccount - Create a BankAccount in Payments and on the PSP
- ListBankAccounts - List bank accounts created by user on Formance
- GetBankAccount - Get a bank account created by user on Formance
- ForwardBankAccount - Forward a bank account to a connector
- UpdateBankAccountMetadata - Update metadata of a bank account
- ListAllConnectors - List all installed connectors
- ListConfigsAvailableConnectors - List the configs of each available connector
- InstallConnector - Install a connector
UninstallConnector- Uninstall a connector⚠️ Deprecated- UninstallConnectorV1 - Uninstall a connector
ReadConnectorConfig- Read the config of a connector⚠️ Deprecated- UpdateConnectorConfigV1 - Update the config of a connector
- ReadConnectorConfigV1 - Read the config of a connector
ResetConnector- Reset a connector⚠️ Deprecated- ResetConnectorV1 - Reset a connector
ListConnectorTasks- List tasks from a connector⚠️ Deprecated- ListConnectorTasksV1 - List tasks from a connector
GetConnectorTask- Read a specific task of the connector⚠️ Deprecated- GetConnectorTaskV1 - Read a specific task of the connector
- ConnectorsTransfer - Transfer funds between Connector accounts
- ReconciliationgetServerInfo - Get server info
- CreatePolicy - Create a policy
- ListPolicies - List policies
- DeletePolicy - Delete a policy
- GetPolicy - Get a policy
- Reconcile - Reconcile using a policy
- ListReconciliations - List reconciliations
- GetReconciliation - Get a reconciliation
SearchgetServerInfo- Get server info⚠️ DeprecatedSearch- search.v1⚠️ Deprecated
- WalletsgetServerInfo - Get server info
- GetTransactions
- ListWallets - List all wallets
- CreateWallet - Create a new wallet
- GetWallet - Get a wallet
- UpdateWallet - Update a wallet
- GetWalletSummary - Get wallet summary
- ListBalances - List balances of a wallet
- CreateBalance - Create a balance
- GetBalance - Get detailed balance
- DebitWallet - Debit a wallet
- CreditWallet - Credit a wallet
- GetHolds - Get all holds for a wallet
- GetHold - Get a hold
- ConfirmHold - Confirm a hold
- VoidHold - Cancel a hold
- GetManyConfigs - Get many configs
- InsertConfig - Insert a new config
- DeleteConfig - Delete one config
- TestConfig - Test one config
- ActivateConfig - Activate one config
- DeactivateConfig - Deactivate one config
- ChangeConfigSecret - Change the signing secret of a config
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default, an API error will raise a formance.Models.Errors.SDKException
exception, which has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | The error message |
Request |
HttpRequestMessage | The HTTP request |
Response |
HttpResponseMessage | The HTTP response |
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the GetInfoAsync
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
formance.Models.Errors.ErrorResponse | default | application/json |
formance.Models.Errors.SDKException | 4XX, 5XX | */* |
using formance;
using formance.Models.Components;
using System;
using formance.Models.Errors;
var sdk = new Formance(security: new Security() {
ClientID = "<YOUR_CLIENT_ID_HERE>",
ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
});
try
{
var res = await sdk.Ledger.V1.GetInfoAsync();
// handle response
}
catch (Exception ex)
{
if (ex is Models.Errors.ErrorResponse)
{
// Handle exception data
throw;
}
else if (ex is formance.Models.Errors.SDKException)
{
// Handle default exception
throw;
}
}
You can override the default server globally by passing a server index to the serverIndex: int
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
# | Server | Variables | Default values |
---|---|---|---|
0 | http://localhost |
||
1 | https://{organization}.{environment}.formance.cloud |
organization: string environment: ServerEnvironment |
"orgID-stackID" "sandbox" |
If the selected server has variables, you may override their default values through the additional parameters made available in the SDK constructor.
using formance;
using formance.Models.Components;
var sdk = new Formance(
serverIndex: 1,
security: new Security() {
ClientID = "<YOUR_CLIENT_ID_HERE>",
ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
}
);
var res = await sdk.GetVersionsAsync();
// handle response
The default server can also be overridden globally by passing a URL to the serverUrl: string
optional parameter when initializing the SDK client instance. For example:
using formance;
using formance.Models.Components;
var sdk = new Formance(
serverUrl: "http://localhost",
security: new Security() {
ClientID = "<YOUR_CLIENT_ID_HERE>",
ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
}
);
var res = await sdk.GetVersionsAsync();
// handle response
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
ClientID ClientSecret |
oauth2 | OAuth2 Client Credentials Flow |
You can set the security parameters through the security
optional parameter when initializing the SDK client instance. For example:
using formance;
using formance.Models.Components;
var sdk = new Formance(security: new Security() {
ClientID = "<YOUR_CLIENT_ID_HERE>",
ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
});
var res = await sdk.GetVersionsAsync();
// handle response
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.