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 from your dashboard

2. Add the pay-ins/collections script

<form>
    <script src="https://cdn.localramp.co/onramp-inline.js"></script>
    <button type="button" onclick="payWithLocalRamp()"> Pay </button>
</form>
<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>

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.

Please find below the request body for the endpoint.

FieldData TypeDescription

reference

String

Required - Your unique transaction reference. Must be unique for every transaction. e.g "Abc123"

email

String

Required e.g "customer@example.com"

sender_currency

String

Required - The currency your user would be paying in. e.g "NGN"

country_code

String

Required - The country_code of the user paying in e.g "NG", "KE", "GH", "ZM"

usdt_amount

String

Required - usdt amount you want to receive e.g "200.00".

onClose

String

Optional - Gets called whenever the user closes the modal. This could be as a result of the transaction being completed or abandoned.

Before passing inusdt_amount, you'll need to know the maximum and minimum values allowed for a sender_currency. See limit section.

To get the list of supported currencies and country codes see the Get currencies section

3. Verifying the transaction status

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

onClose(reference)

This is the same reference used in initializing the widget which can now be used to verify the transaction. See verify section

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.

Last updated