Comment on page

On-Off Ramp

In this section, you'll learn how to use Cashramp to on-off ramp stablecoins to/from a DApp/self-custodial wallet.

Supported stablecoins

Ramp available
On-ramp, Off-ramp

Getting started

An API key is all you need to get started with onchain on-off ramping. You can create yours by following the authentication steps.
The on-off ramp flow is accessible via a URL that can be customized to your specific use case with query parameters.

Base URL

  • Staging: https://staging.useaccrue.com/hosted/ramp
  • Production: https://useaccrue.com/hosted/ramp

Query Parameters

  • key (required): Your public key.
  • paymentType (required): Either deposit or withdrawal
  • address (required): The wallet address you want to deposit into or withdraw from
  • coin (required): The stablecoin you want to deposit/withdraw
  • network (required): The network you want to deposit/withdraw via
  • amount (optional): The quantity of the stablecoin you want to deposit/withdraw
  • currency (optional): The ISO 4217 currency code
  • phone (optional): The phone number of the customer
  • hideAddress (optional): Set to true if you want to hide the customer's wallet address in the payment flow

Custom crypto deposit flow

If you're using the Onchain Ramp webpage/widget in a browser with a window.ethereum object available, during the offramp flow, we will automatically initiate a transaction signing prompt for any injected wallet (Rainbow, Metamask).
However, if window.ethereum isn't available, we send a message event that you can listen for and spin up your customized experience for sending in crypto from a user's wallet address to the Cashramp Escrow Address.
window.addEventListener("message", (message) => {
if (message.origin === "https://useaccrue.com") {
const { event, payload } = message.data;
if (event === "crypto.requested") {
const amountUsd = parseFloat(payload.amountCents) / 100;
const destinationAddress = payload.destinationAddress;
// Here's where you add your custom experience for sending the *exact*
// USD amount to Cashramp's Escrow Address (destinationAddress)