# On Ramps and Off Ramps

You can easily pull liquidity or make withdrawals between Orangepill platform and external ramps, wallets and exchanges using Ramp REST API interface.

{% hint style="info" %}
You must have account on target ramps.
{% endhint %}

## Ramp methods

### Set authentication data

To use Ramps you must first set authentication data for identity.

{% hint style="info" %}
Consult [Supported ramps](#supported-ramps) table to understand which parameters are required to authenticate against specific ramp.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Store authetication data for ramp Buda'
</strong>
curl --location --request POST 'https://api.orangepill.cloud/v1/ramps' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "ramp": "buda",    
    "identity": "639675ab191e9023f356dfa6",
    "authentication": {
        "api_key": "YOUR_API_KEY",
        "secret": "YOUR_SECRET
    },
    "data": {
        "description": "Authentication data for Buda"
    }
}'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get new authentication object.

```json
{
    "id": "641a224c56c6fc279151d008",
    "ramp": "buda",    
    "identity": "639675ab191e9023f356dfa6",
    "authentication": {
        "api_key": "YOUR_API_KEY",
        "secret": "YOUR_SECRET"
    },
    "data": {
        "description": "Authentication data for Buda"
    }
}

```

### Supported countries

Use this method to retrieve list of supported countries for this ramp.

{% hint style="info" %}
Identity country must be on this list to be able to interact with a ramp.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Get supported countries for ramp Buda'
</strong>
curl --location --request GET 'https://api.orangepill.cloud/v1/ramps/buda/countries' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' 
</code></pre>

{% endtab %}
{% endtabs %}

In response we get array of supported countries.

```json
[
    "AR",
    "CL",
    "CO",
    "PE"
]
```

### Supported assets

Use this method to retrieve list of supported assets for this ramp.

{% hint style="info" %}
Account must be on this list to be able to interact with a ramp.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Get supported assets for ramp Buda'
</strong>
curl --location --request GET 'https://api.orangepill.cloud/v1/ramps/buda/assets' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' 
</code></pre>

{% endtab %}
{% endtabs %}

In response we get array of supported countries.

```json
[
    "BTC",
    "ETH",
    "LTC",
    "BCH",
    "USDC"
]
```

### Deposit from ramp

To get liquidity from Ramp you must provide Orangepll account where you want receive deposit.

{% hint style="info" %}
Account where you want to receive deposit must be of type `ramp`.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Initiate deposit from ramp Buda'
</strong>
curl --location --request POST 'https://api.orangepill.cloud/v1/ramps/buda/deposit' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "account": "639675ab191e9023f356dfa6",    
    "asset": "BTC",
    "amount": 0.3,
    "data": {
        "description": "Deposit from ramp Buda"
    }
}'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get result of operation.

```json
{
    "id": "641a224c56c6fc279151d008",
    "reference": "REFERENCE_TO_RAMP_OPERATION",
    "status": "PROCESSING",
    "error": null
}
```

### Withdrawal to ramp

To withdraw amount to Ramp you must provide Orangepll account.

{% hint style="info" %}
Account from which you want to withdraw must be of type `ramp`.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Initiate withdrawal to ramp Buda'
</strong>
curl --location --request POST 'https://api.orangepill.cloud/v1/ramps/buda/withdrawal' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "account": "639675ab191e9023f356dfa6",    
    "asset": "BTC",
    "amount": 0.3,
    "data": {
        "description": "Withdrawal to ramp Buda"
    }
}'
</code></pre>

{% endtab %}
{% endtabs %}

In response you will get processing withdrawal.

```json
{
    "id": "634b56217f6a7b0be52dffac",
    "source": {
        "account": "639675ab191e9023f356dfa6",
        "ramp": "639675ab191e9023f356dfa6",
        "address": "637176640b45bd060bdced17"
    },
    "destination": {
        "address": "bc1qxyvqcwepfwsxstemz626uc73n0w6nxh3swgh68"
    },
    "asset": "BTC",
    "value": 0.3,
    "fee": {
        "paid_by": "receiver",
        "speed": "fast",
        "value": 0.0005
    },
    "data": {
        "my_field_1": "Salary 11/2022",
        "my_field_2": "I1234",        
    },
    "amount": 0.295,
    "status": "PROCESSING",
    "created_at": "1519211809934",
    "error": null
}
```

## Supported ramps

| Ramp     | URL parameter | Authentication                                                  |
| -------- | ------------- | --------------------------------------------------------------- |
| Buda.com | buda          | <p>api\_key: "YOUR\_API\_KEY",</p><p>secret: "YOUR\_SECRET"</p> |
