HomeGuidesRecipesAPI ReferenceChangelog
Log In
Guides
These docs are for v2.1.2. Click to read the latest docs for v2.1.8.

How to simulate a crypto to fiat transaction

When building in Sandbox, you will want to be able to send crypto transactions to an Individual or Corporate Unblock wallet to simulate a cryptoToFiat transaction.

1. Create and log in as a new user.

2. You will need to get the wallet address of the Individual or Corporate using this endpoint

curl --request GET \
     --url https://api.getunblock.com/user/wallet/polygon \
     --header 'Authorization: <<API key>>' \
     --header 'accept: application/json' \
     --header 'unblock-session-id: <<unblock session id>>'

3. You will need to mint test tokens to another wallet on-chain which you control

This can be done using our test tokens contracts on all the respective chains; here is a list with a link to them:

Token Mumbai
(Polygon testnet)
Goerli
(Optimism testnet)
Sepolia
(Arbitrum testnet)
Alfajores
(Celo testnet)
Sepolia
(Ethereum testnet)
Shasta
(Tron testnet)
USDc Native0xc8c860x507D00x53D0d70xe5c957
USDc.e0x7ffae00xece4500xf99ea7
USDT0x2f32c5 0x59dc250xECE4500x2efc02TSUENfi
DAI0x22a8d40x53d0d70xF83B3C0x14ea7e
cEUR0x10c892
cUSD

Each of these token contracts has a publicmint() function that can be used to mint test tokens directly to any wallet of your choice; these tokens can then be used to simulate acryptoToFiat transfer.

4. Transfer ERC20 tokens to the Individual or Corporate wallet gathered in step 2

As soon as the funds are received in the Individual or Corporate wallet, the rest of the normal.CryptoToFiat process will automatically get triggered, and then if the API keys used are for a private Sandbox, the Merchant will receive all the webhooks described here

📘

This will only work once for non KYC users

As per the Unblock KYC policy, users that have no KYC will only be able to complete one transaction fiatToCrypto and one transaction cryptoToFiat up to the no KYC limit. For further information, please read more here.