Skip to main content

Account Guide

This guide shows you how to work with account operations using the Retorna SDK.

Get Balance

Get the total balance of your account:

import com.retorna.sdk.account.BalanceResponse;

BalanceResponse balance = client.account.getBalance();
System.out.println("Total balance: " + balance.getTotalBalance());
System.out.println("Currency: " + balance.getCurrency());

With Optional Parameters

You can pass additional parameters as filters:

import java.util.HashMap;
import java.util.Map;

Map<String, Object> params = new HashMap<>();
params.put("currency", "USD");

BalanceResponse balance = client.account.getBalance(params);

Get Payout Routes

Get all available payout routes:

import com.retorna.sdk.account.PayoutRoute;
import java.util.List;

List<PayoutRoute> routes = client.account.getRoutes();

for (PayoutRoute route : routes) {
System.out.println("Route: " + route.getName());
System.out.println("Country: " + route.getCountry());
System.out.println("Status: " + route.getStatus());
System.out.println("---");
}

Filter Routes

Filter routes by country, currency or other criteria:

Map<String, Object> params = new HashMap<>();
params.put("country", "CO");
params.put("currency", "COP");

List<PayoutRoute> routes = client.account.getRoutes(params);

Route Information

Each PayoutRoute contains detailed information:

PayoutRoute route = routes.get(0);

// Basic information
String name = route.getName();
String country = route.getCountry();
PayoutRouteStatus status = route.getStatus();

// Limits
PayoutRouteLimits limits = route.getLimits();
Double minAmount = limits.getMinAmount();
Double maxAmount = limits.getMaxAmount();

// Available amounts
PayoutRouteAmounts amounts = route.getAmounts();
Double available = amounts.getAvailable();

Complete Example

import com.retorna.sdk.config.Environment;
import com.retorna.sdk.config.LoggingLevel;
import com.retorna.sdk.core.RetornaClient;
import com.retorna.sdk.core.RetornaClientOptions;
import com.retorna.sdk.account.BalanceResponse;
import com.retorna.sdk.account.PayoutRoute;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

public class AccountExample {
public static void main(String[] args) {
RetornaClient client = RetornaClient.create(
RetornaClientOptions.builder()
.environment(Environment.DEVELOP)
.loggingLevel(LoggingLevel.INFO)
.clientId(System.getenv("RETORNA_CLIENT_ID"))
.clientSecret(System.getenv("RETORNA_CLIENT_SECRET"))
.privateKey(System.getenv("RETORNA_PRIVATE_KEY"))
.build()
);

try {
// Get balance
BalanceResponse balance = client.account.getBalance();
System.out.println("=== Balance ===");
System.out.println("Total: " + balance.getTotalBalance());
System.out.println("Currency: " + balance.getCurrency());

// Get routes
List<PayoutRoute> routes = client.account.getRoutes();
System.out.println("\n=== Available Routes ===");
for (PayoutRoute route : routes) {
System.out.println("Name: " + route.getName());
System.out.println("Country: " + route.getCountry());
System.out.println("Status: " + route.getStatus());

if (route.getLimits() != null) {
System.out.println("Min: " + route.getLimits().getMinAmount());
System.out.println("Max: " + route.getLimits().getMaxAmount());
}
System.out.println("---");
}

// Filter routes by country
Map<String, Object> params = new HashMap<>();
params.put("country", "CO");
List<PayoutRoute> colombiaRoutes = client.account.getRoutes(params);
System.out.println("\n=== Colombia Routes ===");
System.out.println("Total: " + colombiaRoutes.size());

} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
}
}
}

Error Handling

try {
BalanceResponse balance = client.account.getBalance();
} catch (RuntimeException e) {
// API error (4xx, 5xx)
System.err.println("API error: " + e.getMessage());
} catch (Exception e) {
// Network, parsing, etc. error
System.err.println("General error: " + e.getMessage());
e.printStackTrace();
}

Next Steps

Resources
Blog
Find us on social networks
For complaints, please contact via email denuncias@retorna.app
We belong to the Financial Analysis Unit (UAF).
Supervised by
Registration number is C100000211.
Members of
With the support ofCon el apoyo de
Copyright © Retorna Holding Spa 2024