{"id":18712119,"url":"https://github.com/Milaap/transferwise-rb","last_synced_at":"2025-04-12T12:31:27.153Z","repository":{"id":59157954,"uuid":"83552434","full_name":"Milaap/transferwise-rb","owner":"Milaap","description":"Ruby client for TransferWise api","archived":false,"fork":false,"pushed_at":"2019-11-12T16:09:15.000Z","size":33,"stargazers_count":15,"open_issues_count":2,"forks_count":29,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-07T12:52:18.608Z","etag":null,"topics":["api-client","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Milaap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-01T12:32:35.000Z","updated_at":"2023-06-16T07:46:14.000Z","dependencies_parsed_at":"2022-09-13T20:11:02.971Z","dependency_job_id":null,"html_url":"https://github.com/Milaap/transferwise-rb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milaap%2Ftransferwise-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milaap%2Ftransferwise-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milaap%2Ftransferwise-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milaap%2Ftransferwise-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Milaap","download_url":"https://codeload.github.com/Milaap/transferwise-rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248566503,"owners_count":21125678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","ruby"],"created_at":"2024-11-07T12:40:51.624Z","updated_at":"2025-04-12T12:31:27.147Z","avatar_url":"https://github.com/Milaap.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# TransferWise\n\nWelcome to transfer_wise ruby gem! The transfer_wise Ruby gem provide a small SDK for convenient access to the TransferWise API from applications written in the Ruby language. It provides a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which allows the bindings to tolerate a number of different versions of the API.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'transfer_wise'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install transfer_wise\n\n## Usage\n\nThe library needs to be configured with environment mode \"test\" or \"live\"\n```ruby\nFor live mode\nTransferWise.mode = \"live\"\n\nFor test mode\nTransferWise.mode = \"test\"\n```\n# Development\n## Authentication\n\nTransferWise uses OAuth 2 for API authentication and authorization. Calls done in behalf of the user require the access token, other calls require Basic Auth. Please keep in mind that tokens are unique to user and should be stored securely.\n\n```ruby\ntw = TransferWise::OAuth.new(client_id, client_secret)\n```\n\n```ruby\nredirect_url = \"www.example.com/callback\" # Url where you want user to redirect back after authentication from transferwise\nurl = tw.authorize_url(redirect_url)\n```\n\nThis will give you the url where you have to redirect the user to authorize and after authorization you will get redirected to redirect_url with  authentication_code.\n\n```ruby\ncode = \"aqw12q\" # some authentication_code from response of authentication\ntw.get_access_token(code, redirect_url)\n=begin\nResponse:\n{\n    \"token_type\" =\u003e \"bearer\",\n         \"scope\" =\u003e \"transfers\",\n   :access_token =\u003e \"1bceb8d8-4115-4daa-8370-d9bc8de0c732\",\n  :refresh_token =\u003e \"6ff3451a-e713-416a-b735-20d8020f6ce2\",\n     :expires_at =\u003e 1487908739\n}\n=end\n```\n\nStore this access token and periodically refresh it before it expires\n\n```ruby\ntw.refresh_token(access_token, opts = {refresh_token: refresh_token, expires_at: expires_at})\n=begin\nResponse:\n{\n  \"token_type\" =\u003e \"bearer\",\n       \"scope\" =\u003e \"transfers\",\n :access_token =\u003e \"59e18a25-c84e-4f06-aee4-416c9211a8c8\",\n:refresh_token =\u003e \"6ff3451a-e713-416a-b735-20d8020f6ce2\",\n   :expires_at =\u003e 1487873072\n}\n=end\n```\n\n# Anatomy of a TransferWise Transfer\nTo create the transfers, we need to get profile, quote and target account first.\n\n## Profile\nCreate a profile as individual or business.\n```ruby\nprofile_request = {\n  type: \"personal\", # or business\n  details: {\n      firstName: \"First name\",       # Sender FirstName\n      lastName: \"Last Name\",         # Sender LastName\n      dateOfBirth: \"1980-07-20\",     # sender DOB\n      phoneNumber: \"+918147001602\"   # Sender number in international format\n  }\n}\nprofile = TransferWise::Profile.create(profile_request, {access_token: access_token})\n```\n## Quote\nCreate a quote\n```ruby\nquote_request = {\n  profile: profile.id,  # got from previous profile response\n  source: \"USD\",        # source currency\n  target: \"INR\",        # target currency\n  sourceAmount: \"100\",  # source amount is amount which sender is going to send. TransferWise will deduct their fees and receipient will receive less money.\n  rateType: \"FIXED\"\n}\nquote = TransferWise::Quote.create(quote_request, {access_token: access_token})\n```\n## Account\n\nNext step is to create the account where you want to transfer the money.\nIf you already have the account you can use that account id and skip this account creation part.\n\n```ruby\naccount_request = {\n  \"profile\" =\u003e profile.id,\n  \"accountHolderName\" =\u003e \"Account Holder Name\",\n  \"currency\" =\u003e \"INR\",     # target currency name\n  \"country\" =\u003e \"IN\",       # target country code\n  \"type\" =\u003e \"\",            # get from account requirements\n  \"details\" =\u003e {\n      \"legalType\" =\u003e \"PRIVATE\",\n      \"accountNumber\" =\u003e \"\",     # target account number\n      \"ifscCode\" =\u003e \"\",          # ifsc code or any other field. Get field name finformation from account requirements api. This could be different for other country except india.\n      \"address\" =\u003e {             # get address details also from account requirement based on country.\n        \"city\" =\u003e \"City name\",   # city name\n        \"country\" =\u003e \"IN\",       # country code\n        \"firstLine\" =\u003e \"\",       # address first line\n        \"postCode\" =\u003e \"\"         # post code\n      }\n  }\n}\naccount = TransferWise::Account.create(account_request, {access_token: access_token})\n```\n\n## Transfer\n\nCreate a transfer\n```ruby\ntransfer_request = {\n  \"customerTransactionId\" =\u003e \"d57db29d-1060-4ce8-bd5e-800edaf982a9\", # some unique uuid format number to identify the transfer.\n  \"targetAccount\" =\u003e account.id,\n  \"quote\" =\u003e quote.id,\n  \"details\" =\u003e {\n    \"reference\" =\u003e \"Any Comment\" # get the field detail, from transfer requirements api before creating the transfer object.\n  }\n}\ntransfer = TransferWise::Transfer.create(transfer_request, {access_token: access_token})\n\n```\n\nThe Transfer object is created via the TransferWise website. You can go there and make payments to complete the transfer.\n\n# TransferWise Borderless Account\nA Borderless Account is a \"virtual\" bank account that you can control via the TransferWise API, to send funds to external bank accounts (across borders), as well as download statements and view the current balance.\n\n## Borderless Accounts\nhttps://api-docs.transferwise.com/v1/borderless-account/search-account-by-user-profile\n\nGet all the borderless accounts given a `profileId`\n\n```ruby\naccount_request = { profileId: 1234567 }\naccount = TransferWise::BorderlessAccount.list(nil, { 'params' =\u003e account_request })\n```\n\n## Borderless Account\nhttps://api-docs.transferwise.com/v1/borderless-account/get-available-balances\n\nGet a borderless account given a `borderlessAccountId`\n\n```ruby\nborderlessAccountId = 123\naccount = TransferWise::BorderlessAccount.get(borderlessAccountId)\n```\n\n## Transactions\nhttps://api-docs.transferwise.com/v1/borderless-account/get-account-statement\n\nGet all the transactions for an account given a `borderlessAccountId`\n\n```ruby\nborderlessAccountId = 123\ntransactions = TransferWise::BorderlessAccount::Transaction.list(nil, { 'params' =\u003e { page: '5' } }, resource_id: borderlessAccountId)\n```\n\n## Statement\nhttps://api-docs.transferwise.com/v1/borderless-account/get-statement\n\nGet a borderless account statement for a given currency\n\n```ruby\nquery_string = {\n  profileId: 1234567,\n  currency: 'GBP',\n  startDate: '2017-12-01',\n  endDate: '2017-12-07'\n}\nstatement = TransferWise::BorderlessAccount::Statement.list(nil, { 'params' =\u003e query_string })\n```\n\n## Currencies\nhttps://api-docs.transferwise.com/v1/borderless-account/available-currencies\n\nGet a list of available currencies for your balances\n\n```ruby\nTransferWise::BorderlessAccount::BalanceCurrency.list\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMilaap%2Ftransferwise-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMilaap%2Ftransferwise-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMilaap%2Ftransferwise-rb/lists"}