transferzero-sdk
TransferZero - the Ruby gem for the TransferZero API
Reference documentation for the TransferZero API V1
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0
- Package version: 1.36.4
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
For more information, please visit:
Installation
Build a gem
To build the Ruby code into a gem:
gem build transferzero-sdk.gemspec
Then either install the gem locally:
gem install ./transferzero-sdk-1.36.4.gem
(for development, run gem install --dev ./transferzero-sdk-1.36.4.gem
to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'transferzero-sdk', '~> 1.36.4'
Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/transferzero/transferzero-sdk-ruby, then add the following in the Gemfile:
gem 'transferzero-sdk', :git => 'https://github.com/transferzero/transferzero-sdk-ruby.git'
Include the Ruby code directly
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Getting Started
Please follow the installation procedure and then run the following code:
Webhooks
To parse webhooks you can use the following snippet:
webhook_content = "{ webhook content from endpoint }"
url = "<url from webhook headers>"
headers = {
"Authorization-Nonce": "<nonce from webhook headers>",
"Authorization-Key": "<key from webhook headers>",
"Authorization-Signature": "<signature from webhook headers>"
}
webhook_api = TransferZero::ApiClient.new
if webhook_api.validate_webhook_request(webhook_url, webhook_content, headers)
webhook = webhook_api.parse_response(webhook_content, "Webhook")
if webhook['event'].start_with?('transaction')
transaction_webhook = webhook_api.parse_response(webhook_content, 'TransactionWebhook')
puts transaction_webhook.object.to_s
elsif webhook['event'].start_with?('recipient')
recipient_webhook = webhook_api.parse_response(webhook_content, 'RecipientWebhook')
puts recipient_webhook.object.to_s
elsif webhook['event'].start_with?('payout_method')
payout_method_webhook = webhook_api.parse_response(webhook_content, 'PayoutMethodWebhook')
puts payout_method_webhook.object.to_s
elsif webhook['event'].start_with?('sender')
sender_webhook = webhook_api.parse_response(webhook_content, 'SenderWebhook')
puts sender_webhook.object.to_s
elsif webhook['event'].start_with?('document')
document_webhook = webhook_api.parse_response(webhook_content, 'DocumentWebhook')
puts document_webhook.object.to_s
else
puts webhook
end
end
Documentation for API Endpoints
All URIs are relative to https://api-sandbox.transferzero.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
TransferZero::APILogsApi | get_api_log | GET /api_logs/{API Log ID} | Fetch an individual API log |
TransferZero::APILogsApi | get_api_logs | GET /api_logs | Fetch a list of API logs |
TransferZero::AccountDebitsApi | post_accounts_debits | POST /accounts/debits | Creating an account debit |
TransferZero::AccountValidationApi | post_account_validations | POST /account_validations | Validates the existence of a bank account or a mobile phone number |
TransferZero::AccountsApi | get_account | GET /accounts/{Currency} | Fetches account balance for specified currrency |
TransferZero::AccountsApi | get_accounts | GET /accounts | Fetches account balances for all currencies |
TransferZero::CurrencyInfoApi | info_currencies | GET /info/currencies | Getting a list of possible requested currencies |
TransferZero::CurrencyInfoApi | info_currencies_in | GET /info/currencies/in | Getting a list of possible input currencies |
TransferZero::CurrencyInfoApi | info_currencies_out | GET /info/currencies/out | Getting a list of possible output currencies |
TransferZero::DocumentsApi | get_document | GET /documents/{Document ID} | Fetching a document |
TransferZero::DocumentsApi | get_documents | GET /documents | Getting a list of documents |
TransferZero::DocumentsApi | post_documents | POST /documents | Creating a document |
TransferZero::LogsApi | get_webhook_log | GET /logs/{Webhook Log ID} | Fetch an individual webhook log |
TransferZero::LogsApi | get_webhook_logs | GET /logs/webhooks | Fetch a list of webhook logs |
TransferZero::PayinMethodsApi | delete_payin_method | DELETE /payin_methods/{PayinMethod ID} | Deleting a payin method |
TransferZero::PayinMethodsApi | get_payin_method | GET /payin_methods/{PayinMethod ID} | Fetching a payin method |
TransferZero::PayinMethodsApi | patch_payin_method | PATCH /payin_methods/{PayinMethod ID} | Updating a payin method |
TransferZero::PayinMethodsApi | retry_payin_method | POST /payin_methods/{PayinMethod ID}/retry | Retries PayinMethod |
TransferZero::PaymentMethodsApi | payment_methods_in | GET /info/payment_methods/in | This method returns possible payin methods. |
TransferZero::PaymentMethodsApi | payment_methods_out | GET /info/payment_methods/out | This method returns possible payout methods. |
TransferZero::PayoutMethodsApi | delete_payout_method | DELETE /payout_methods/{Payout Method ID} | Deleting a payout method |
TransferZero::PayoutMethodsApi | get_payout_method | GET /payout_methods/{Payout Method ID} | Fetching a payout method |
TransferZero::PayoutMethodsApi | get_payout_methods | GET /payout_methods | Listing payout methods |
TransferZero::PayoutMethodsApi | patch_payout_method | PATCH /payout_methods/{Payout Method ID} | Updating a payout method |
TransferZero::PayoutMethodsApi | post_payout_methods | POST /payout_methods | Creating a payout method |
TransferZero::RecipientsApi | delete_recipient | DELETE /recipients/{Recipient ID} | Cancelling a recipient |
TransferZero::RecipientsApi | get_recipients | GET /recipients | Getting a list of recipients with filtering |
TransferZero::RecipientsApi | patch_recipient | PATCH /recipients/{Recipient ID} | Updating a recipient |
TransferZero::RecipientsApi | proof_of_payments | GET /recipients/{Recipient ID}/proof_of_payments | Returns list of proof of payments |
TransferZero::SendersApi | delete_sender | DELETE /senders/{Sender ID} | Deleting a sender |
TransferZero::SendersApi | get_sender | GET /senders/{Sender ID} | Fetching a sender |
TransferZero::SendersApi | get_senders | GET /senders | Listing senders |
TransferZero::SendersApi | patch_sender | PATCH /senders/{Sender ID} | Updating a sender |
TransferZero::SendersApi | post_senders | POST /senders | Creating a sender |
TransferZero::TransactionsApi | calculate_transactions | POST /transactions/calculate | Calculates transaction amounts for a transaction payload |
TransferZero::TransactionsApi | create_and_fund_transaction | POST /transactions/create_and_fund | Creates a new transaction and funds it from account balance |
TransferZero::TransactionsApi | get_transaction | GET /transactions/{Transaction ID} | Fetch a single transaction |
TransferZero::TransactionsApi | get_transactions | GET /transactions | Get a list of transactions |
TransferZero::TransactionsApi | payin_transaction | POST /transactions/{Transaction ID}/payin | Creates a fake payin for transaction |
TransferZero::TransactionsApi | payout_transaction | POST /transactions/{Transaction ID}/payout | Creates a fake payout for transaction |
TransferZero::TransactionsApi | post_transactions | POST /transactions | Creates a new transaction |
TransferZero::TransactionsApi | validate_transactions | POST /transactions/validate | Validates a transaction payload |
TransferZero::WebhooksApi | delete_webhook | DELETE /webhooks/{Webhook ID} | Unsubscribing from a webhook |
TransferZero::WebhooksApi | get_webhook | GET /webhooks/{Webhook ID} | Find a webhook's details |
TransferZero::WebhooksApi | get_webhook_events | GET /webhooks/events | Find possible webhook events |
TransferZero::WebhooksApi | get_webhooks | GET /webhooks | Listing webhooks |
TransferZero::WebhooksApi | post_webhooks | POST /webhooks | Creating a webhook |
Documentation for Models
- TransferZero::Account
- TransferZero::AccountListResponse
- TransferZero::AccountMeta
- TransferZero::AccountResponse
- TransferZero::AccountValidationError
- TransferZero::AccountValidationRequest
- TransferZero::AccountValidationResponse
- TransferZero::AccountValidationResult
- TransferZero::ApiLog
- TransferZero::ApiLogListResponse
- TransferZero::ApiLogResponse
- TransferZero::Currency
- TransferZero::CurrencyExchange
- TransferZero::CurrencyExchangeListResponse
- TransferZero::CurrencyListResponse
- TransferZero::CurrencyOpposite
- TransferZero::Debit
- TransferZero::DebitListRequest
- TransferZero::DebitListResponse
- TransferZero::DebitRequest
- TransferZero::DebitRequestWrapper
- TransferZero::Document
- TransferZero::DocumentListResponse
- TransferZero::DocumentRequest
- TransferZero::DocumentResponse
- TransferZero::DocumentWebhook
- TransferZero::ErrorStatus
- TransferZero::FieldDescription
- TransferZero::FieldSelectValidation
- TransferZero::FieldValidation
- TransferZero::Pagination
- TransferZero::PaginationMeta
- TransferZero::PayinMethod
- TransferZero::PayinMethodDetails
- TransferZero::PayinMethodDetailsBTC
- TransferZero::PayinMethodDetailsMobile
- TransferZero::PayinMethodDetailsNGNBank
- TransferZero::PayinMethodRequest
- TransferZero::PayinMethodResponse
- TransferZero::PayinMethodState
- TransferZero::PayinMethodUxFlow
- TransferZero::PaymentMethod
- TransferZero::PaymentMethodListResponse
- TransferZero::PaymentMethodOpposite
- TransferZero::PayoutMethod
- TransferZero::PayoutMethodBankAccountTypeEnum
- TransferZero::PayoutMethodCashProviderEnum
- TransferZero::PayoutMethodCountryEnum
- TransferZero::PayoutMethodDetails
- TransferZero::PayoutMethodDetailsBRLBank
- TransferZero::PayoutMethodDetailsBTC
- TransferZero::PayoutMethodDetailsBWPBank
- TransferZero::PayoutMethodDetailsBalance
- TransferZero::PayoutMethodDetailsCADBank
- TransferZero::PayoutMethodDetailsEGPBank
- TransferZero::PayoutMethodDetailsEGPCash
- TransferZero::PayoutMethodDetailsGBPBank
- TransferZero::PayoutMethodDetailsGHSBank
- TransferZero::PayoutMethodDetailsGHSCash
- TransferZero::PayoutMethodDetailsGNFMobile
- TransferZero::PayoutMethodDetailsIBAN
- TransferZero::PayoutMethodDetailsINRBank
- TransferZero::PayoutMethodDetailsKESBank
- TransferZero::PayoutMethodDetailsKESMobile
- TransferZero::PayoutMethodDetailsMADCash
- TransferZero::PayoutMethodDetailsMobile
- TransferZero::PayoutMethodDetailsNGNBank
- TransferZero::PayoutMethodDetailsNZDBank
- TransferZero::PayoutMethodDetailsUGXBank
- TransferZero::PayoutMethodDetailsUSDBank
- TransferZero::PayoutMethodDetailsUSDCash
- TransferZero::PayoutMethodDetailsXAFBank
- TransferZero::PayoutMethodDetailsXAFMobile
- TransferZero::PayoutMethodDetailsXOFBank
- TransferZero::PayoutMethodDetailsXOFCash
- TransferZero::PayoutMethodDetailsXOFMobile
- TransferZero::PayoutMethodDetailsZARBank
- TransferZero::PayoutMethodDetailsZMWBank
- TransferZero::PayoutMethodGenderEnum
- TransferZero::PayoutMethodIdentityCardTypeEnum
- TransferZero::PayoutMethodLegalEntityTypeEnum
- TransferZero::PayoutMethodListResponse
- TransferZero::PayoutMethodMobileProviderEnum
- TransferZero::PayoutMethodNatureOfBusinessEnum
- TransferZero::PayoutMethodPixKeyTypeEnum
- TransferZero::PayoutMethodRequest
- TransferZero::PayoutMethodResponse
- TransferZero::PayoutMethodTransferReasonEnum
- TransferZero::PayoutMethodWebhook
- TransferZero::PoliticallyExposedPerson
- TransferZero::ProofOfPayment
- TransferZero::ProofOfPaymentListResponse
- TransferZero::Recipient
- TransferZero::RecipientListResponse
- TransferZero::RecipientRequest
- TransferZero::RecipientResponse
- TransferZero::RecipientState
- TransferZero::RecipientStateReasonDetails
- TransferZero::RecipientWebhook
- TransferZero::Sender
- TransferZero::SenderListResponse
- TransferZero::SenderRequest
- TransferZero::SenderResponse
- TransferZero::SenderResponseExisting
- TransferZero::SenderResponseMeta
- TransferZero::SenderState
- TransferZero::SenderWebhook
- TransferZero::StateReasonDetails
- TransferZero::Transaction
- TransferZero::TransactionListResponse
- TransferZero::TransactionRequest
- TransferZero::TransactionResponse
- TransferZero::TransactionResponseExisting
- TransferZero::TransactionResponseMeta
- TransferZero::TransactionState
- TransferZero::TransactionTraits
- TransferZero::TransactionWebhook
- TransferZero::ValidationErrorDescription
- TransferZero::Webhook
- TransferZero::WebhookDefinition
- TransferZero::WebhookDefinitionEventListResponse
- TransferZero::WebhookDefinitionListResponse
- TransferZero::WebhookDefinitionRequest
- TransferZero::WebhookDefinitionResponse
- TransferZero::WebhookLog
- TransferZero::WebhookLogListResponse
- TransferZero::WebhookLogMetadata
- TransferZero::WebhookLogMetadataRequest
- TransferZero::WebhookLogMetadataResponse
- TransferZero::WebhookLogResponse
Documentation for Authorization
You can set the API Key and Secret on the ApiClient object for authentication:
# Load the gem
require 'transferzero'
# Setup authorization
TransferZero.configure do |config|
config.api_key = 'YOUR API KEY'
config.api_secret = 'YOUR API SECRET'
config.host = "https://api-sandbox.transferzero.com/v1"
end
begin
request = TransferZero::AccountValidationRequest.new # account validation api
request.bank_account = '9040004458219'
request.bank_code = '020100'
request.country = 'GH'
request.currency = 'GHS'
request.method = 'bank'
avi = TransferZero::AccountValidationApi.new
account_validation = avi.post_account_validations(request)
account_name = account_validation.object.account_name
puts "Account Name: #{account_name}"
rescue TransferZero::ApiError => e
if e.validation_error
puts e.response_object("AccountValidationResponse").meta.error
else
puts "Exception when calling AccountValidationApi#account_validation_example: #{e}"
end
end