# Widget Pop-up

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.md)
{% 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.md)
{% 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.md)

### 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.md).


---

# 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/payments-on-ramp/widget-pop-up.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.
