# Swap

{% hint style="info" %}
**You must have the Authorization to use this API**
{% endhint %}

## Swap

<mark style="color:green;">`POST`</mark> `{{baseUrl}}/wp-json/rimplenet-wallet-addon/v1/swap`

#### Request Body

| Name                                           | Type   | Description                               |
| ---------------------------------------------- | ------ | ----------------------------------------- |
| request\_id <mark style="color:red;">\*</mark> | String | Enter the request id                      |
| amount <mark style="color:red;">\*</mark>      | int    | Enter the amount                          |
| user\_id<mark style="color:red;">\*</mark>     | String | This is the unique identifier of the user |
| wallet\_from<mark style="color:red;">\*</mark> | String | Sender's wallet address                   |
| wallet\_to  <mark style="color:red;">\*</mark> | String | Reciever's wallet address                 |
| deductions<mark style="color:red;">\*</mark>   | String | Amount deducted                           |

{% tabs %}
{% tab title="200: OK Swap successful" %}

```json
{
    "status_code": 200,
    "status": true,
    "message": "Swap Successful",
    "data": {
        "swap_user_id": 1,
        "swap_from_request_id": "swap_debit_12",
        "swap_from_transaction_id": 264,
        "swap_from_amount": 5,
        "swap_from_wallet_id": "usd",
        "swap_to_request_id": "swap_credit_12",
        "swap_to_transaction_id": 265,
        "swap_to_amount": 5,
        "swap_to_wallet_id": "ngn"
    },
    "submitted": {
        "request_id": "12",
        "user_id": "1",
        "amount_to_convert": "5",
        "wallet_from": "usd",
        "wallet_to": "ngn",
        "note": ""
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
To view request params, click on the arrow (>) at the right-hand side of the endpoint URL to expand or collapse
{% endhint %}

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

```json
{
    "status_code": 200,
    "status": true,
    "message": "Swap Successful",
    "data": {
        "swap_user_id": 1,
        "swap_from_request_id": "swap_debit_12",
        "swap_from_transaction_id": 264,
        "swap_from_amount": 5,
        "swap_from_wallet_id": "usd",
        "swap_to_request_id": "swap_credit_12",
        "swap_to_transaction_id": 265,
        "swap_to_amount": 5,
        "swap_to_wallet_id": "ngn"
    },
    "submitted": {
        "request_id": "12",
        "user_id": "1",
        "amount_to_convert": "5",
        "wallet_from": "usd",
        "wallet_to": "ngn",
        "note": ""
    }
}
```

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}
