Paysera Wallet Transfers API Client
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
README.md
composer.json

README.md

paysera-transfers-client

Provides methods to manipulate Transfers API. It automatically authenticates all requests and maps required data structure for you.

Usage

This library provides ClientFactory class, which you should use to get the API client itself:

use Paysera\Client\TransfersClient\ClientFactory;

$clientFactory = ClientFactory::create([
    'base_url' => 'https://wallet.paysera.com/transfer/rest/v1', // optional, in case you need a custom one.
    'basic' => [                                        // use this, it API requires Basic authentication.
        'username' => 'username',
        'password' => 'password',
    ],
    'oauth' => [                                        // use this, it API requires OAuth v2 authentication.
        'token' => [
            'access_token' => 'my-access-token',
            'refresh_token' => 'my-refresh-token',
        ],
    ],
    // other configuration options, if needed
]);

$transfersClient = $clientFactory->getTransfersClient();

Please use only one authentication mechanism, provided by Paysera.

Now, that you have instance of TransfersClient, you can use following methods

Methods

It reserves funds for transfer and makes it "reserved". It's enough for transfer to be processed. If there are not enough funds, any limits are reached etc., transfer will be still "new" and no action will take place. Returns error if no funds available.

use Paysera\Client\TransfersClientEntity as Entities;

$transferRegistrationParameters = new Entities\TransferRegistrationParameters();

$transferRegistrationParameters->setConvertCurrency($convertCurrency);
$transferRegistrationParameters->setUserIp($userIp);
    
$result = $transfersClient->reserveTransfer($id, $transferRegistrationParameters);

Provide password for transfer with status waiting_password. If operation is successful, transfer status becomes done. Available only for internal transfers. Returns error if password provided is invalid.

use Paysera\Client\TransfersClientEntity as Entities;

$transferPassword = new Entities\TransferPassword();

$transferPassword->setValue($value);
    
$result = $transfersClient->provideTransferPassword($id, $transferPassword);

Make transfer visible in frontend for signing. If currency convert operations are related to transfer, they are done when transfer becomes reserved. If there are expectations in currency convert requests, transfer becomes failed together with related conversion request(s) if those expectations fails. This only makes transfer "reserved", so it's visible in our Web UI for signing

use Paysera\Client\TransfersClientEntity as Entities;

$transferRegistrationParameters = new Entities\TransferRegistrationParameters();

$transferRegistrationParameters->setConvertCurrency($convertCurrency);
$transferRegistrationParameters->setUserIp($userIp);
    
$result = $transfersClient->registerTransfer($id, $transferRegistrationParameters);

Signs the transfer

use Paysera\Client\TransfersClientEntity as Entities;

$transferRegistrationParameters = new Entities\TransferRegistrationParameters();

$transferRegistrationParameters->setConvertCurrency($convertCurrency);
$transferRegistrationParameters->setUserIp($userIp);
    
$result = $transfersClient->signTransfer($id, $transferRegistrationParameters);

Get transfer.


$result = $transfersClient->getTransfer($id);

Revoke transfer.


$result = $transfersClient->deleteTransfer($id);

Create transfer in the system. Created transfer is invisible and will be deleted if no more actions are performed.

use Paysera\Client\TransfersClientEntity as Entities;

$transferInput = new Entities\TransferInput();

$transferInput->setAmount($amount);
$transferInput->setBeneficiary($beneficiary);
$transferInput->setPayer($payer);
$transferInput->setFinalBeneficiary($finalBeneficiary);
$transferInput->setPerformAt($performAt);
$transferInput->setChargeType($chargeType);
$transferInput->setUrgency($urgency);
$transferInput->setNotifications($notifications);
$transferInput->setPurpose($purpose);
$transferInput->setPassword($password);
$transferInput->setCancelable($cancelable);
$transferInput->setAutoCurrencyConvert($autoCurrencyConvert);
$transferInput->setAutoChargeRelatedCard($autoChargeRelatedCard);
$transferInput->setAutoProcessToDone($autoProcessToDone);
$transferInput->setReserveUntil($reserveUntil);
$transferInput->setCallback($callback);
    
$result = $transfersClient->createTransfer($transferInput);

Get list of transfers by filter

use Paysera\Client\TransfersClientEntity as Entities;

$transfersFilter = new Entities\TransfersFilter();

$transfersFilter->setCreatedDateFrom($createdDateFrom);
$transfersFilter->setCreatedDateTo($createdDateTo);
$transfersFilter->setCreditAccountNumber($creditAccountNumber);
$transfersFilter->setDebitAccountNumber($debitAccountNumber);
$transfersFilter->setStatuses($statuses);
    
$result = $transfersClient->getTransfers($transfersFilter);