CurrencycloudClient
Production-grade Elixir / Hex client for the Currencycloud v2 API.
Features
- Complete API coverage — all 14 API groups: Accounts, Balances, Beneficiaries, Contacts, Conversions, Funding, Payments, Payers, Rates, Reference, Reporting, Transactions, Transfers, Withdrawal Accounts.
- Token lifecycle management —
SessionGenServer proactively refreshes tokens before expiry; auto-retries on 401. - Exponential backoff with full jitter —
RetryStrategyretries on 429 and 5xx. - Typed error structs —
AuthenticationError,BadRequestError,TooManyRequestsError,NetworkError, etc. - Sub-account scoping — first-class
on_behalf_ofsupport as a per-call param or client-level scope. - Webhook verification — HMAC-SHA256 signature verification with replay-attack protection.
- Telemetry integration —
:telemetryevents for every request, token refresh, and retry. - NimbleOptions config validation — clear errors at startup, not at runtime.
- OTP-native — supervised
SessionGenServer.
Installation
def deps do
[{:currencycloud_client, "~> 0.1"}]
endQuick start
config = CurrencycloudClient.Config.new!(
environment: :demo,
login_id: System.fetch_env!("CC_LOGIN_ID"),
api_key: System.fetch_env!("CC_API_KEY")
)
{:ok, session} = CurrencycloudClient.Session.start_link(config: config)
client = CurrencycloudClient.Client.new(config, session)
{:ok, balance} = CurrencycloudClient.API.Balances.get(client, "EUR")
IO.puts("EUR: #{balance["amount"]}")See the full documentation at hexdocs.pm/currencycloud_client.