# Introduction

Welcome to LocalRamp API documentation

### How do I get access?

To get access, [create](https://merchant.localramp.co/auth/signup) a LocalRamp merchant account and our business team will contact you within 24 hrs.&#x20;

### What can I do with the API?

* [**Fiat on-ramp**](/crypto-on-ramp/overview) - Enable your users to instantly buy over **120+** cryptocurrencies with local payments in fiats such as **NGN**, **GHS**, **KES, XOF, XAF, RWF,** and **ZMW**.
* [**Crypto off-ramp**](/crypto-off-ramp/overview) - Payout your cryptocurrencies to fiats such as  **NGN**, **GHS**, **KES**, **XOF**, **XAF**, **UGX**, and **ZMW**.
* [**Crypto swaps**](/crypto-swaps/overview) - Swap over **250** cryptocurrency pairs
* [**Payments onramp**](/payments-on-ramp/overview) - Accept fiat payments like **NGN**, **GHS**, **KES, XOF, XAF, RWF** and **ZMW** with *instant* crypto payout.


# Getting Started

Welcome to the LocalRamp API documentation

LocalRamp authenticates your API requests using your account’s API *secret key* and *public key*

Your **Secret Key** should be kept **confidential** and only stored on your own servers. Your account’s secret API key performs sensitive API requests and as such should NEVER be exposed.

Your **Public Key** on the other hand can be published. This key can be used for collections (Pay-ins) and other misc API calls. This key **cannot** be used for payouts and swaps.

## Obtaining your API keys

To get your API keys, go to the [API settings](https://merchant.localramp.co/dashboard/settings/api) section of your dashboard and copy the keys.

## Authentication

Authenticate your API calls by adding a `x-auth-token` header with your secret key or public key for every request you make.

```
x-auth-token: <SECRET_KEY|PUBLIC_KEY>
```


# Overview

Accept fiat, receive crypto

Enable your users to instantly buy over **120+** cryptocurrencies with local payment methods in **NGN**, **GHS**, **KES, XOF, XAF,** and **ZMW**.

We support local payment methods like bank transfers and mobile money which are cheaper and more reliable than card payments.

There are two ways your users can securely buy crypto with LocalRamp.

* [**Widget Pop-up**](/crypto-on-ramp/widget-pop-up)
* [**Full-page checkout**](/crypto-on-ramp/full-page-checkout)

{% hint style="info" %}
You can check out our [**payments product**](/payments-on-ramp/overview) if you are just interested in collecting payments from your users.
{% endhint %}


# Widget Pop-up

Crypto on-ramp on your website

The widget product allows you to on-ramp your users without them leaving your website/app by just initiating a pop-up.

### 1. Get your public key

Get your [public key](https://merchant.localramp.co/dashboard/settings/api) from your dashboard

### 2. Add the pay-ins/collections script

{% code lineNumbers="true" %}

```html
<form>
    <script src="https://cdn.localramp.co/onramp-inline.js"></script>
    <button type="button" onclick="payWithLocalRamp()"> Pay </button>
</form>
```

{% endcode %}

```html
<script>
    function payWithLocalRamp() {
        window.LocalRampBuy.initialize({
            public_key: "pk_live_*********************",
            reference: "your-unique-reference",
            sender_amount: "22000.00", 
            sender_currency: "NGN",
            country_code: "NG",
            receiver_currency: "USDT_TRX",
            email: "richard@piedpiper.com",
            destination_address:"THS6HKWEFrwH9Gpzxkvm43L9D8TaLSXZ8z"
            widget_color: "#DA70D6",
            onClose: function (ref) {
              // Handle when the modal is closed
            },
        });
    }
</script>
```

{% hint style="danger" %}
Avoid exposing your ***secret key*** on the client side (or front end) of your application. Requests to LocalRamp's API should be initiated from your server.
{% endhint %}

<table><thead><tr><th width="201">Field</th><th width="110">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - Your unique transaction reference. <em>Must be unique for every transaction</em>. e.g "Abc123"</td></tr><tr><td>email</td><td>String</td><td><strong>Optional</strong> e.g "customer@example.com"</td></tr><tr><td>sender_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The currency your user would be paying in. It becomes required only if <code>sender_amount</code> or <code>receiver_amount</code> is provided. e.g "NGN"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The country_code of the user paying in. It becomes required only if <code>sender_currency</code>is provided. e.g "NG", "KE", "GH", "ZM"</td></tr><tr><td>receiver_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The cryptocurrency that would be received. It becomes required only if <code>sender_amount</code> , <code>receiver_amount</code> or <code>destination_address</code> is provided. e.g "USDT_BSC"</td></tr><tr><td>sender_amount</td><td>String</td><td><strong>Optional</strong> - amount your user would be paying in <code>sender_currency</code> unit. e.g "20000.00". If this is present, then <code>receiver_amount</code> should be omitted</td></tr><tr><td>receiver_amount</td><td>String</td><td><strong>Optional</strong> - crypto amount that should be received in <code>receiver_currency</code> unit. e.g "0.78728772". If this is present, then <code>sender_amount</code> should be omitted</td></tr><tr><td>destination_address</td><td>String</td><td><strong>Optional</strong> - crypto address where payments will be sent to. e.g "0xC637255611b0A70259722c35D419077Da4cACcfF"</td></tr><tr><td>destination_tag</td><td>String</td><td><strong>Optionally required</strong> - For coins that require a memo or tag. It is only required if address provided supports tags/memos e.g "3239783255"</td></tr><tr><td>payment_method</td><td>String</td><td><strong>Optional</strong> - Specify a particular <a href="/pages/Ls31XLC8JOLWxUU8Mhnr">payment method</a><br>e.g instant_p2p</td></tr><tr><td>widget_color</td><td>String</td><td><strong>Optional</strong> - Hex color code to customize widget e.g "#DA70D6"</td></tr><tr><td>onClose</td><td>[Function]</td><td><strong>Optional</strong> - Gets called whenever the user closes the modal. This could be as a result of the transaction being completed or abandoned.</td></tr></tbody></table>

{% hint style="info" %}
You can pass either the `sender_amount` or `receiver_amount` when initializing the widget but **not** both.
{% endhint %}

{% hint style="info" %}
Before passing in either the `sender_amount` or `receiver_amount`, you'll need to know the **maximum** and **minimum** values allowed for each field. See [limit section](/crypto-on-ramp/get-limits).
{% endhint %}

{% hint style="info" %}
To get the list of supported currencies and country codes for both `sender_currency` and `receiver_currency` see the [Get currencies section](/crypto-on-ramp/get-supported-currencies)
{% endhint %}

{% hint style="warning" %}
**`sender_amount`** and **`receiver_amount`** show payment intent and does not guarantee the exact value that would be received at the end of the transaction. To see the exact amounts received, [get transaction state](/crypto-on-ramp/get-transaction-state).
{% endhint %}

### 3. Verifying the transaction status

Once the modal is closed, the onClose function is called with the transaction reference

```javascript
onClose(reference)
```

This is the same reference used in initializing the widget which can now be used to verify the transaction. See [verify section](/crypto-on-ramp/get-transaction-state)

### 4. Receive confirmation via webhook

In some cases, the crypto might take a few minutes to arrive. If you do not want to keep querying the transaction status, you can always get informed when the transaction is complete through webhooks. See  [webhook section](/webhooks/introduction).


# Full-page checkout

Hosted pages

This allows you to redirect your users to a separate fiat on-ramp checkout page.

With the Checkout Redirect option, you can access the LocalRamp payment gateway by making a request from your server to our [initiate buy endpoint](#2-initialize-the-transaction). We would return a response that includes a Checkout URL that loads the payment page where your users can purchase crypto. After payment is completed or canceled, the customer is returned to any URL specified by you.

### 1. Collect payment details

Collect payment/purchase details from your user. These details are passed to the [initiate buy endpoint](#2-initialize-the-transaction).

Please find below the request body for the endpoint.

<table><thead><tr><th width="201">Field</th><th width="130">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - Your unique transaction reference. <em>Must be unique for every transaction</em>. e.g "Abc123"</td></tr><tr><td>email</td><td>String</td><td><strong>Optional</strong> e.g "customer@example.com"</td></tr><tr><td>sender_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The currency your user would be paying in. It becomes required only if <code>sender_amount</code> or <code>receiver_amount</code> is provided. e.g "NGN"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The country_code of the user paying in. It becomes required only if <code>sender_currency</code>is provided. e.g "NG", "KE", "GH", "ZM"</td></tr><tr><td>receiver_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The cryptocurrency that would be received. It becomes required only if <code>sender_amount</code> , <code>receiver_amount</code> or <code>destination_address</code> is provided. e.g "USDT_BSC"</td></tr><tr><td>sender_amount</td><td>String</td><td><strong>Optional</strong> - amount your user would be paying in <code>sender_currency</code> unit. e.g "20000.00". If this is present, then <code>receiver_amount</code> should be omitted</td></tr><tr><td>receiver_amount</td><td>String</td><td><strong>Optional</strong> - crypto amount that should be received in <code>receiver_currency</code> unit. e.g "0.78728772". If this is present, then <code>sender_amount</code> should be omitted</td></tr><tr><td>destination_address</td><td>String</td><td><strong>Optional</strong> - crypto address where payments will be sent to. e.g "0xC637255611b0A70259722c35D419077Da4cACcfF"</td></tr><tr><td>destination_tag</td><td>String</td><td><strong>Optionally required</strong> - For coins that require a memo or tag. It is only required if address provided supports tags/memos e.g "3239783255"</td></tr><tr><td>payment_method</td><td>String</td><td><strong>Optional</strong> - Specify a particular <a href="/pages/Ls31XLC8JOLWxUU8Mhnr">payment method</a><br>e.g instant_p2p</td></tr><tr><td>widget_color</td><td>String</td><td><strong>Optional</strong> - Hex color code to customize widget e.g "#DA70D6"</td></tr><tr><td>callback_url</td><td>String</td><td><strong>Optional</strong> - The url to redirect your users to, when the transaction is complete</td></tr></tbody></table>

{% hint style="info" %}
You can pass either the `sender_amount` or `receiver_amount` when initializing the widget but **not** both.
{% endhint %}

{% hint style="info" %}
Before passing in either the `sender_amount` or `receiver_amount`, you'll need to know the **maximum** and **minimum** values allowed for each field. See [limit section](/crypto-on-ramp/get-limits).
{% endhint %}

{% hint style="info" %}
To get the list of supported currencies and country codes for both `sender_currency` and `receiver_currency` see the [Get currencies section](/crypto-on-ramp/get-supported-currencies)
{% endhint %}

{% hint style="warning" %}
**`sender_amount`** and **`receiver_amount`** show payment intent and does not guarantee the exact value that would be received at the end of the transaction. To see the exact amounts received, [get transaction state](/crypto-on-ramp/get-transaction-state).
{% endhint %}

### 2 - Initialize the transaction

After collecting the necessary payment details for the transaction. Make a **POST** request to our initiate buy endpoint.

{% code overflow="wrap" %}

```
https://api.localramp.co/v1/transaction/buy/initiate
```

{% endcode %}

This endpoint takes the [payment details](#1.-collect-payment-details) as the request body.

With the following header

```
x-auth-token: <SECRET_KEY>
```

This endpoint is protected by secret key authentication. So when calling it, append the `x-auth-token` header with your secret key.

If the API call is successful, LocalRamp returns the following response:

```javascript

{
    "status": "success",
    "msg": "Transaction(buy) initiated successfully",
    "data": {
        "reference": "your-unique-reference",
        "checkout_link": "https://checkout.localramp.co/bTYUBjkns"
    }
}

```

You should then redirect your user to the Checkout URL provided in the response to enable them to complete their payment.&#x20;

You can also choose to open the checkout link in an iframe

{% code overflow="wrap" %}

```html
<iframe src="https://checkout.localramp.co/bTYUBjkns" frameborder="0" width="350" height="500" allow="clipboard-read; clipboard-write self *"></iframe>
```

{% endcode %}

Once the purchase is complete or the checkout is closed, LocalRamp will redirect your user to your specified `callback_url`.&#x20;

### 3. Verifying the transaction status

The transaction reference will be appended as a query parameter to your `callback_url` as well.

`https://website_callback_url/?reference=YOUR_REFERENCE`

You can now verify the status of the transaction. See [verify section](/crypto-on-ramp/get-transaction-state)

In a situation where no `callback_url` is passed, the user will be redirected to your business website.&#x20;

### 4. Receive confirmation via webhook

In some cases, the crypto might take a few minutes to arrive. If you do not want to keep querying the transaction status, you can always get informed when the transaction is complete through webhooks. See  [webhook section](/webhooks/introduction).


# Get Limits

Before initializing a buy transaction, you'll need to know the maximum and minimum amounts possible for a currency pair. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/buy/limits?sender_currency=NGN&receiver_currency=USDT_BSC
```

{% endcode %}

The request takes `sender_currency` and `receiver_currency` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "sender_minimum": "8772.39",
        "sender_maximum": "9500000",
        "sender_currency": "NGN",
        "receiver_minimum": "10.19999999",
        "receiver_maximum": "12585.07656919",
        "receiver_currency": "USDT_BSC"
    }
}
```

It returns the minimum and maximum amounts for both sender and receiver currencies.

{% hint style="warning" %}
The Limits are not fixed. They vary based on the currency pair chosen and the price of the token at the time of the request. **Always** fetch the limits before initializing a buy transaction to make sure you're within the current limits.
{% endhint %}


# Get Supported currencies

Before initializing a buy transaction, you'll need to know the available fiat currencies and cryptocurrencies. Make a **GET** request to this endpoint

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/buy/currencies
```

{% endcode %}

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "sender_currency": [
            {
                "fiat": "NGN",
                "name": "Nigeria",
                "max_decimal": 2,
                "country_code": "NG"
            },
            {
                "fiat": "KES",
                "name": "Kenya",
                "max_decimal": 2,
                "country_code": "KE"
            },
            {
                "fiat": "ZMW",
                "name": "Zambia",
                "max_decimal": 2,
                "country_code": "ZM"
            }
        ],
        "receiver_currency": [
            {
                "coin": "NEAR_BSC",
                "name": "NEAR Protocol - BNB Smart Chain (BEP20)",
                "address_regex": "^(0x)[0-9A-Fa-f]{40}$",
                "memo_regex": "",
                "requires_tag": false,
                "max_decimal": 8,
                "integer_multiple": "0.00000001",
                "is_stable": false,
                "estimated_arrival_time": "5"
            },
            {
                "coin": "NEAR_NEAR",
                "name": "NEAR Protocol - NEAR Protocol",
                "address_regex": "^[a-z0-9_-]{1}[a-z0-9_.-]{0,62}[a-z0-9_-]{1}$",
                "memo_regex": "",
                "requires_tag": false,
                "max_decimal": 8,
                "integer_multiple": "0.00000001",
                "is_stable": false,
                "estimated_arrival_time": "20"
            }
        ]
    }
}

```

{% hint style="warning" %}
Note the decimal place for tokens. If a token has a  `max_decimal` value of 8, the API would accept decimal strings between 1 to 8 decimal places e.g "0.1", "2.345", "670.45628394"
{% endhint %}

{% hint style="info" %}
Coins are represented as "coin\_network". USDT on the Tron and Binance smart chain would be represented as "USDT\_TRX" and "USDT\_BSC" respectively.
{% endhint %}


# Get Quote

Before initializing a buy transaction, you might want to know what price the token is being traded at. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/buy/quote?sender_currency=NGN&receiver_currency=USDT_BSC&country_code=NG
```

{% endcode %}

The request takes `sender_currency` ,`receiver_currency` and `country_code` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "rate": {
            "sender_currency": "NGN",
            "receiver_currency": "USDC_BSC",
            "partner_fee": {
                "type": "PERCENT",
                "fee": 0
            },
            "processor_fee": {
                "type": "FLAT",
                "fee": "100.00"
            },
            "network_fee": "1.14510001",
            "exchange_rate": "754.6558",
            "market": "BUY"
        },
        "info": {
            "partner_fee": "Merchant fee in percent",
            "processor_fee": "Fee LocalRamp Charges (NGN)",
            "network_fee": "Fee required to send coin on blockchain (USDC_BSC) ~Estimate",
            "exchange_rate": "Price LocalRamp will buy your crypto at"
        }
    }
}
```

`processor_fee` is what LocalRamp charges in local currency fiat i.e NGN, GHS. It will be deducted from whatever the user sends.

`network_fee` is an estimate of the blockchain network fees. Unit is in `receiver_currency` i.e BTC, USDT

`exchange_rate` is the purchase price of the coin.

`partner_fee` refers to extra fees you might wish to charge your users. This is automatically infused into your rates. Earnings from partner fees are sent straight to your USDT wallet weekly. To set this up, reach out to **<business@localramp.co>**

#### Rate Calculation

To calculate how much you would eventually receive for any sender amount

{% hint style="info" %}
**receiver\_amount** = ((**sender\_amount** - `processor_fee`) / `exchange_rate`) - `network_fee`
{% endhint %}

{% hint style="success" %}
Rates for our on-ramp are **locked**, so you should expect to receive the **exact** amounts (except in rare cases with high volatility of asset)
{% endhint %}


# List Payment Methods

List supported payment method for a particular currency

To get the supported payment method for a currency, make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/buy/payment-methods?currency=KES&country_code=KE
```

{% endcode %}

The request takes `currency`  and `country_code`   as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "payment_methods": [
            {
                "name": "Bank Transfer",
                "id": "instant_p2p",
                "active": true
            }
        ]
    }
}
```

{% hint style="info" %}
In extremely rare cases where a particular payment method might be down, the **`active`** field would be **`false`**
{% endhint %}


# Get Transaction State

After the modal is closed, you should fetch the transaction to know the current status. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/buy/status/:reference
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "reference": "my-unique-ref",
        "state": "completed",
        "txid": "<txID>",
        "received_amount": "0.7382747",
        "receiver_currency": "BTC_BTC",
        "sent_amount": "10000",
        "sender_currency": "NGN",
        "destination_address": "<address>",
        "destination_tag": null,
        "email": "test@example.com",
        "payment_method": "bank_transfer", //mobile_money
        "source_account_bank": "Wallet Bank"
        "phone_network": "MTN",
        "phone_number":"+2340000000",
    }
}
```

The possible `state`'s are <mark style="color:red;">`awaiting_payment`</mark>, <mark style="color:orange;">`pending`</mark> and <mark style="color:green;">`completed`</mark>

**awaiting\_payment** - This means we are yet to receive payment from the customer.

**pending** -  This means we have received payment and we are processing the request

**completed** - This means that the transaction has been completed

{% hint style="info" %} <mark style="color:orange;">`sent_amount`</mark> is the fiat amount sent by the user minus localramp fees.<mark style="color:orange;">`received_amount`</mark> is the amount in crypto sent to the wallet. Note that these are different from the <mark style="color:purple;">`sender_amount`</mark> and <mark style="color:purple;">`receiver_amount`</mark>used in initiating the transaction.
{% endhint %}


# Overview

Our Crypto off-ramp product allows you and your users to instantly sell your crypto for Fiat which gets instantly paid out to bank accounts and mobile money.

There are two ways to offramp with Localramp.

* [**Direct API Sell**](/crypto-off-ramp/direct-api-sell)
* [**Widget Sell**](/crypto-off-ramp/widget-sell)

{% hint style="info" %}
To Offramp with Direct API sell, you would first need to [fund your LocalRamp wallet](https://merchant.localramp.co/dashboard/balances) with the crypto you want to sell.
{% endhint %}


# Direct API Sell

Custodial Sell. You must have a crypto balance in your Localramp wallet to sell crypto with this.


# Instant Sell

You can sell your crypto for fiat which gets instantly paid to bank accounts. To do this, Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/initiate
```

{% endcode %}

Please find below the request body for the endpoint.

<table><thead><tr><th width="201">Field</th><th width="109">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>tx_ext_reference</td><td>String</td><td><strong>Required</strong> - your unique reference for the transaction</td></tr><tr><td>email</td><td>String</td><td><strong>Required</strong> -  e.g "dinesh@piedpiper.xyz"</td></tr><tr><td>from_currency</td><td>String</td><td><strong>Required</strong> -  e.g "BTC"</td></tr><tr><td>to_currency</td><td>String</td><td><strong>Required</strong> e.g "NGN", "GHS"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Required</strong> e.g "NG", "GH"</td></tr><tr><td>from_amount</td><td>String</td><td><strong>Optionally Required</strong> - amount of from_currency to be sold e.g "0.235".<br><br>Required if to_amount is not provided.</td></tr><tr><td>to_amount</td><td>String</td><td><strong>Optionally Required</strong> - amount of to_currency to be received e.g "2000.56".<br><br>Required if from_amount is not provided.</td></tr><tr><td>destination_type</td><td>String</td><td><strong>Required</strong> - "bank_account" or "mobile_money"</td></tr><tr><td>account_number</td><td>String</td><td><strong>Optionally Required</strong> - required for destination_type of bank_account<br>e.g "012345678"</td></tr><tr><td>bank_code</td><td>String</td><td><strong>Optionally Required</strong> - required for destination_type of bank_account. Check <a href="/pages/IEmABvMshmjGm579WScH">Get Supported Banks</a><br>e.g "012"</td></tr><tr><td>phone_number</td><td>String</td><td><strong>Optionally Required</strong> - required for destination_type of mobile_money<br>e.g "+23312345677"</td></tr><tr><td>phone_network</td><td>String</td><td><strong>Optionally Required</strong> - required for destination_type of mobile_money.<br>Check <a href="/pages/iNON2ILQPoCTov1papJC">Get Supported Payment Methods</a><br>e.g "mobile_money_mtn"</td></tr></tbody></table>

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "tx_ext_reference": "youReference",
        "reference": "SELL_hDUkDSE36MHkds79",
        "account_name": "RAJI JOHNSON",
        "bank_name": "UNITED BANK"
    }
}
```

Store the `tx_ext_reference` returned which would be used to verify the transaction.\ <br>

{% hint style="danger" %}
If this request fails (including 5xx errors), always [**verify**](/crypto-off-ramp/direct-api-sell/get-transaction-state) that the transaction has not been created before giving any value. Use `tx_ext_reference`
{% endhint %}


# Get Transaction State

After initiating an instant sell,  you should fetch the transaction to know the current status. Make a **GET** request to either of the following endpoints using your `tx_ext_reference` OR localramp's `reference`.

```
https://api.localramp.co/v1/transaction/sell/status/:ext_reference/ext
```

OR

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/status/:reference
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "reference": "our-unique-ref",
        "tx_ext_reference": "your-unique-ref",
        "status": "completed",
        "destination_type": "bank_account",
        "account_number": "0123456789",
        "bank_code": "000",
        "account_name": "RAJI JOHNSON",
        "bank_name": "UNITED BANK",
        "from_amount": "0.038058405",
        "from_currency": "BTC",
        "to_amount": "127890",
        "to_currency": "NGN",
        "phone_number":"+12345677",
        "phone_network": "mobile_money_mtn"
    }
}
```

The possible `status`'s are  <mark style="color:orange;">`pending`</mark> , <mark style="color:green;">`completed`</mark>and <mark style="color:red;">`failed`</mark>

**pending** -  This means we are still processing the sell transaction

**completed** - This means that the transaction has been completed


# Get Limits

Before doing an instant sell transaction, you'll need to know the maximum and minimum sell amounts. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/limits?from_currency=LTC&to_currency=NGN
```

{% endcode %}

The request takes `from_currency` and `to_currency` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "from_minimum": "0.00009603",
        "from_maximum": "0.62509580",
        "from_currency": "BTC"
    }
}
```

It returns the minimum and maximum `from_amount`s


# Get Supported Currencies

Before doing an instant sell transaction, you'll need to know the available fiat currencies and cryptocurrencies. Make a **GET** request to this endpoint

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/currencies
```

{% endcode %}

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "from_currency": [
            {
                "coin": "BTC",
                "max_decimal": 8
            },
            {
                "coin": "LTC",
                "max_decimal": 8
            }
        ],
        "to_currency": [
            {
                "fiat": "NGN",
                "max_decimal": 2
            }
        ]
    }
}
```


# Get Supported Payment Methods

To get the supported sell payment methods, make a **GET** request to this endpoint

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/payment-methods?currency=NGN&country_code=NG
```

{% endcode %}

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": [
        {
            "name": "Bank transfer",
            "active": true,
            "id":"instant_p2p"
        }
    ]
}
```


# Get Supported Banks

Before doing an instant sell transaction, you'll need to know the supported banks for payouts. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/supported-banks?country=NG
```

{% endcode %}

The request takes `country`  as a query param.

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": [
        {
            "name": "9 Payment Service Bank",
            "code": "000802"
        },
        {
            "name": "ZINTERNET - KONGAPAY",
            "code": "939"
        }
    ]
}

```


# Get Crypto Balance

Before doing an instant sell transaction, you'll need to know how much is in your wallet balance for the cryptocurrency you want to sell. To do that, make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/wallet/balances
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript

{
    "status": "success",
    "data": {
        "balances": [
            {
                "currency": "usdc",
                "balance": "0.0"
            },
            {
                "currency": "bnb",
                "balance": "0.0"
            }
        ]
    }
}

```


# Get Rates

To determine what rate a coin is selling for,  make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/rate?from_currency=
USDT&to_currency=NGN
```

{% endcode %}

The request takes `from_currency` and `to_currency` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "rate": {
            "info": "conversion rate from USDT -> NGN",
            "amount": "733.86"
        },
        "fee": {
            "info": "Localramp processing fee in NGN ",
            "amount": "300.00"
        }
    }
}
```

{% hint style="success" %}
Rates for our off-ramp are **locked**, so you should expect to receive the **exact** amounts (except in rare cases with high volatility of asset)
{% endhint %}


# Verify Bank Account

To verify a bank account detail, make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell/verify-bank
```

{% endcode %}

The request takes this as the body

```javascript
{
    "account_number": "0240714625",
    "bank_code": "058",
    "currency": "NGN"
}

```

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "account_name": "JALINGO G.",
        "bank_name": "Global Bank Plc",
        "account_number": "0240714625"
    }
}
```


# Widget Sell

Non-custodial Sell. Enable your users to offramp their crypto either through the [**full-page checkout**](/crypto-off-ramp/widget-sell/full-page-checkout) or [**pop-up**](/crypto-off-ramp/widget-sell/widget-pop-up)


# Full-page checkout

Hosted pages

This allows you to redirect your users to a separate fiat off-ramp checkout page.

With the Checkout Redirect option, you can access the LocalRamp payment gateway by making a request from your server to our [initiate sell checkout endpoint](#2-initialize-the-transaction). We would return a response that includes a Checkout URL that loads the payment page where your users can sell crypto. After payment is completed or canceled, the customer is returned to any URL specified by you.

### 1. Collect payment details

Collect payment details from your user. These details are passed to the [initiate sell checkout endpoint](#2-initialize-the-transaction).

Please find below the request body for the endpoint.

<table><thead><tr><th width="190">Field</th><th width="121">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - Your unique transaction reference. <em>Must be unique for every transaction</em>. e.g "Abc123"</td></tr><tr><td>email</td><td>String</td><td><strong>Optional</strong> e.g "customer@example.com"</td></tr><tr><td>from_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The crypto currency your user would be sending. It becomes required only if <code>from_amount</code> or <code>to_amount</code> is provided. e.g "USDT"</td></tr><tr><td>crypto_chain</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The crypto_chain of from_currency. It becomes required only if <code>from_amount</code> or <code>to_amount</code> is provided. e.g "BSC"</td></tr><tr><td>to_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The fiat currency that would be received. It becomes required only if <code>from_amount</code> , <code>to_amount</code>  e.g "NGN"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The country_code where payout would be received. It becomes required only if <code>to_currency</code> is present e.g "NG", "KE", "GH"</td></tr><tr><td>from_amount</td><td>String</td><td><strong>Optional</strong> - crypto amount the user would be paying in <code>from_currency</code> unit. e.g "0.02343434". If this is present, then <code>to_amount</code> should be omitted</td></tr><tr><td>to_amount</td><td>String</td><td><strong>Optional</strong> - fiat amount that should be paid out in <code>to_currency</code> unit. e.g "10000". If this is present, then <code>from_amount</code> should be omitted</td></tr><tr><td>widget_color</td><td>String</td><td><strong>Optional</strong> - Hex color code to customize widget e.g "#DA70D6"</td></tr><tr><td>callback_url</td><td>String</td><td><strong>Optional</strong> - The url to redirect your users to, when the transaction is complete</td></tr></tbody></table>

{% hint style="info" %}
You can pass either the `from_amount` or `to_amount` when initializing the widget but **not** both.
{% endhint %}

{% hint style="info" %}
Before passing in either the `from_amount` or `rto_amount`, you'll need to know the **maximum** and **minimum** values allowed for each field. See [limit section](/crypto-off-ramp/widget-sell/get-limits).
{% endhint %}

{% hint style="info" %}
To get the list of supported currencies, crypto chains and country codes for both `from_currency` and `to_currency` see the [Get currencies section](/crypto-off-ramp/widget-sell/get-supported-currencies).
{% endhint %}

{% hint style="warning" %}
**`from_amount`** and **`to_amount`** passed show payment intent and does not guarantee the exact value that would be received at the end of the transaction. To see the exact amounts received, [get transaction state](/crypto-off-ramp/widget-sell/get-transaction-state).
{% endhint %}

### 2 - Initialize the transaction

After collecting the necessary payment details for the transaction. Make a **POST** request to our initiate buy endpoint.

{% code overflow="wrap" %}

```
https://api.localramp.co/v1/transaction/sell-widget/initiate
```

{% endcode %}

This endpoint takes the [payment details](#1.-collect-payment-details) as the request body.

With the following header

```
x-auth-token: <SECRET_KEY>
```

This endpoint is protected by secret key authentication. So when calling it, append the `x-auth-token` header with your secret key.

If the API call is successful, LocalRamp returns the following response:

```javascript

{
    "status": "success",
    "msg": "Transaction(sell) initiated successfully",
    "data": {
        "reference": "your-unique-reference",
        "checkout_link": "https://sell-checkout.localramp.co/TYUBjkns"
    }
}

```

You should then redirect your user to the Checkout URL provided in the response to enable them to complete their payment.&#x20;

You can also choose to open the checkout link in an iframe

{% code overflow="wrap" %}

```html
<iframe src="https://sell-checkout.localramp.co/bTYUBjkns" frameborder="0" width="350" height="500" allow="clipboard-read; clipboard-write self *"></iframe>
```

{% endcode %}

Once the offramp is complete or the checkout is closed, LocalRamp will redirect your user to your specified `callback_url`.&#x20;

### 3. Verifying the transaction status

The transaction reference will be appended as a query parameter to your `callback_url` as well.

`https://website_callback_url/?reference=YOUR_REFERENCE`

You can now verify the status of the transaction. See [verify section](/crypto-off-ramp/widget-sell/get-transaction-state)

In a situation where no `callback_url` is passed, the user will be redirected to your business website.&#x20;

### 4. Receive confirmation via webhook

In some cases, the fiat might take a few minutes to arrive. If you do not want to keep querying the transaction status, you can always get informed when the transaction is complete through webhooks. See  [webhook section](/webhooks/introduction).


# Widget Pop-up

Crypto on-ramp on your website

The widget product allows you to on-ramp your users without them leaving your website/app by just initiating a pop-up.

### 1. Get your public key

Get your [public key](https://merchant.localramp.co/dashboard/settings/api) from your dashboard

### 2. Add the inline script

{% code lineNumbers="true" %}

```html
<form>
    <script src="https://cdn.localramp.co/onramp-inline.js"></script>
    <button type="button" onclick="payWithLocalRamp()"> Pay </button>
</form>
```

{% endcode %}

```html
<script>
    function payWithLocalRamp() {
        window.LocalRampSell.initialize({
            public_key: "pk_live_*********************",
            reference: "your-unique-reference",
            from_amount: "10", 
            from_currency: "USDT",
            crypto_chain: "TRX",
            country_code: "NG",
            to_currency: "NGN",
            email: "richard@piedpiper.com",
            widget_color: "#DA70D6",
            onClose: function (ref) {
              // Handle when the modal is closed
            },
        });
    }
</script>
```

{% hint style="danger" %}
Avoid exposing your ***secret key*** on the client side (or front end) of your application. Requests to LocalRamp's API should be initiated from your server.
{% endhint %}

<table><thead><tr><th width="190">Field</th><th width="121">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - Your unique transaction reference. <em>Must be unique for every transaction</em>. e.g "Abc123"</td></tr><tr><td>email</td><td>String</td><td><strong>Optional</strong> e.g "customer@example.com"</td></tr><tr><td>from_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The crypto currency your user would be sending. It becomes required only if <code>from_amount</code> or <code>to_amount</code> is provided. e.g "USDT"</td></tr><tr><td>crypto_chain</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The crypto_chain of from_currency. It becomes required only if <code>from_amount</code> or <code>to_amount</code> is provided. e.g "BSC"</td></tr><tr><td>to_currency</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The fiat currency that would be received. It becomes required only if <code>from_amount</code> , <code>to_amount</code>  e.g "NGN"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Optionally</strong> <strong>Required</strong> - The country_code where payout would be received. It becomes required only if <code>to_currency</code> is present e.g "NG", "KE", "GH"</td></tr><tr><td>from_amount</td><td>String</td><td><strong>Optional</strong> - crypto amount the user would be paying in <code>from_currency</code> unit. e.g "0.02343434". If this is present, then <code>to_amount</code> should be omitted</td></tr><tr><td>to_amount</td><td>String</td><td><strong>Optional</strong> - fiat amount that should be paid out in <code>to_currency</code> unit. e.g "10000". If this is present, then <code>from_amount</code> should be omitted</td></tr><tr><td>widget_color</td><td>String</td><td><strong>Optional</strong> - Hex color code to customize widget e.g "#DA70D6"</td></tr><tr><td>onClose</td><td>[Function]</td><td><strong>Optional</strong> - Gets called whenever the user closes the modal. This could be as a result of the transaction being completed or abandoned.</td></tr></tbody></table>

{% hint style="info" %}
You can pass either the `from_amount` or `to_amount` when initializing the widget but **not** both.
{% endhint %}

{% hint style="info" %}
Before passing in either the `from_amount` or `to_amount`, you'll need to know the **maximum** and **minimum** values allowed for each field. See [limit section](/crypto-off-ramp/widget-sell/get-limits).
{% endhint %}

{% hint style="info" %}
To get the list of supported currencies and country codes for both `from_currency` and `to_currency` see the  [Get currencies section](/crypto-off-ramp/widget-sell/get-supported-currencies).
{% endhint %}

{% hint style="warning" %}
**`from_amount`** and **`to_amount`** show payment intent and does not guarantee the exact value that would be received at the end of the transaction. To see the exact amounts received,  [get transaction state](/crypto-off-ramp/widget-sell/get-transaction-state).
{% endhint %}

### 3. Verifying the transaction status

Once the modal is closed, the onClose function is called with the transaction reference

```javascript
onClose(reference)
```

This is the same reference used in initializing the widget which can now be used to verify the transaction. See [verify section](/crypto-off-ramp/widget-sell/get-transaction-state)

### 4. Receive confirmation via webhook

In some cases, the fiat might take a few minutes to arrive. If you do not want to keep querying the transaction status, you can always get informed when the transaction is complete through webhooks. See  [webhook section](/webhooks/introduction).


# Get Limits

Before initializing a sell widget transaction, you'll need to know the maximum and minimum amounts possible for a currency pair. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell-widget/limits?from_currency=USDT&to_currency=NGN
```

{% endcode %}

The request takes `from_currency` and `to_currency` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "from_minimum": "2.54999999",
        "from_maximum": "1062.71504357",
        "to_minimum": "4343.67",
        "to_maximum": "1683000.00",
        "from_currency": "USDT",
        "to_currency": "NGN"
    }
}
```

It returns the minimum and maximum amounts for both from and to currencies.

{% hint style="warning" %}
The Limits are not fixed. They vary based on the currency pair chosen and the price of the token at the time of the request. **Always** fetch the limits before initializing a sell transaction to make sure you're within the current limits.
{% endhint %}


# Get Quote

Before initializing a sell widget transaction, you might want to know what price the token is being traded at. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell-widget/quote?from_currency=USDT&to_currency=NGN
```

{% endcode %}

The request takes `from_currency` and `to_currency` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "rate": {
            "info": "conversion rate from USDT -> NGN",
            "amount": "1584.00"
        },
        "fee": {
            "info": "Localramp processing fee in NGN ",
            "amount": "300.00",
            "type": "FLAT"
        },
        "partner_fee": {
            "type": "PERCENT",
            "fee": 0
        }
    }
}
```

`fee` is what LocalRamp charges in local currency fiat i.e NGN, GHS. It will be deducted from whatever is to be paid out.

`exchange_rate` is the selling price of the coin.

`partner_fee` refers to extra fees you might wish to charge your users. This is automatically infused into the rates. Earnings from partner fees are sent straight to the USDT wallet on your dashboard weekly. To set this up, reach out to **<business@localramp.co>**

#### Rate Calculation

To calculate how much you would eventually receive for any sender amount

{% hint style="info" %}
**to\_amount** = (**from\_amount** \*`exchange_rate`) - `fee`
{% endhint %}

{% hint style="success" %}
Rates for our off-ramp are **locked**, so you should expect to receive the **exact** amounts (except in rare cases with high volatility of asset)
{% endhint %}


# Get Supported currencies

Before initializing a sell widget transaction, you'll need to know the available fiat currencies and cryptocurrencies. Make a **GET** request to this endpoint

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell-widget/currencies
```

{% endcode %}

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "sender_currency": [
            {
                "chain": "BTC",
                "currency": "BTC",
                "chain_name": "Bitcoin Network",
                "coin_name": "Bitcoin",
                "max_decimal": 8
            },
            {
                "chain": "BSC",
                "currency": "BTC",
                "chain_name": "Binance Smart Chain Network",
                "coin_name": "Bitcoin",
                "max_decimal": 8
            }
        ],
        "receiver_currency": [
            {
                "fiat": "NGN",
                "name": "Nigeria",
                "max_decimal": 2,
                "country_code": "NG"
            }
        ]
    }
}
```

{% hint style="warning" %}
Note the decimal place for tokens. If a token has a  `max_decimal` value of 8, the API would accept decimal strings between 1 to 8 decimal places e.g "0.1", "2.345", "670.45628394"
{% endhint %}


# Get Supported Payment Methods

List supported payment method for a particular currency and country\_code

See [Get Supported Payment Methods](/crypto-off-ramp/direct-api-sell/get-supported-payment-methods)


# Get Transaction State

After the modal is closed, you should fetch the transaction to know the current status. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/sell-widget/status/:reference
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "data": {
        "reference": "ref14",
        "status": "completed",
        "destination_type": "mobile_money",
        "phone_number": "+260123456789",
        "phone_network": "mobile_money_zamtel",
        "account_number": "0123456789",
        "bank_code": "000",
        "account_name": "RAJI JOHNSON",
        "bank_name": "UNITED BANK",
        "from_amount": "0.00017",
        "from_currency": "BTC",
        "crypto_chain": "BSC",
        "to_amount": "142.79",
        "to_currency": "ZMW",
    }
}
```

The possible `status`'s are  <mark style="color:orange;">`pending`</mark> and <mark style="color:green;">`completed`</mark>

**pending** -  This means we are still processing the sell transaction

**completed** - This means that the transaction has been completed


# Overview

Accept fiat payments and receive a USDT payout in your wallet, which can be withdrawn at any time or swapped for other currencies.

This can be done through one of the following ways

1. [**Full-page checkout**](/payments-on-ramp/full-page-checkout)
2. [**Widget Pop-up**](/payments-on-ramp/widget-pop-up)
3. [**White-Label API (direct charge)**](/payments-on-ramp/white-label-api-direct-charge)

{% hint style="info" %}
Payments onramp is only available to select businesses.
{% endhint %}

If you want this enabled for your account reach out to **<business@localramp.co>**


# Full-page checkout

Hosted pages

This allows you to redirect your users to a separate payment checkout page.

With the Checkout Redirect option, you can access the LocalRamp payment gateway by making a request from your server to our [initiate checkout endpoint](#2-initialize-the-transaction). We would return a response that includes a Checkout URL that loads the payment page where your users can purchase crypto. After payment is completed or canceled, the customer is returned to any URL specified by you.

### 1. Collect payment details

Collect payment/purchase details from your user. These details are passed to the [initiate checkout endpoint](#2-initialize-the-transaction).

Please find below the request body for the endpoint.

<table><thead><tr><th width="201">Field</th><th width="109">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - Your unique transaction reference. <em>Must be unique for every transaction</em>. e.g "Abc123"</td></tr><tr><td>email</td><td>String</td><td><strong>Required</strong> e.g "customer@example.com"</td></tr><tr><td>sender_currency</td><td>String</td><td><strong>Required</strong> - The currency your user would be paying in. e.g "NGN"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Required</strong> - The country_code of the user paying in e.g "NG", "KE", "GH", "ZM"</td></tr><tr><td>usdt_amount</td><td>String</td><td><strong>Required</strong> - usdt amount you want to receive e.g "200.00". </td></tr><tr><td>callback_url</td><td>String</td><td><strong>Optional</strong> - The url to redirect your users to, when the transaction is complete</td></tr></tbody></table>

{% hint style="info" %}
Before passing in`usdt_amount`, you'll need to know the **maximum** and **minimum** values allowed for a `sender_currency`. See[ limit section.](/payments-on-ramp/get-limits)
{% endhint %}

{% hint style="info" %}
To get the list of supported currencies and country codes see the [Get currencies section](/payments-on-ramp/get-supported-currencies)
{% endhint %}

### 2 - Initialize the transaction

After collecting the necessary payment details for the transaction. Make a **POST** request to our initiate buy endpoint.

{% code overflow="wrap" %}

```
https://api.localramp.co/v1/transaction/pay/checkout
```

{% endcode %}

This endpoint takes the [payment details](#1.-collect-payment-details) as the request body.

With the following header

```
x-auth-token: <SECRET_KEY>
```

This endpoint is protected by secret key authentication. So when calling it, append the `x-auth-token` header with your secret key.

If the API call is successful, LocalRamp returns the following response:

<pre class="language-javascript"><code class="lang-javascript"><strong>
</strong><strong>{
</strong>    "status": "success",
    "data": {
        "reference": "ref27",
        "checkout_link": "https://pay.localramp.co/too8909gY"
    }
}

</code></pre>

You should then redirect your user to the Checkout URL provided in the response to enable them to complete their payment.&#x20;

You can also choose to open the checkout link in an iframe

{% code overflow="wrap" %}

```html
<iframe src="https://pay.localramp.co/too8909gY" frameborder="0" width="350" height="500" allow="clipboard-read; clipboard-write self *"></iframe>
```

{% endcode %}

Once the purchase is complete or the checkout is closed, LocalRamp will redirect your user to your specified `callback_url`.&#x20;

### 3. Verifying the transaction status

The transaction reference will be appended as a query parameter to your `callback_url` as well.

`https://website_callback_url/?reference=YOUR_REFERENCE`

You can now verify the status of the transaction. See [verify section](/crypto-on-ramp/get-transaction-state)

In a situation where no `callback_url` is passed, the user will be redirected to your business website.&#x20;

### 4. Receive confirmation via webhook

In some cases, the payout might take a few minutes to arrive. If you do not want to keep querying the transaction status, you can always get informed through webhooks when the transaction is complete. See  [webhook section](/webhooks/introduction).


# Widget Pop-up

Crypto on-ramp on your website

The widget product allows you to on-ramp your users without them leaving your website/app by just initiating a pop-up.

### 1. Get your public key

Get your [public key](https://merchant.localramp.co/dashboard/settings/api) from your dashboard

### 2. Add the pay-ins/collections script

{% code lineNumbers="true" %}

```html
<form>
    <script src="https://cdn.localramp.co/onramp-inline.js"></script>
    <button type="button" onclick="payWithLocalRamp()"> Pay </button>
</form>
```

{% endcode %}

```html
<script>
    function payWithLocalRamp() {
        window.LocalRampPay.initialize({
            public_key: "pk_live_*********************",
            reference: "your-unique-reference",
            sender_currency: "NGN",
            email: "richard@piedpiper.com",
            usdt_amount: "2800.12",
            country_code: "NG",
            onClose: function (ref) {
              // Handle when the modal is closed
            },
        });
    }
</script>
```

{% hint style="danger" %}
Avoid exposing your ***secret key*** on the client side (or front end) of your application. Requests to LocalRamp's API should be initiated from your server.
{% endhint %}

Please find below the request body for the endpoint.

<table><thead><tr><th width="180">Field</th><th width="145">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - Your unique transaction reference. <em>Must be unique for every transaction</em>. e.g "Abc123"</td></tr><tr><td>email</td><td>String</td><td><strong>Required</strong> e.g "customer@example.com"</td></tr><tr><td>sender_currency</td><td>String</td><td><strong>Required</strong> - The currency your user would be paying in. e.g "NGN"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Required</strong> - The country_code of the user paying in e.g "NG", "KE", "GH", "ZM"</td></tr><tr><td>usdt_amount</td><td>String</td><td><strong>Required</strong> - usdt amount you want to receive e.g "200.00". </td></tr><tr><td>onClose</td><td>String</td><td><strong>Optional</strong> - Gets called whenever the user closes the modal. This could be as a result of the transaction being completed or abandoned.</td></tr></tbody></table>

{% hint style="info" %}
Before passing in`usdt_amount`, you'll need to know the **maximum** and **minimum** values allowed for a `sender_currency`. See[ limit section.](/payments-on-ramp/get-limits)
{% endhint %}

{% hint style="info" %}
To get the list of supported currencies and country codes see the  [Get currencies section](/payments-on-ramp/get-supported-currencies)
{% endhint %}

### 3. Verifying the transaction status

Once the modal is closed, the onClose function is called with the transaction reference

```javascript
onClose(reference)
```

This is the same reference used in initializing the widget which can now be used to verify the transaction. See [verify section](/crypto-on-ramp/get-transaction-state)

### 4. Receive confirmation via webhook

In some cases, the payout might take a few minutes to arrive. If you do not want to keep querying the transaction status, you can always get informed through webhooks when the transaction is complete. See  [webhook section](/webhooks/introduction).


# White-Label API (Direct Charge)

This endpoint can be used to either&#x20;

1. Retrieve a bank account for your customers to send fiat to. Once they do, you instantly receive USDT in your wallet.&#x20;
2. Directly charge mobile money phone numbers. You also instantly receive USDT in your wallet.

To do this, Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/pay/direct-charge
```

{% endcode %}

The request takes this as the body

<table><thead><tr><th width="181">Field</th><th width="109">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - Your unique transaction reference. <em>Must be unique for every transaction</em>. e.g "Abc123"</td></tr><tr><td>email</td><td>String</td><td><strong>Required</strong> e.g "customer@example.com"</td></tr><tr><td>sender_currency</td><td>String</td><td><strong>Required</strong> - The currency your user would be paying in. e.g "NGN"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Required</strong> - The country_code of the user paying in e.g "NG", "KE", "GH", "ZM"</td></tr><tr><td>usdt_amount</td><td>String</td><td><strong>Required</strong> - usdt amount to be received e.g "200.00". </td></tr><tr><td>phone_number</td><td>String</td><td><strong>Optionally Required</strong> - Required for mobile money e.g  "+23390999099"</td></tr><tr><td>phone_network</td><td>String</td><td><strong>Optionally Required</strong> - Required for mobile money e.g "mobile_money_MTN"</td></tr><tr><td>bvn</td><td>String</td><td><strong>Optionally Required</strong> - BVN of user making deposit. For large usdt amounts when sender_currency is NGN.</td></tr></tbody></table>

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "account_name": "Jaka Technologies",
        "account_number": "8603043242",
        "bank_name": "African Bank",
        "optional_bank_ref": "ZHKAP",
        "payment_amount": "1000",
        "bank_account_timeout": "2023-04-06T17:37:42.900Z"
    }
}
```

Store the `reference`  . It'll be used to [verify the transaction](/crypto-on-ramp/get-transaction-state).

The user is expected to make the bank transfer within 30 mins of initiating the transaction.

**`bank_account_timeout`** is when the bank account would no longer accept payments for this transaction.

**`optional_bank_ref`** is the optional transaction note/reference the user can add to the transaction.

{% hint style="info" %}
The user is expected to only make the transfer from a personal bank account belonging to the user.
{% endhint %}

{% hint style="info" %}
Before passing in`usdt_amount`, you'll need to know the **maximum** and **minimum** values allowed for a `sender_currency`. See[ limit section.](/payments-on-ramp/get-limits)
{% endhint %}

{% hint style="info" %}
To get the list of supported currencies and country codes see the  [Get currencies section](/payments-on-ramp/get-supported-currencies)
{% endhint %}


# Rates and Fees

Before initializing a fiat onramp payment, you might want to know what rate your USDT would be settled at. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/pay/rate?currency=NGN&country_code=NG
```

{% endcode %}

The request takes `currency` and `country_code` as a query param.&#x20;

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "rate": {
            "sender_currency": "NGN",
            "receiver_currency": "USDT",
            "processor_fee": {
                "type": "FLAT",
                "fee": "100.00"
            },
            "exchange_rate": "743.22",
            "market": "BUY"
        },
        "info": {
            "processor_fee": "Fee LocalRamp Charges (NGN)",
            "exchange_rate": "Price LocalRamp will buy your crypto at"
        }
    }
}
```

`processor_fee` is what LocalRamp charges in local currency fiat i.e NGN, GHS. It will be deducted from whatever the user sends.

`exchange_rate` is the purchase price of the USDT.

#### Rate Calculation

To calculate how much you would eventually receive in your USDT wallet for any sender amount

{% hint style="info" %}
**receiver\_amount** = (**sender\_amount** - `processor_fee`) / `exchange_rate`
{% endhint %}


# Get Limits

Before initializing a pay transaction, you'll need to know the maximum and minimum amounts possible for a sender\_currency pair. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/pay/limits?currency=ZMW
```

{% endcode %}

The request takes `currency` as query params.&#x20;

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "limits": {
            "receiver_minimum": 0.5,
            "receiver_maximum": 3.7,
            "receiver_currency": "USDT_BSC"
        }
    }
}
```

It returns the minimum and maximum USDT amount


# Get Supported Currencies

Before initializing a pay transaction, you'll need to know the supported countries and currencies. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/pay/currencies
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "sender_currency": [
            {
                "fiat": "NGN",
                "name": "Nigeria",
                "max_decimal": 2,
                "country_code": "NG"
            },
            {
                "fiat": "KES",
                "name": "Kenya",
                "max_decimal": 2,
                "country_code": "KE"
            },
            {
                "fiat": "ZMW",
                "name": "Zambia",
                "max_decimal": 2,
                "country_code": "ZM"
            }
        ]
    }
}
```


# Get Supported Payment Method

See [List Payment Methods](/crypto-on-ramp/list-payment-methods)&#x20;


# Withdraw crypto

Withdraw USDT settlements from your wallet on Localramp.

{% hint style="danger" %}
This API requires permission from us. However, you can always withdraw from your dashboard.
{% endhint %}

Withdraw USDT settlements from your wallet on Localramp.&#x20;

To do this, Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/wallet/withdraw
```

{% endcode %}

The request takes this as the body

```javascript
{
    "currency": "USDT",
    "address": "0xC637255611b0A70259722c35D419077Da4cACcfF",
    "amount": "100",
    "network": "bsc"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```

This withdraws USDT from Localramp to your wallet address on the Binance smart chain.

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    status: "success",
    message: "Withdrawal processing",
    data: { withdrawal_id: "uiu567H" }
}
```


# Verify crypto withdrawal

Verify if your crypto withdrawal is successful

To do this, Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/wallet/withdraw/fetch
```

{% endcode %}

The request takes this as the body

```javascript
{
    withdrawal_id: "hJi3OP"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    status: "success",
    message: "Withdrawal retrieved",
    data: {
        status: "Done",
        amount: "100.0",
        fee: "1.0",
        total: "101.0",
        txid: "0x58a8997a0f11156e261abe067ecb4ada12e614e442629ef7ffcc6dc",
        currency: "usdt"
    }
}
```

{% hint style="info" %}
Status becomes **Done** only after the withdrawal transaction has been completed on the blockchain
{% endhint %}


# Verify transaction

To verify a transaction see [this section](/crypto-on-ramp/get-transaction-state)


# Get USDT balance

To retrieve your crypto balances see [this section](/crypto-off-ramp/direct-api-sell/get-crypto-balance)


# KYC


# BVN Verification

BVN verification endpoint helps you compare bvn info provided with customer's information

Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/kyc/ng/bvn
```

{% endcode %}

The request takes this as the body

```javascript
{
    "bvn": "2578789898989906",
    "phone_number":"+234807889838989",
    "first_name": "Richard",
    "last_name": "Hendricks"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "phone_number": "Exact Match",
        "name": "Exact Match"
    }
}
```


# Send OTP

Send OTP to your users to verify that phone number provided is accurate.

Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/kyc/send-otp
```

{% endcode %}

The request takes this as the body

```javascript
{
    phone_number: "08023339279",
    mode: "whatsapp"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    status: "success",
    data: {
        otp: "706948",
        phone_number: "08023339279"
    }
}
```

`mode` can either be `sms` and `whatsapp`


# Overview

API for businesses to directly onramp to USDT for amounts > $100k


# Initiate transaction

To initiate an institutional onramp, make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/institution/buy/initiate
```

{% endcode %}

Please find below the request body for the endpoint.

<table><thead><tr><th width="201">Field</th><th width="109">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - your unique reference for the transaction</td></tr><tr><td>sender_currency</td><td>String</td><td><strong>Required</strong> e.g "NGN", "GHS"</td></tr><tr><td>country_code</td><td>String</td><td><strong>Required</strong> e.g "NG", "GH"</td></tr></tbody></table>

With the following header

```
x-auth-token: <SECRET_KEY>
```

\ <br>


# Complete transaction

After payment has been made to the bank account returned in the first step, make a **POST** request to the following endpoint to complete the transaction.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/institution/buy/complete
```

{% endcode %}

Please find below the request body for the endpoint.

<table><thead><tr><th width="201">Field</th><th width="109">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>reference</td><td>String</td><td><strong>Required</strong> - your unique reference for the transaction</td></tr><tr><td>source_bank_account</td><td>String</td><td><strong>Required</strong>  Your bank from which the payment came <br>e.g "Customer Bank"</td></tr><tr><td>source_account_name</td><td>String</td><td><strong>Required</strong> Your bank account name <br>e.g "PiedPiper Inc"</td></tr><tr><td>source_account_name</td><td>String</td><td><strong>Required</strong> Your bank account number <br>e.g "01234566"</td></tr><tr><td>source_amount</td><td>String</td><td><strong>Required</strong> How much was sent to our bank account <br>e.g "20000.89"<br><br>This is fiat value i.e NGN, GHS, KES</td></tr><tr><td>transaction_bank_description</td><td>String</td><td>"<strong>Required</strong> e.g "Payment for stuff"</td></tr></tbody></table>

With the following header

```
x-auth-token: <SECRET_KEY>
```

\ <br>


# Fetch transation

To get the status of an instititional onramp,  make a **POST** request to the following endpoint using localramp's `reference`.

```
https://api.localramp.co/v1/institution/buy/get-transaction
```

With the following header

```
x-auth-token: <SECRET_KEY>
```

The possible `state`'s are  <mark style="color:orange;">`initiated`</mark> ,<mark style="color:orange;">`pending`</mark> ,<mark style="color:green;">`sent_crypto`</mark>and <mark style="color:red;">`failed`</mark>


# Exchange Rate

To determine the rate,  make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/institution/buy/rate?sender_currency=NGN
```

{% endcode %}

The request takes `sender_currency`  as a query parameter.&#x20;

With the following header

```
x-auth-token: <SECRET_KEY>
```

{% hint style="success" %}
Rates for institutional on-ramp can only be **locked** for 20 mins after initiating the transaction
{% endhint %}


# Overview

Our Crypto swap product allows you to instantly swap between crypto currencies in your wallet.

To fund your wallet, go to the [balances section](https://merchant.localramp.co/dashboard/balances) of the dashboard and click on deposit.


# Instant Swap

You can instantly swap between crypto currencies in your wallet. To do this, Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/swap/initiate
```

{% endcode %}

The request takes this as the body

```javascript
{
        from_currency: "BTC",
        to_currency: "LTC",
        from_amount: "0.34928456"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "reference": "SWAP_hDUkDSE36MHkds79"
    }
}
```

Store the `reference` returned which would be used to verify the transaction.


# Get Transaction State

After initiating an instant sell, you should fetch the transaction to know the current status. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/swap/status/:reference
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "reference": "unique-ref",
        "state": "completed",
        "from_amount": "0.038058405",
        "from_currency": "BTC",
        "to_amount": "0.12345",
        "to_currency": "LTC"
    }
}
```

The possible `state`'s are  <mark style="color:orange;">`pending`</mark> and <mark style="color:green;">`completed`</mark>

**pending** -  This means we are still processing the swap transaction

**completed** - This means that the transaction has been completed


# Get Limits

Before doing an instant swap transaction, you'll need to know the maximum and minimum swap amounts. Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/swap/limits?from_currency=BNB&to_currency=LTC
```

{% endcode %}

The request takes `from_currency` and `to_currency` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```json
{
    "status": "success",
    "data": {
        "minimum_swap": "0.00658215",
        "currency": "BNB"
    }
}
```


# Get Supported Currencies

Before doing an instant swap transaction, you'll need to know the available crypto cryptocurrencies for swaps. Make a **GET** request to this endpoint

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/swap/currencies
```

{% endcode %}

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "coins": [
            {
                "coin": "BTC",
                "max_decimal": 8
            },
            {
                "coin": "LTC",
                "max_decimal": 8
            },
            {
                "coin": "ETH",
                "max_decimal": 8
            },
            {
                "coin": "XRP",
                "max_decimal": 6
            }
        ]
    }
}
```


# Get Rates

To determine what rate a coin pair would be swapped at,  make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/transaction/swap/rate?from_currency=
BTC&to_currency=USDT
```

{% endcode %}

The request takes `from_currency` and `to_currency` as query params.&#x20;

With the following header

```
x-auth-token: <PUBLIC_KEY>
```

If the API call is successful, LocalRamp returns the following response:

```javascript
{
    "status": "success",
    "data": {
        "rate": {
            "info": "conversion rate from BTC -> USDT",
            "amount": "20452.7993"
        }
    }
}
```

{% hint style="warning" %}
Rates for swaps are not locked and the final value received might vary very slightly from the quote.
{% endhint %}


# Introduction

API Webhooks

When certain events happen, Localramp will make a POST request to a HTTP/HTTPS endpoint of your choosing with information about the transaction in the body of your request.

To update your **Webhook URL** and **Webhook Token**, go to the [API Settings screen](https://merchant.localramp.co/dashboard/settings/api) on LocalRamp.


# Verification

Verify webhooks from LocalRamp

To be able to verify that requests to your Webhook URL are coming from LocalRamp and not a malicious actor:

Valid webhook requests have a header called `localramp-webhook-token` which has the value of the webhook token you set in your dashboard.


# Events

Event request data

For now, LocalRamp only sends webhooks on five events

1. When the customer sends fiat for a buy or payment transaction - **buy.fiat\_received**
2. When LocalRamp sends the crypto equivalent to the wallet address - **buy.crypto\_sent**
3. When a sell transaction is successfully completed - **sell.completed**
4. When a sell transaction fails - **sell.failed**
5. When a swap transaction is successfully completed - **swap.completed**
6. When a coin deposit arrives for a widget sell transaction - **sell.initiated**

The webhook request body will look like

{% tabs %}
{% tab title="Buy (Fiat Received)" %}

```json
{
  "event_type": "buy.fiat_received",
  "reference": "myTransactionReference",
  "sent_amount": "12991.32",
  "sender_currency": "NGN"
}
```

{% endtab %}

{% tab title="Buy (Crypto Sent)" %}

```json
{
  "event_type": "buy.crypto_sent",
  "reference": "myTransactionReference",
  "received_amount": "0.0116196",
  "receiver_currency": "ETH_ETH",
  "txid": "<txID>"
}
```

{% endtab %}

{% tab title="Sell Completed" %}

```json
{
  "event_type": "sell.completed",
  "tx_ext_reference": "myUniqueRef",
  "reference": "SELL_KYZSHIEMOqPg",
  "from_currency": "LTC",
  "to_currency": "NGN",
  "to_amount": "1158.96",
  "type": "widget" //"widget" or "api"
}
```

{% endtab %}

{% tab title="Sell Failed" %}

```json
{
  "event_type": "sell.failed",
  "tx_ext_reference": "myUniqueRef",
  "reference": "SELL_KYZSHIEMOqPg",
  "from_currency": "USDT",
  "to_currency": "NGN",
  "to_amount": "1158.96",
  "type": "widget" //"widget" or "api"
}
```

{% endtab %}

{% tab title="Swap Completed" %}

```json
{
  "event_type": "swap.completed",
  "reference": "SWAP_ukS6sPUx9sx7V1qE",
  "from_currency": "BNB",
  "to_currency": "USDT",
  "to_amount": "1.98"
}
```

{% endtab %}

{% tab title="Sell initiated (coin deposit)" %}

```json
{
    "event_type": "sell.initiated",
    "reference": "SELL_KYZSHIEMOqPg",
    "from_currency": "BTC",
    "to_currency": "GHS",
    "from_amount": "0.1234"
}
```

{% endtab %}
{% endtabs %}

If LocalRamp does not get a 2xx response, we'll retry the endpoint every 30 minutes for 2 hours before we give up.


# Simulate Webhooks


# Fiat received (onramp)

Simulate fiat deposit event

To simulate a "[Fiat received](/webhooks/events)" webhook

&#x20;Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/webhook/buy/payment-received
```

{% endcode %}

The request takes this as the body

```javascript
{
    webhook_url: "https://webhook.site/97f9dc63"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Crypto Sent (onramp)

Simulate crypto sent event

To simulate a "crypto sent" webhook

&#x20;Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/webhook/buy/crypto-sent
```

{% endcode %}

The request takes this as the body

```javascript
{
    webhook_url: "https://webhook.site/97f9dc63"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Sell completed (offramp)

Simulate successful sell transaction

To simulate a "sell completed" webhook

&#x20;Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/webhook/sell/completed
```

{% endcode %}

The request takes this as the body

```javascript
{
    webhook_url: "https://webhook.site/97f9dc63"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Sell failed (offramp)

Simulate failed sell transaction

To simulate a "sell failed" webhook

&#x20;Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/webhook/sell/failed
```

{% endcode %}

The request takes this as the body

```javascript
{
    webhook_url: "https://webhook.site/97f9dc63"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Swap completed

Simulate successful swap transaction

To simulate a "swap completed" webhook

&#x20;Make a **POST** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/webhook/swap/completed
```

{% endcode %}

The request takes this as the body

```javascript
{
    webhook_url: "https://webhook.site/97f9dc63"
}
```

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Demo transaction

Example completed transaction


# Example Completed Buy

Successful buy transaction example

To see what a completed buy transaction looks like when you [fetch the transaction](/crypto-on-ramp/get-transaction-state)

&#x20;Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/transaction/buy
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Example Completed Sell (Bank Account)

Successful sell transaction example

To see what a completed sell transaction looks like when you [fetch the transaction](/crypto-off-ramp/direct-api-sell/get-transaction-state)

&#x20;Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/transaction/sell
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Example Completed Sell (Mobile Money)

Successful sell transaction example

To see what a completed sell transaction looks like when you [fetch the transaction](/crypto-off-ramp/direct-api-sell/get-transaction-state) for a mobile money transaction

&#x20;Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/transaction/sell-momo
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```


# Example Completed Swap

Successful swap transaction example

To see what a completed swap transaction looks like when you [fetch the transaction](/crypto-swaps/get-transaction-state)

&#x20;Make a **GET** request to the following endpoint.

{% code overflow="wrap" %}

```url
https://api.localramp.co/v1/test/transaction/swap
```

{% endcode %}

With the following header

```
x-auth-token: <SECRET_KEY>
```


