Ledgers

Create ledger

Create a new ledger with the Java SDK.

POST/ledgers

Use blnk.ledgers().create for this operation.

Call the method

ApiResponse<JsonNode> response = blnk.ledgers().create(
    CreateLedger.create()
        .name("Customer wallets")
        .metaData(Map.of("environment", "production")));
Java builderWire fieldTypeDescription
name()nameStringDisplay name for the ledger.
metaData()meta_dataMap<String, Object>Optional metadata for extra context.

Save the ledger ID

Use response.data().get("ledger_id").asText() when creating balances or transactions in this ledger.

Response

{
  "ledger_id": "ldg_073f7ffe-9dfd-42ce-aa50-d1dca1788adc",
  "name": "Customer wallets",
  "created_at": "2024-02-20T05:28:03.558281542Z",
  "meta_data": {
    "environment": "production"
  }
}
FieldTypeDescription
ledger_idStringUnique ID for the ledger. Use this when creating balances and transactions.
nameStringName you passed in the request.
created_atStringDate and time the ledger was created.
meta_dataJsonNodeMetadata object, if you sent one.