# Retrieve Exchange Rate

## Retrieve Exchange Rate

<mark style="color:green;">`POST`</mark> `https://sandbox.transfersmile.com/api/payout/exchange-rate`

This endpoint allows you to retrieve the exchange rate.

#### Headers

| Name                                            | Type   | Description                                                 |
| ----------------------------------------------- | ------ | ----------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; charset=UTF-8                             |
| AppId<mark style="color:red;">\*</mark>         | string | Get AppId from dashboard                                    |
| Authorization<mark style="color:red;">\*</mark> | string | signature, generated by SHA256($sorted\_params + $app\_key) |

#### Request Body

| Name              | Type    | Description                                              |
| ----------------- | ------- | -------------------------------------------------------- |
| method            | string  | <p>Method<br>- Fixed value: QRCODE -</p>                 |
| source\_currency  | string  | <p>Merchant Account Currency<br>- Fixed value: USD -</p> |
| arrival\_currency | string  | <p>Beneficiary Currency<br>- Fixed value: BRL -</p>      |
| timestamp         | Integer | unix timestamp, e.g. 1628512575                          |

{% tabs %}
{% tab title="200 success " %}

```
{
  "code": 200,
  "msg": "success",
  "time": 1642076131,
  "data": {
    "source_currency": "USD",
    "arrival_currency": "BRL",
    "exchange_rate": "6.987234",
    "exchange_rate_id": "ERxxxxxxxxxx",
    "expired_at": 1642076131
  }
}
```

{% endtab %}

{% tab title="500 system error" %}

```
{
    "code": 500,
    "msg": "system error",
    "time": 1628497751,
    "data": {
        "error": "system error"
    }
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://sandbox.transfersmile.com/api/payout/exchange-rate' \
--header 'AppId: 94FAC**********************68548' \
--header 'Authorization: d6181db0d6548b94b162e75d095b59147172d914699f83b2bd17951a671b6302' \
--header 'Content-Type: application/json' \
--data-raw '{
    "method": "QRCODE",
    "source_currency": "USD", // fixed value: USD
    "arrival_currency": "BRL", // fixed value: BRL
    "timeStamp": "1733992186"
}'
```

{% hint style="info" %}
Note:  ***94FAC\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*68548*** is pagsmile's test merchant id for sandbox, and ***d6181db0d6548b94b162e75d095b59147172d914699f83b2bd17951a671b6302*** is authorization token associated with the test App ID.
{% endhint %}
