Fintoc meets Ruby

You have just found the Ruby-flavored client of Fintoc. It mainly consists of a port (more of a carbon copy, really) of fintoc-python.

Why?

You can think of Fintoc API as a piscola. And the key ingredient to a properly made piscola are the ice cubes. Sure, you can still have a piscola without ice cubes. But hey… that’s not enjoyable -- why would you do that? Do yourself a favor: go grab some ice cubes by installing this refreshing library.

Table of contents

How to Install

Add this line to your application's Gemfile:

gem 'fintoc'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install fintoc

Quickstart

  1. Get your API key and link your bank account using the Fintoc dashboard.
  2. Open your command-line interface.
  3. Write a few lines of Ruby code to see your bank movements.
require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
link = client.v1.links.get('link_token')
 = link.find(type: 'checking_account')

# Get the last 30 movements
movements = .movements.list

# Or get all the movements since a specific date
movements = .movements.list(since: '2020-08-15')

And that’s it!

Client Architecture

The Fintoc Ruby client is organized into separate clients that mirror the official API structure:

API V1 Client

The API client currently provides access to part of the Movements API:

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Link management
links = client.v1.links.list
link = client.v1.links.get('link_token')
client.v1.links.delete('link_id')

# Account access
 = link.find(id: )

API V2 Client

The API V2 client currently provides access to part of the Transfers API:

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Entities
entities = client.v2.entities.list
entity = client.v2.entities.get('entity_id')

# Transfer Accounts
accounts = client.v2.accounts.list
account = client.v2.accounts.get('account_id')
account = client.v2.accounts.create(entity_id: 'entity_id', description: 'My Account')
client.v2.accounts.update('account_id', description: 'Updated')

# Account Numbers
account_numbers = client.v2.account_numbers.list
account_number = client.v2.account_numbers.get('account_number_id')
account_number = client.v2.account_numbers.create(account_id: 'account_id', description: 'Main')
client.v2.account_numbers.update('account_number_id', description: 'Updated')

# Transfers
transfers = client.v2.transfers.list
transfer = client.v2.transfers.get('transfer_id')
transfer = client.v2.transfers.create(
  amount: 1000,
  currency: 'CLP',
  account_id: 'account_id',
  counterparty: {...}
)
client.v2.transfers.return('transfer_id')

# Simulate
simulated_transfer = client.v2.simulate.receive_transfer(
  account_number_id: 'account_number_id',
  amount: 1000,
  currency: 'CLP'
)

# Account Verifications
account_verifications = client.v2.account_verifications.list
account_verification = client.v2.account_verifications.get('account_verification_id')
account_verification = client.v2.account_verifications.create(account_number: 'account_number')

# TODO: Movements

Backward compatibility

The methods of the previous Fintoc::Client class implementation are kept for backward compatibility purposes.

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

link = client.get_link('link_token')
links = client.get_links
client.delete_link(link.id)
 = client.('link_token', 'account_id')

Documentation

This client does not support all Fintoc API endpoints yet. For complete information about the API, head to the docs.

Examples

Movements API Examples

Get accounts

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
link = client.v1.links.get('link_token')
puts link.accounts

# Or... you can pretty print all the accounts in a Link

link = client.v1.links.get('link_token')
link.show_accounts

If you want to find a specific account in a link, you can use find. You can search by any account field:

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
link = client.v1.links.get('link_token')
 = link.find(type: 'checking_account')

# Or by number
 = link.find(number: '1111111')

# Or by account id
 = link.find(id: 'sdfsdf234')

You can also search for multiple accounts matching a specific criteria with find_all:

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
link = client.v1.links.get('link_token')
accounts = link.find_all(currency: 'CLP')

To update the account balance you can use update_balance:

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
link = client.v1.links.get('link_token')
 = link.find(number: '1111111')
.update_balance

Get movements

require 'fintoc'
require 'time'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')
link = client.v1.links.get('link_token')
 = link.find(type: 'checking_account')

# You can get the account movements since a specific DateTime
yesterday = DateTime.now - 1
.movements.list(since: yesterday)

# Or you can use an ISO 8601 formatted string representation of the Date
.movements.list(since: '2020-01-01')

# You can also set how many movements you want per_page
.movements.list(since: '2020-01-01', per_page: 100)

Calling movements.list without arguments gets the last 30 movements of the account

Transfers API Examples

Entities

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Get all entities
entities = client.v2.entities.list

# Get a specific entity
entity = client.v2.entities.get('entity_id')

You can also list entities with pagination:

# Get entities with pagination
entities = client.v2.entities.list(limit: 10, starting_after: 'entity_id')

Transfer Accounts

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Create a transfer account
 = client.v2.accounts.create(
  entity_id: 'entity_id',
  description: 'My Business Account'
)

# Get a specific account
 = client.v2.accounts.get('account_id')

# List all accounts
accounts = client.v2.accounts.list

# Update an account
 = client.v2.accounts.update('account_id', description: 'Updated Description')

Account Numbers

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Create an account number
 = client.v2..create(
  account_id: 'account_id',
  description: 'Main account number'
)

# Get a specific account number
 = client.v2..get('account_number_id')

# List all account numbers
 = client.v2..list

# Update an account number
 = client.v2..update(
  'account_number_id',
  description: 'Updated account number'
)

Transfers

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Create a transfer
transfer = client.v2.transfers.create(
  amount: 10000,
  currency: 'CLP',
  account_id: 'account_id',
  counterparty: {
    name: 'John Doe',
    rut: '12345678-9',
    email: '[email protected]',
    bank: 'banco_de_chile',
    account_type: 'checking_account',
    account_number: '1234567890'
  }
)

# Get a specific transfer
transfer = client.v2.transfers.get('transfer_id')

# List all transfers
transfers = client.v2.transfers.list

# Return a transfer
returned_transfer = client.v2.transfers.return('transfer_id')

Simulate

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Simulate receiving a transfer
simulated_transfer = client.v2.simulate.receive_transfer(
  account_number_id: 'account_number_id',
  amount: 5000,
  currency: 'CLP'
)

Account Verifications

require 'fintoc'

client = Fintoc::Client.new('api_key', jws_private_key: 'jws_private_key')

# Create an account verification
 = client.v2..create(account_number: 'account_number')

# Get a specific account verification
 = client.v2..get('account_verification_id')

# List all account verifications
 = client.v2..list

Development

Dependencies

This gem supports Ruby 2.3+ but development requires modern tooling:

  • Ruby: 2.3+ (3.2+ recommended for development)
  • Bundler: 2.7+ (for development)
  • Git: For version control

Setup

# Clone the repository
git clone https://github.com/fintoc-com/fintoc-ruby.git
cd fintoc-ruby

# Install dependencies (requires Bundler 2.7+)
bundle install

# Run tests
bundle exec rspec

# Run linting
bundle exec rubocop

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fintoc-com/fintoc-ruby.