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 Native | 0xc8c86 | 0x507D0 | 0x53D0d7 | 0xe5c957 | ||||
USDc.e | 0x7ffae0 | 0xece450 | 0xf99ea7 | |||||
USDT | 0x2f32c5 | 0x59dc25 | 0xECE450 | 0x2efc02 | TSUENfi | |||
DAI | 0x22a8d4 | 0x53d0d7 | 0xF83B3C | 0x14ea7e | ||||
cEUR | 0x10c892 | |||||||
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.
Updated about 1 year ago