Converting funds to supported currency
Integrating Currency Conversion
Paysera offers a secure API that lets you make currency conversions inside Paysera account.
Step 1. Calculation request (optional)
How to calculate a currency conversion rate using the Paysera API, without actually performing the conversion transaction.
GET https://wallet.paysera.com/rest/v1/currency-conversion
Parameters
Parameters are passed in the query string.
More about available parameters can be found in here: Currency Conversion.
Example requests
GET /rest/v1/currency-conversion?from_currency=EUR&to_currency=USD&from_amount=150 HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="KwCRgR3O9cWGni/fkUPjVBLfl5cCURgLHIc7yppjFHw="
convert_currency
scope authorizedExample response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "from_currency": "EUR", "to_currency": "USD", "from_amount": 150, "from_amount_decimal": "1.50", "to_amount": 200, "to_amount_decimal": "2.00" }
Step 2. Converting currency
This step handles exchanging your funds from one currency to another.
Currency conversion request
POST https://wallet.paysera.com/rest/v1/currency-conversion
Error codes
not_found
- account was not found by given ID
no_rights
- user has no needed permissions to execute currency conversions in this account
not_enough_funds
- there is not enough funds to perform this operation
limits_exceeded
- currency conversion limits were exceeded
expectation_failed
- conversion price or result did not match expectations (provided by max_from_amount
or min_to_amount
parameters)
Example request
POST /rest/v1/currency-conversion 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="+ZVwDWDVqqhjTeA5t6cW4ZtgcXI9ikDH3oKzzWEHDfI=", ext="body_hash=%2FnvaEOVnCNABstYnlN4pVfw3f6FElVlYw5CNvgYzBls%3D"
{ "from_currency": "EUR", "to_currency": "USD", "to_amount": 200, "account_number": "EVP0010001000101", "max_from_amount": 150 }
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": 11221, "date": 1391686980, "from_currency": "EUR", "to_currency": "USD", "from_amount": 150, "from_amount_decimal": "1.50", "to_amount": 200, "to_amount_decimal": "2.00", "account_number": "EVP0010001000101" }