# Events

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.localramp.co/webhooks/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
