Currency Conversion
To make currency conversions in user's account, convert_currency
scope is needed. As this is
extended scope, sending of SMS message with code in one of supported ways needs to initiated. After this code
is provided to the client, it should be sent with token refresh request to extend current token scope with
convert_currency
.
Calculating currency conversion result
This request allows to calculate probable result of currency conversion. As the rates can change in time, the result is not guaranteed to be valid when actual conversion takes place.
Calculation request
GET https://wallet.paysera.com/rest/v1/currency-conversion
Parameters
Parameters are passed in the query string.
from_currency
to_currency
from_amount
to_amount
or to_amount_decimal
is not provided.
unavailable if to_amount
or to_amount_decimal
is provided
from_amount_decimal
to_amount
or to_amount_decimal
is not provided.
unavailable if to_amount
or to_amount_decimal
is provided
to_amount
from_amount
or from_amount_decimal
is not provided.
unavailable if from_amount
or from_amount_decimal
is provided
to_amount_decimal
from_amount
or from_amount_decimal
is not provided.
unavailable if from_amount
or from_amount_decimal
is provided
account_number
Response data structure
from_currency
to_currency
from_amount
from_amount_decimal
to_amount
to_amount_decimal
account_number
Example requests
GET /rest/v1/currency-conversion?from_currency=EUR&to_currency=USD&to_amount=200 HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="TjBTboV3iZkrUvu6wHxXeflNF0INZ8TZmzK/G8Utj4E="
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="
Example 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" }
Converting currency
Currency conversion request
POST https://wallet.paysera.com/rest/v1/currency-conversion
Parameters
from_currency
to_currency
from_amount
to_amount
or to_amount_decimal
is not provided.
unavailable if
to_amount
or to_amount_decimal
is provided
from_amount_decimal
to_amount
or to_amount_decimal
is not provided.
unavailable if
to_amount
or to_amount_decimal
is provided
to_amount
from_amount
or from_amount_decimal
is not provided.
unavailable if
from_amount
or from_amount_decimal
is provided
to_amount_decimal
from_amount
or from_amount_decimal
is not provided.
unavailable if
from_amount
or from_amount_decimal
is provided
account_number
max_from_amount
from_amount
or from_amount_decimal
provided
max_from_amount_decimal
from_amount
or from_amount_decimal
provided
min_to_amount
to_amount
to_amount_decimal
provided
min_to_amount_decimal
to_amount
to_amount_decimal
provided
Response data structure
id
date
from_currency
to_currency
from_amount
from_amount_decimal
to_amount
to_amount_decimal
account_number
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" }