transferzero / transferzero-php-sdk
TransferZero Client Library for PHP
Installs: 8 549
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 26
Forks: 0
Open Issues: 2
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^7.4
- squizlabs/php_codesniffer: ~2.6
- dev-master
- 1.36.4
- 1.36.3
- 1.36.0
- 1.35.1
- 1.35.0
- 1.34.2
- 1.34.1
- 1.34.0
- 1.33.1
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.3
- 1.30.2
- 1.30.1
- 1.30.0
- 1.29.0
- 1.28.2
- 1.28.1
- 1.28.0
- 1.27.9
- 1.27.8
- 1.27.5
- 1.27.3
- 1.27.0
- 1.26.1
- 1.25.0
- 1.24.0
- 1.23.5
- 1.23.4
- 1.23.3
- 1.23.0
- 1.22.1
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.4
- 1.19.3
- 1.19.2
- 1.19.1
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.1
- 1.16.0
- 1.15.1
- 1.15.0
- 1.14.1
- 1.14.0
- 1.13.0
- 1.12.2
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.0.0
- dev-BTA-14095-add-api-examples
- dev-check-upgrade-guzzle
- dev-upgrade-Guzzle
- dev-BTA-10785-revert-codebuild-changes
- dev-upgrade-to-use-x-group-params
- dev-production
- dev-staging
- dev-BTA-2022-re-release-transferzero-php-sdk
This package is auto-updated.
Last update: 2025-02-22 14:12:13 UTC
README
This is the PHP client library for use with the TransferZero API. To use the API please register and obtain valid API keys on the TransferZero developer portal.
For more information, please visit:
This PHP package is automatically generated by the OpenAPI Generator project:
- API version: 1.0
- Package version: 1.36.5
Requirements
PHP 7.1 and later
Installation & Usage
Composer
To install via Composer, run:
composer require transferzero/transferzero-php-sdk
Then run composer install
New to Composer? Learn more at Composer's Getting Started page
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to/TransferZeroSdk/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php');
Authentication
Set the API Key and Secret on the Configuration object for authentication:
TransferZero\Configuration::getDefaultConfiguration() ->setHost("https://api-sandbox.transferzero.com/v1") ->setApiKey("<key>") ->setApiSecret("<secret>");
Example
$apiInstance = new TransferZero\Api\APILogsApi(); $api_log_id = 'api_log_id_example'; // string | ID of the API log to retrieve Example: `/v1/api_logs/00485ce9-532b-45e7-8518-7e5582242407` try { $result = $apiInstance->getApiLog($api_log_id); print_r($result); } catch (Exception $e) { if ($e->isValidationError()) { $response = $e->getResponseObject(); echo "Validation error(s) occurred when calling the endpoint"; print_r($response); } else { echo "An exception occurred when calling APILogsApi#getApiLog"; echo $e->getMessage(); } } ?>
You can find more examples in the examples
directory on the features required by the Onboarding documentation
Webhooks
To parse webhooks you can use the following snippet:
$webhook_content = "{ (...) }"; // The string received through the webhook callback url $webhook_headers = [ "Authorization-Nonce" => "<authorization-nonce>", "Authorization-Key" => "<authorization-key>", "Authorization-Signature" => "<authorization-signature>" ]; // The headers from the webook callback url $webhook_url = "<url>"; // The url of the webhook callback $webhooksApi = new TransferZero\Api\WebhooksApi(); if (!$webhooksApi->validateWebhookRequest($webhook_url, $webhook_content, $webhook_headers)) { echo "Webhook request validation failed"; return false; } $webhook = $webhooksApi->parseResponseString($webhook_content, 'Webhook'); if (strpos($webhook->getEvent(), 'transaction') === 0) { $transactionWebhook = $webhooksApi->parseResponseString($webhook_content, 'TransactionWebhook'); print_r($transactionWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'recipient') === 0) { $recipientWebhook = $webhooksApi->parseResponseString($webhook_content, 'RecipientWebhook'); print_r($recipientWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'payout_method') === 0) { $payoutMethodWebhook = $webhooksApi->parseResponseString($webhook_content, 'PayoutMethodWebhook'); print_r($payoutMethodWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'sender') === 0) { $senderWebhook = $webhooksApi->parseResponseString($webhook_content, 'SenderWebhook'); print_r($senderWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'document') === 0) { $documentWebhook = $webhooksApi->parseResponseString($webhook_content, 'DocumentWebhook'); print_r($documentWebhook->getObject()->__toString()); }
Documentation for API Endpoints
All URIs are relative to https://api-sandbox.transferzero.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
APILogsApi | getApiLog | GET /api_logs/{API Log ID} | Fetch an individual API log |
APILogsApi | getApiLogs | GET /api_logs | Fetch a list of API logs |
AccountDebitsApi | postAccountsDebits | POST /accounts/debits | Creating an account debit |
AccountValidationApi | postAccountValidations | POST /account_validations | Validates the existence of a bank account or a mobile phone number |
AccountsApi | getAccount | GET /accounts/{Currency} | Fetches account balance for specified currrency |
AccountsApi | getAccounts | GET /accounts | Fetches account balances for all currencies |
CurrencyInfoApi | infoCurrencies | GET /info/currencies | Getting a list of possible requested currencies |
CurrencyInfoApi | infoCurrenciesIn | GET /info/currencies/in | Getting a list of possible input currencies |
CurrencyInfoApi | infoCurrenciesOut | GET /info/currencies/out | Getting a list of possible output currencies |
DocumentsApi | getDocument | GET /documents/{Document ID} | Fetching a document |
DocumentsApi | getDocuments | GET /documents | Getting a list of documents |
DocumentsApi | postDocuments | POST /documents | Creating a document |
LogsApi | getWebhookLog | GET /logs/{Webhook Log ID} | Fetch an individual webhook log |
LogsApi | getWebhookLogs | GET /logs/webhooks | Fetch a list of webhook logs |
PayinMethodsApi | deletePayinMethod | DELETE /payin_methods/{PayinMethod ID} | Deleting a payin method |
PayinMethodsApi | getPayinMethod | GET /payin_methods/{PayinMethod ID} | Fetching a payin method |
PayinMethodsApi | patchPayinMethod | PATCH /payin_methods/{PayinMethod ID} | Updating a payin method |
PayinMethodsApi | retryPayinMethod | POST /payin_methods/{PayinMethod ID}/retry | Retries PayinMethod |
PaymentMethodsApi | paymentMethodsIn | GET /info/payment_methods/in | This method returns possible payin methods. |
PaymentMethodsApi | paymentMethodsOut | GET /info/payment_methods/out | This method returns possible payout methods. |
PayoutMethodsApi | deletePayoutMethod | DELETE /payout_methods/{Payout Method ID} | Deleting a payout method |
PayoutMethodsApi | getPayoutMethod | GET /payout_methods/{Payout Method ID} | Fetching a payout method |
PayoutMethodsApi | getPayoutMethods | GET /payout_methods | Listing payout methods |
PayoutMethodsApi | patchPayoutMethod | PATCH /payout_methods/{Payout Method ID} | Updating a payout method |
PayoutMethodsApi | postPayoutMethods | POST /payout_methods | Creating a payout method |
RecipientsApi | deleteRecipient | DELETE /recipients/{Recipient ID} | Cancelling a recipient |
RecipientsApi | getRecipients | GET /recipients | Getting a list of recipients with filtering |
RecipientsApi | patchRecipient | PATCH /recipients/{Recipient ID} | Updating a recipient |
RecipientsApi | proofOfPayments | GET /recipients/{Recipient ID}/proof_of_payments | Returns list of proof of payments |
SendersApi | deleteSender | DELETE /senders/{Sender ID} | Deleting a sender |
SendersApi | getSender | GET /senders/{Sender ID} | Fetching a sender |
SendersApi | getSenders | GET /senders | Listing senders |
SendersApi | patchSender | PATCH /senders/{Sender ID} | Updating a sender |
SendersApi | postSenders | POST /senders | Creating a sender |
TransactionsApi | calculateTransactions | POST /transactions/calculate | Calculates transaction amounts for a transaction payload |
TransactionsApi | createAndFundTransaction | POST /transactions/create_and_fund | Creates a new transaction and funds it from account balance |
TransactionsApi | getTransaction | GET /transactions/{Transaction ID} | Fetch a single transaction |
TransactionsApi | getTransactions | GET /transactions | Get a list of transactions |
TransactionsApi | payinTransaction | POST /transactions/{Transaction ID}/payin | Creates a fake payin for transaction |
TransactionsApi | payoutTransaction | POST /transactions/{Transaction ID}/payout | Creates a fake payout for transaction |
TransactionsApi | postTransactions | POST /transactions | Creates a new transaction |
TransactionsApi | validateTransactions | POST /transactions/validate | Validates a transaction payload |
WebhooksApi | deleteWebhook | DELETE /webhooks/{Webhook ID} | Unsubscribing from a webhook |
WebhooksApi | getWebhook | GET /webhooks/{Webhook ID} | Find a webhook's details |
WebhooksApi | getWebhookEvents | GET /webhooks/events | Find possible webhook events |
WebhooksApi | getWebhooks | GET /webhooks | Listing webhooks |
WebhooksApi | postWebhooks | POST /webhooks | Creating a webhook |
Documentation For Models
- Account
- AccountListResponse
- AccountMeta
- AccountResponse
- AccountValidationError
- AccountValidationRequest
- AccountValidationResponse
- AccountValidationResult
- ApiLog
- ApiLogListResponse
- ApiLogResponse
- Currency
- CurrencyExchange
- CurrencyExchangeListResponse
- CurrencyListResponse
- CurrencyOpposite
- Debit
- DebitListRequest
- DebitListResponse
- DebitRequest
- DebitRequestWrapper
- Document
- DocumentListResponse
- DocumentRequest
- DocumentResponse
- DocumentWebhook
- ErrorStatus
- FieldDescription
- FieldSelectValidation
- FieldValidation
- Pagination
- PaginationMeta
- PayinMethod
- PayinMethodDetails
- PayinMethodDetailsBTC
- PayinMethodDetailsMobile
- PayinMethodDetailsNGNBank
- PayinMethodRequest
- PayinMethodResponse
- PayinMethodState
- PayinMethodUxFlow
- PaymentMethod
- PaymentMethodListResponse
- PaymentMethodOpposite
- PayoutMethod
- PayoutMethodBankAccountTypeEnum
- PayoutMethodCashProviderEnum
- PayoutMethodCountryEnum
- PayoutMethodDetails
- PayoutMethodDetailsBRLBank
- PayoutMethodDetailsBTC
- PayoutMethodDetailsBWPBank
- PayoutMethodDetailsBalance
- PayoutMethodDetailsCADBank
- PayoutMethodDetailsEGPBank
- PayoutMethodDetailsEGPCash
- PayoutMethodDetailsGBPBank
- PayoutMethodDetailsGHSBank
- PayoutMethodDetailsGHSCash
- PayoutMethodDetailsGHSMobile
- PayoutMethodDetailsGNFMobile
- PayoutMethodDetailsIBAN
- PayoutMethodDetailsINRBank
- PayoutMethodDetailsKESBank
- PayoutMethodDetailsKESMobile
- PayoutMethodDetailsMADCash
- PayoutMethodDetailsMobile
- PayoutMethodDetailsNGNBank
- PayoutMethodDetailsNZDBank
- PayoutMethodDetailsUGXBank
- PayoutMethodDetailsUSDBank
- PayoutMethodDetailsUSDCash
- PayoutMethodDetailsXAFBank
- PayoutMethodDetailsXAFMobile
- PayoutMethodDetailsXOFBank
- PayoutMethodDetailsXOFCash
- PayoutMethodDetailsXOFMobile
- PayoutMethodDetailsZARBank
- PayoutMethodDetailsZMWBank
- PayoutMethodGenderEnum
- PayoutMethodIdentityCardTypeEnum
- PayoutMethodLegalEntityTypeEnum
- PayoutMethodListResponse
- PayoutMethodMobileProviderEnum
- PayoutMethodNatureOfBusinessEnum
- PayoutMethodPixKeyTypeEnum
- PayoutMethodRequest
- PayoutMethodResponse
- PayoutMethodTransferReasonEnum
- PayoutMethodWebhook
- PoliticallyExposedPerson
- ProofOfPayment
- ProofOfPaymentListResponse
- Recipient
- RecipientListResponse
- RecipientRequest
- RecipientResponse
- RecipientState
- RecipientStateReasonDetails
- RecipientWebhook
- Sender
- SenderListResponse
- SenderRequest
- SenderResponse
- SenderResponseExisting
- SenderResponseMeta
- SenderState
- SenderWebhook
- StateReasonDetails
- Transaction
- TransactionListResponse
- TransactionRequest
- TransactionResponse
- TransactionResponseExisting
- TransactionResponseMeta
- TransactionState
- TransactionTraits
- TransactionWebhook
- ValidationErrorDescription
- Webhook
- WebhookDefinition
- WebhookDefinitionEventListResponse
- WebhookDefinitionListResponse
- WebhookDefinitionRequest
- WebhookDefinitionResponse
- WebhookLog
- WebhookLogListResponse
- WebhookLogMetadata
- WebhookLogMetadataRequest
- WebhookLogMetadataResponse
- WebhookLogResponse