Wallets
Your company funds every payout from a single wallet. WalletsClient covers reading
the current balance and walking the transaction history.
The currency path segment does not select between multiple wallets β a company has
exactly one β so the backend validates its shape and then ignores it. Pass the currency
your wallet is actually denominated in anyway; a malformed value is still rejected.
Reach these methods either directly on RetornaClient or through client.wallets() β
both call the same code.
getMyWallet(currency)β
Reads the authenticated company's wallet: its status and current balance.
Signatureβ
public MyWallet getMyWallet(String currency)
Parametersβ
| Name | Type | Required | Description |
|---|---|---|---|
currency | String | Yes | 3 to 5 uppercase letters, e.g. USDR. Shape-checked client-side before the call goes out. |
Returnsβ
MyWallet:
| Accessor | Type | Meaning |
|---|---|---|
status() | String | Wallet status. |
currency() | String | Wallet currency. |
amount() | String | Current balance, decimal string β parse with BigDecimal, never double. |
Exampleβ
import app.retorna.sdk.RetornaClient;
import app.retorna.sdk.RetornaClientBuilder;
import app.retorna.sdk.core.environment.RetornaEnvironment;
import app.retorna.sdk.models.wallet.MyWallet;
RetornaClient client = new RetornaClientBuilder()
.environment(RetornaEnvironment.SANDBOX)
.clientId(System.getenv("RETORNA_CLIENT_ID"))
.clientSecret(System.getenv("RETORNA_CLIENT_SECRET"))
.privateKey(System.getenv("RETORNA_PRIVATE_KEY"))
.buildClient();
MyWallet wallet = client.getMyWallet("USDR");
System.out.printf("Balance: %s %s (status=%s)%n",
wallet.amount(), wallet.currency(), wallet.status());
Errorsβ
IllegalArgumentExceptionβcurrencyis null or does not match 3-to-5 uppercase letters.RetornaB2BExceptionwithcodeEnum()one of:B2B_WALLET_NOT_CONFIGUREDβ no wallet provisioned yet,B2B_WALLET_NOT_FOUND,B2B_UNAUTHORIZED,B2B_COMPANY_NOT_FOUND,B2B_RATE_LIMITEDβ retryable,B2B_UNKNOWN.RetornaAuthExceptionβ token exchange failure.RetornaSdkExceptionβ network failure or deserialization failure.
Notesβ
- Amounts are decimal strings, not floating point. Parse them with
BigDecimal. - Do not read anything into the specific
currencyyou pass β the backend does not route on it.
API referenceβ
getMyWalletTransactions(currency, type, params)β
Walks the wallet's transaction history, cursor-paginated.
Signatureβ
public WalletTransactionsResponse getMyWalletTransactions(
String currency,
WalletTransactionType type,
ListWalletTransactionsParams params
)
Parametersβ
| Name | Type | Required | Description |
|---|---|---|---|
currency | String | Yes | Same shape rule as getMyWallet. |
type | WalletTransactionType | Yes | The listing to read. Today the SDK exposes TOP_UP (wire value "top_up"), which returns every credit to the wallet: on-chain deposits and credits booked by treasury. |
params | ListWalletTransactionsParams | No (pass null or firstPage()) | cursor (String, opaque, null for the first page) and limit (Integer, 1..100, backend default 10). Keep limit fixed across a walk. |
Convenience factories: ListWalletTransactionsParams.firstPage() and
firstPage(int limit).
Returnsβ
WalletTransactionsResponse:
| Accessor | Type | Meaning |
|---|---|---|
pagination() | CursorPagination | nextCursor() (nullable when done), hasMore(), limit(), total() (nullable). |
data() | List<WalletTransaction> | Transactions on this page. |
Each WalletTransaction:
| Accessor | Type | Meaning |
|---|---|---|
id() | String | Transaction id. |
externalId() | String | Client-side reference, where applicable; nullable. |
type() | String | Lowercase wire form: "top_up" for an on-chain deposit, "b2b_manual_credit" for a credit booked by treasury. Kept as a string so a new type does not break deserialization; compare against WalletTransactionType.TOP_UP.wire(). |
amount() / currency() | String | Transaction amount (decimal string with two decimals, e.g. "20.00") and currency. |
createdAt() | OffsetDateTime | Creation timestamp. |
status() | String | PENDING or COMPLETED, or null when the funding provider reported nothing publishable for an on-chain top-up. A b2b_manual_credit is always COMPLETED. The listing includes top-ups that are not credited yet β check this before treating an amount as available balance. |
Exampleβ
import app.retorna.sdk.RetornaClient;
import app.retorna.sdk.RetornaClientBuilder;
import app.retorna.sdk.core.environment.RetornaEnvironment;
import app.retorna.sdk.models.wallet.ListWalletTransactionsParams;
import app.retorna.sdk.models.wallet.WalletTransaction;
import app.retorna.sdk.models.wallet.WalletTransactionType;
import app.retorna.sdk.models.wallet.WalletTransactionsResponse;
RetornaClient client = new RetornaClientBuilder()
.environment(RetornaEnvironment.SANDBOX)
.clientId(System.getenv("RETORNA_CLIENT_ID"))
.clientSecret(System.getenv("RETORNA_CLIENT_SECRET"))
.privateKey(System.getenv("RETORNA_PRIVATE_KEY"))
.buildClient();
String cursor = null;
do {
WalletTransactionsResponse page = client.getMyWalletTransactions(
"USDR",
WalletTransactionType.TOP_UP,
new ListWalletTransactionsParams(cursor, 50));
for (WalletTransaction tx : page.data()) {
System.out.printf("%s %s %s %s%n",
tx.createdAt(), tx.amount(), tx.currency(), tx.status());
}
cursor = page.pagination().nextCursor();
} while (cursor != null);
Errorsβ
IllegalArgumentExceptionβ malformedcurrency, nulltype, an empty (but non-null)cursor, or alimitoutside 1..100.RetornaB2BExceptionwithcodeEnum()one of:B2B_WALLET_NOT_CONFIGURED,B2B_WALLET_NOT_FOUND,B2B_INVALID_PAGINATION_CURSOR,B2B_UNAUTHORIZED,B2B_RATE_LIMITEDβ retryable,B2B_UNKNOWN.RetornaAuthExceptionβ token exchange failure.RetornaSdkExceptionβ network failure or deserialization failure.
Notesβ
- This listing moved from offset to cursor pagination β sending an offset-style
pageparameter is not supported and returns400. - Keep
limitfixed for the whole walk, same rule as listing orders.