Ramp Widget
The widget lets you off-ramp your customers without them leaving your website or app, all with a simple pop-up.
-
Get your public key
Get your public key from your dashboard
-
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>
Field Data Type Description public_key String A 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. reference String A custom reference or identifier for the transaction. Must be unique for every transaction. from_currency String The 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_currency String The 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_amount String The 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. mode String The 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. network String Indicates the blockchain network where the transaction will take place. onClose Function This function is triggered whenever the user closes the modal, whether the transaction is completed or abandoned. onReceiveWalletDetails Function This 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. onSuccess Function This callback function runs when the transaction is successful. It also returns the transaction details.
-
Verify transaction
onSuccess(transaction)
Updated 9 days ago