Ramp Widget

The widget lets you off-ramp your customers without them leaving your website or app, all with a simple pop-up.

  1. Get your public key

    Get your public key from your dashboard

  2. Add the ramp script

    <form>
        <script src="https://d309lcjd52k0i0.cloudfront.net/ramp.js"></script>
        <button type="button" onclick="payWithRamp()"> Pay </button>
    </form>
    

    <script>
        function payWithRamp() {
            window.ramp.initialize({
                public_key: "pub_*********************",
                reference: "93979999999",
                from_currency: "usdt",
                to_currency: "ngn",
                from_amount: "1",
                mode: "sell",
                network: "BEP20",
                onClose: function (ref) {
                    // Handle when the modal is closed
                    console.log("onClose", ref);
                },
                onReceiveWalletDetails: function (walletDetails) {
                 
                },
                onSuccess: function (transaction) {
                 
                }
            });
        }
    </script>
    

    FieldData TypeDescription
    public_keyStringA unique public API key is used to authenticate the user and associate the transaction with the relevant account. It is provided by Ramp and is required to initialize the SDK.
    referenceStringA custom reference or identifier for the transaction. Must be unique for every transaction.
    from_currencyStringThe currency being used for the transaction. This should be a valid currency code, such as "usdt", indicating the type of cryptocurrency or fiat to be used for the transaction.
    to_currencyStringThe target currency for the transaction. This should be a valid currency code, such as "ngn", indicating the currency the user will receive after completing the transaction.
    from_amountStringThe amount of the source currency (from_currency) being exchanged. It should be a string representing the numerical value of the amount to be converted. This is often provided as a decimal number.
    modeStringThe transaction type can be "sell" or "buy." The "sell" mode indicates that the user is selling cryptocurrency for fiat, while the "buy" mode indicates that they are buying cryptocurrency using fiat.
    networkStringIndicates the blockchain network where the transaction will take place.
    onCloseFunctionThis function is triggered whenever the user closes the modal, whether the transaction is completed or abandoned.
    onReceiveWalletDetailsFunctionThis callback function is triggered when the wallet details are received. it returns information about the wallet, such as the wallet address and transaction amount. This can be used to display wallet information to the user or log transaction details.
    onSuccessFunctionThis callback function runs when the transaction is successful. It also returns the transaction details.

  3. Verify transaction

    onSuccess(transaction)