Send transfers to multiple accounts
Transfer API allows initiating transfers between your Paysera account and either Paysera or another bank account. API allows creating manual Transfers just like in regular Paysera system. It's possible to fully automate the process, so the transfer will be created and signed by your system using API, your system would be able to track the status of initiated transfers. In Transfer API, you can distribute transfers by making several different transfers for multiple people.
Integration
If you need to send payments to multiple accounts at once, we strongly recommend that you use Wallet API. However if you're unable to use Wallet API, we provide a workaround via the Transfer API. The example below is a workaround and not a perfect solution to this problem.
You can distribute transfers in Transfer API by following these steps:
- Get the amount of the transfer that you want to distribute
- Create transfer
- Sign transfer
You need to repeat steps 2 and 3 for each individual beneficiary you wish to transfer money to. You will find an example of the code below.
1. Get transfer
With a library
<?php use PayseraClientTransfersClientClientFactory; use PayseraClientTransfersClientEntity as Entities; $clientFactory = new ClientFactory([ 'base_url' => 'https://wallet.paysera.com/transfer/rest/v1/', 'mac' => [ 'mac_id' => 'mac_id', 'mac_secret' => 'mac_password', ], ]); $transfersClient = $clientFactory→getTransfersClient(); $transfer = $transfersClient->getTransfer($id);
With the specification
GET https://wallet.paysera.com/transfer/rest/v1/transfers/:id
Example request
GET /transfer/rest/v1/transfers/123 HTTP/1.1 Host: wallet.paysera.com Content-Type: application/json;charset=utf-8 User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="2VFTILV6mZSTG3mWYle+ApoQ4waD+zkfpBpaDYW9H2A=", ext="body_hash=9ozRxTTJmNuImN2RrqNNWrWAf39A2RmbriKeuDSPy2I%3D"
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": "123", "status": "new", "amount": { "amount": "100.00", "currency": "EUR" }, "beneficiary": { "type": "bank", "name": "Name Surname", "bank_account": { "iban": "LT873500010002284563" }, "additional_information": { "type": "natural", "city": "New York", "state": "NY", "country": "US", "postal_code": "11235", "bank_branch_code": "US46516" }, "client_identifier": { "date_and_place_of_birth": { "date_of_birth": "1986-11-08", "city_of_birth": "Vilnius", "country_of_birth": "LT" } } }, "payer": { "account_number": "EVP9210002477825" }, "purpose": { "details": "Transfer details that will be seen in beneficiary statement", "details_options": { "preserve": false } }, "cancelable": true, "allowed_to_cancel": true, "initiator": { "user_id": 321 }, "created_at": 1489420006, "perform_at": 1489420006, "auto_currency_convert": false, "auto_charge_related_card": false, "out_commission": { "amount": "0.29", "currency": "EUR" }, "additional_information": { "estimated_processing_date": 1489420906, "out_commission_rule": { "percent": 0, "fix": { "amount": "0.29", "currency": "EUR" } }, "original_out_commission": { "amount": "0.29", "currency": "EUR" }, "correspondent_bank_fees_may_apply": false } }
2. Create transfer
With a library
<?php use PayseraClientTransfersClientClientFactory; use PayseraClientTransfersClientEntity as Entities; $clientFactory = new ClientFactory([ 'base_url' => 'https://wallet.paysera.com/transfer/rest/v1/', 'mac' => [ 'mac_id' => 'mac_id', 'mac_secret' => 'mac_password', ], ]); $transfersClient = $clientFactory->getTransfersClient(); $transferInput = (new EntitiesTransferInput()) ->setAmount($amount) ->setBeneficiary($beneficiary) ->setPayer($payer) ->setFinalBeneficiary($finalBeneficiary) ->setPerformAt($performAt) ->setChargeType($chargeType) ->setUrgency($urgency) ->setNotifications($notifications) ->setPurpose($purpose) ->setPassword($password) ->setCancelable($cancelable) ->setAutoCurrencyConvert($autoCurrencyConvert) ->setAutoChargeRelatedCard($autoChargeRelatedCard) ->setAutoProcessToDone($autoProcessToDone) ->setReserveUntil($reserveUntil) ->setCallback($callback) ; $result = $transfersClient->createTransfer($transferInput);
With the specification
POST https://wallet.paysera.com/transfer/rest/v1/transfers
Example request
POST /transfer/rest/v1/transfers HTTP/1.1 Host: wallet.paysera.com Content-Type: application/json;charset=utf-8 User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="2VFTILV6mZSTG3mWYle+ApoQ4waD+zkfpBpaDYW9H2A=", ext="body_hash=9ozRxTTJmNuImN2RrqNNWrWAf39A2RmbriKeuDSPy2I%3D"
{ "amount": { "amount": "100.00", "currency": "EUR" }, "beneficiary": { "type": "bank", "name": "Name Surname", "bank_account": { "iban": "LT873500010002284563" }, "additional_information": { "type": "natural", "city": "New York", "state": "NY", "country": "US", "postal_code": "11235", "bank_branch_code": "US46516" }, "client_identifier": { "date_and_place_of_birth": { "date_of_birth": "1986-11-08", "city_of_birth": "Vilnius", "country_of_birth": "LT" } } }, "payer": { "account_number": "EVP9210002477825" }, "urgency": "standard", "purpose": { "details": "Transfer details that will be seen in beneficiary statement" } }
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": "123", "status": "new", "amount": { "amount": "100.00", "currency": "EUR" }, "beneficiary": { "type": "bank", "name": "Name Surname", "bank_account": { "iban": "LT873500010002284563" }, "additional_information": { "type": "natural", "city": "New York", "state": "NY", "country": "US", "postal_code": "11235", "bank_branch_code": "US46516" }, "client_identifier": { "date_and_place_of_birth": { "date_of_birth": "1986-11-08", "city_of_birth": "Vilnius", "country_of_birth": "LT" } } }, "payer": { "account_number": "EVP9210002477825" }, "purpose": { "details": "Transfer details that will be seen in beneficiary statement", "details_options": { "preserve": false } }, "cancelable": true, "allowed_to_cancel": true, "initiator": { "user_id": 321 }, "created_at": 1489420006, "perform_at": 1489420006, "auto_currency_convert": false, "auto_charge_related_card": false, "out_commission": { "amount": "0.29", "currency": "EUR" }, "additional_information": { "estimated_processing_date": 1489420906, "out_commission_rule": { "percent": 0, "fix": { "amount": "0.29", "currency": "EUR" } }, "original_out_commission": { "amount": "0.29", "currency": "EUR" }, "correspondent_bank_fees_may_apply": false } }
3. Sign transfer
With a library
<?php use PayseraClientTransfersClientClientFactory; use PayseraClientTransfersClientEntity as Entities; $clientFactory = new ClientFactory([ 'base_url' => 'https://wallet.paysera.com/transfer/rest/v1/', 'mac' => [ 'mac_id' => 'mac_id', 'mac_secret' => 'mac_password', ], ]); $transferRegistrationParameters = (new EntitiesTransferRegistrationParameters()) ->setConvertCurrency($convertCurrency) ->setUserIp($userIp) ; $result = $transfersClient->signTransfer($id, $transferRegistrationParameters);
With the specification
PUT https://wallet.paysera.com/transfer/rest/v1/transfers/{id}/sign
Example request
PUT /rest/v1/transfers/123/sign HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="8ZAMWhc6f0jmkgcPo+cyzPWHmEEK9pLvK1FQ4axlV3U="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": "123", "status": "new", "amount": { "amount": "100.00", "currency": "EUR" }, "beneficiary": { "type": "bank", "name": "Name Surname", "bank_account": { "iban": "LT873500010002284563" }, "additional_information": { "type": "natural", "city": "New York", "state": "NY", "country": "US", "postal_code": "11235", "bank_branch_code": "US46516" }, "client_identifier": { "date_and_place_of_birth": { "date_of_birth": "1986-11-08", "city_of_birth": "Vilnius", "country_of_birth": "LT" } } }, "payer": { "account_number": "EVP9210002477825" }, "purpose": { "details": "Transfer details that will be seen in beneficiary statement", "details_options": { "preserve": false } }, "cancelable": true, "allowed_to_cancel": true, "initiator": { "user_id": 321 }, "created_at": 1489420006, "perform_at": 1489420006, "auto_currency_convert": false, "auto_charge_related_card": false, "out_commission": { "amount": "0.29", "currency": "EUR" }, "additional_information": { "estimated_processing_date": 1489420906, "out_commission_rule": { "percent": 0, "fix": { "amount": "0.29", "currency": "EUR" } }, "original_out_commission": { "amount": "0.29", "currency": "EUR" }, "correspondent_bank_fees_may_apply": false } }