Create a new project
Create a new directory and initialize a new npm package.Install TypeScript and the Node.js type definitions.
Install the Formance SDK
Next install the Formance SDK as well as the Formance OAuth helper.The Formance API relies on OAuth 2.0 for authentication.The Formance OAuth helper simplifies the OAuth flow and provides a simple interface to obtain an access token using the
client_credentials
grant type.For more information, see OAuth 2.0.The Formance OAuth helper uses the
client_credentials
grant type, which requires a client ID and client secret. These are sensitive credentials that should not be exposed to the public.If you’re integrating Formance into a web application, you should use an OAuth flow that does not require a client secret, such as the authorization code grant.Hello World from the Formance Ledger
Create a new file Next, run the file using
index.ts
and add the following code. Replace the endpoint, client ID and client secret with your own values.You’ll need the API endpoint and the credentials created during the SDK’s Getting Started guide. If you don’t have them, you can create them by following the guide.
ts-node
.Numary is the Formance’s former name.