PHP code example of paysera / lib-wallet-transfer-rest-client

1. Go to this page and download the library: Download paysera/lib-wallet-transfer-rest-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

paysera / lib-wallet-transfer-rest-client example snippets


use Paysera\Client\TransfersClient\ClientFactory;

$clientFactory = new ClientFactory([
    'base_url' => 'https://wallet.paysera.com/transfer/rest/v1/', // optional, in case you need a custom one.
    'basic' => [                                        // use this, it API sh_token' => 'my-refresh-token',
        ],
    ],
    // other configuration options, if needed
]);

$transfersClient = $clientFactory->getTransfersClient();

use Paysera\Client\TransfersClient\Entity as Entities;

$transferRegistrationParameters = new Entities\TransferRegistrationParameters();

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

use Paysera\Client\TransfersClient\Entity as Entities;

$transferPassword = new Entities\TransferPassword();

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

use Paysera\Client\TransfersClient\Entity as Entities;

$transferRegistrationParameters = new Entities\TransferRegistrationParameters();

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

use Paysera\Client\TransfersClient\Entity as Entities;

$transferRegistrationParameters = new Entities\TransferRegistrationParameters();

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


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


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

use Paysera\Client\TransfersClient\Entity 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);

use Paysera\Client\TransfersClient\Entity 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);