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
Stablecoin | Network | Ramp available | Fees |
---|---|---|---|
CUSD, USDC, USDT | CELO | On-ramp, Off-ramp | $0.01 |
USDC | OP | On-ramp, Off-ramp | $0.15 |
USDC | BASE | On-ramp, Off-ramp | $0.1 |
USDC | MATIC | Off-ramp | $0.3 |
USDC | SOL | Off-ramp | $0.5 |
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
URL Query Parameters
key (required): Your public key.
paymentType (required): Either
deposit
orwithdrawal
address (optional): The wallet address you want to deposit into or withdraw from. If this is not provided, we'll attempt to detect the address from the injected wallet context
window.ethereum
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
reference (optional): Your unique reference
redirectUrl (optional): The URL you want us to redirect your customer to after the transaction is completed.
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
isWalletContext (optional): Set to
false
if you want to explicitly ignorewindow.ethereum
in favour of your custom crypto deposit flow. By default, it'strue
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, etc).
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.
Confirm transaction
After successfully initiating your crypto transfer to the wallet address we provided to you, you can poll our servers to request transaction confirmation with the mutation below.
We recommend that your polling frequency be proportionate to your blockchain's block time. For example, CELO & Optimism can be 10s, and Ethereum can be 1min.
If the transaction is confirmed, we'll do the following:
Update the payment request status from
pending_funding
tocreated
. We will also send a webhook notification about the update.Automatically email your user a payment link that allows them to withdraw the fiat equivalent of their USD stablecoin payment.
Arguments
paymentRequest: The global ID of the payment request you want to confirm
transactionHash: The transaction hash for the crypto transfer you initiated
Last updated