Convert currency
POST https://wallet.paysera.com/rest/v1/currency-conversion
Execute currency conversion in user's account.
Example: Convert EUR to 2.00 USD if price is no bigger than 1.50 EUR
Authorization​
This endpoint requires MAC (Message Authentication Code) authentication.
Authorization Header Format:
Authorization: MAC id="CLIENT_ID", ts="TIMESTAMP", nonce="RANDOM_STRING", mac="MAC_HASH", ext="body_hash=BODY_HASH"
Example:
Authorization: MAC id="a9b8c7d6e5f4g3h2", ts="1234567890", nonce="xyz123abc456def", mac="dGhpcyBpcyBhIHJhbmRvbSBtYWMgaGFzaCB2YWx1ZQ==", ext="body_hash=cmFuZG9tQm9keUhhc2hWYWx1ZQ%3D%3D"
For more details, see the Authentication section.
Request Body​
| Field | Type | Required | Description |
|---|---|---|---|
from_currency | string | ✓ | Source currency code |
to_currency | string | ✓ | Target currency code |
from_amount | integer | Amount to convert (in cents) | |
from_amount_decimal | string | Decimal amount to convert | |
to_amount | integer | Target amount (in cents) | |
to_amount_decimal | string | Target decimal amount | |
account_number | string | ✓ | Account number for conversion |
max_from_amount | integer | Maximum source amount in cents | |
max_from_amount_decimal | string | Maximum source decimal amount | |
min_to_amount | integer | Minimum target amount in cents | |
min_to_amount_decimal | string | Minimum target decimal amount |
Example​
Request​
POST https://wallet.paysera.com/rest/v1/currency-conversion
Content-Type: application/json
Authorization: MAC id="CLIENT_ID", ts="TIMESTAMP", nonce="RANDOM_STRING", mac="MAC_HASH", ext="body_hash=BODY_HASH"
{
"from_currency": "EUR",
"to_currency": "USD",
"to_amount": 200,
"account_number": "EVP0010001000101",
"max_from_amount": 150
}
Response​
{
"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"
}
AUTHORIZATION: HTTP
REQUEST
Base URL
https://wallet.paysera.com
Body REQUIRED
{
"from_currency": "EUR",
"to_currency": "USD",
"to_amount": 200,
"account_number": "EVP0010001000101",
"max_from_amount": 150
}
RESPONSE
Conversion successful
{
"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"
}