From External Wallet

Deposit Process Overview

For a user trying to sell crypto, a deposit must be made first to transfer the crypto. The deposit and sell are seen as a single transaction for the user, but the merchant needs to handle them as two separate transactions.

Steps for Deposit:

  1. Fetch the User Deposit Wallet Address using API
  2. Make the Deposit to the Given Wallet Address
  3. Wait for the Success Callback Webhook

API Descriptions

  1. Fetch Deposit Wallet Address

API Endpoint:
GET https://mudrex.com/api/v1/wallet/user_deposit_address?symbol=USDT&network=MATIC,BSC

Request Example:

curl --location '<https://mudrex.com/api/v1/wallet/user_deposit_address?symbol=BTC'>  
--header 'X-Timestamp: 1667458513'  
--header 'X-Client-Id: 18e963ea-39fd-4a1b-b1e6-decbfe791d31'  
--header 'X-Request-Id;'  
--header 'X-User-Id;'  
--header 'X-Secret-Key;'  
--header 'Host;'
{  
  "success": true,  
  "data": [  
    {  
      "network": "BNB",  
      "name": "Binance Chain (BEP2)",  
      "coin": "BTC",  
      "address": "bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23",  
      "tag": "407410902",  
      "url": "https://explorer.binance.org/address/bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23"  
    },  
    {  
      "network": "BSC",  
      "name": "Binance Smart Chain (BEP20)",  
      "coin": "BTC",  
      "address": "0xc37e9cbe6e1d481d9372585e1b91cb387853d352",  
      "tag": "",  
      "url": "https://bscscan.com/address/0xc37e9cbe6e1d481d9372585e1b91cb387853d352"  
    },  
    {  
      "network": "BTC",  
      "name": "Bitcoin",  
      "coin": "BTC",  
      "address": "1HTs5QzAfwfxjPBKWtKxTBNYkGmReMS36M",  
      "tag": "",  
      "url": "https://blockchair.com/bitcoin/address/1HTs5QzAfwfxjPBKWtKxTBNYkGmReMS36M"  
    },  
    {  
      "network": "ETH",  
      "name": "Ethereum (ERC20)",  
      "coin": "BTC",  
      "address": "0xc37e9cbe6e1d481d9372585e1b91cb387853d352",  
      "tag": "",  
      "url": "https://etherscan.io/address/0xc37e9cbe6e1d481d9372585e1b91cb387853d352"  
    },  
    {  
      "network": "SEGWITBTC",  
      "name": "BTC(SegWit)",  
      "coin": "BTC",  
      "address": "bc1q3mchv2exf8z2v577n8nlcmgduguw22ryxgyxlv",  
      "tag": "",  
      "url": "https://blockchain.coinmarketcap.com/zh/address/bitcoin/bc1q3mchv2exf8z2v577n8nlcmgduguw22ryxgyxlv"  
    }  
  ]  
}
  1. Deposit Success Webhook

Webhook URL:
POST {{configured_webhook}}

curl --location -g '{{configured_webhook}}'  
--data '{  
  "transaction_type": "DEPOSIT",  
  "status": "COMPLETED",  
  "crypto_symbol": "USDT",  
  "network": "BSC",  
  "amount": "10.00000000",  
  "created_at": 1675171122000,  
  "tag": "",  
  "updated_at": 1675171203000,  
  "usd_value": "10.00",  
  "txn_hash": "Internal transfer 127897710444",  
  "id": "91994108-9eff-4999-8e8f-238df8bd4961",  
  "event": "deposit",  
  "address": "0x94f30b2a43ec890848c64ecdbb434ea1bcc4b798",  
  "user_id": "3faced19-20c7-48b8-952b-6143c8c198d2"  
}'
  1. Fetch All Transactions for a User

API Endpoint:
GET https://mudrex.com/api/v1/wallet/deposit/{user_id}

Request Example:

curl --location '<https://mudrex.com/api/v1/wallet/deposit/42a054f3-3c15-407c-9cd7-2641ab867643'>  
--header 'X-Timestamp: {{timestamp}}'  
--header 'X-Client-Id: •••••••'  
--header 'X-Request-Id: qretyrty'  
--header 'X-User-Id: •••••••'  
--header 'X-Secret-Key: •••••••'  
--header 'Host;'  
--data ''
{  
  "success": true,  
  "data": {  
    "id": "42a054f3-3c15-407c-9cd7-2641ab867643",  
    "created_at": 1675165880000,  
    "tag": "",  
    "crypto_symbol": "USDT",  
    "txn_hash": "Internal transfer 127892568047",  
    "transaction_type": "DEPOSIT",  
    "usd_value": 9,  
    "network": "MATIC",  
    "source_address": null,  
    "address": "0x94f30b2a43ec890848c64ecdbb434ea1bcc4b798",  
    "updated_at": 1675166104000,  
    "amount": 9,  
    "status": "COMPLETED"  
  }  
}
  1. Fetch All Deposit Transactions

API Endpoint:
GET https://mudrex.com/api/v2/wallet/transactions?transaction_type=DEPOSIT

Request Example:

curl --location '<https://mudrex.com/api/v2/wallet/transactions?transaction_type=DEPOSIT'>  
--header 'X-Timestamp: {{timestamp}}'  
--header 'X-Client-Id: •••••••'  
--header 'X-Request-Id: 2'  
--header 'X-User-Id: •••••••'  
--header 'X-Secret-Key: •••••••'  
--data ''
{  
  "success": true,  
  "data": \[  
    {  
      "id": "018f9e6b-98f4-7381-95bc-6bbc537b153b",  
      "transaction_type": "CRYPTO_DEPOSIT",  
      "status": "COMPLETED",  
      "amount": 29.5,  
      "created_at": 1716349803000,  
      "updated_at": 1716349803000,  
      "uuid": "018f9e6b-98f4-7381-95bc-6bbc537b153b",  
      "symbol": "USDT",  
      "user_id": "25e0cdc5-7406-4011-a2e3-cd93b265d966",  
      "usd_value": 29.5,  
      "txn_hash": "0xf9c493a740dd47fe9cc282e5aac19f8a64056e42dff71cdcaa7159cd9e354d87",  
      "tag": "",  
      "source_address": "",  
      "address": "0xe9c35b9e75c150d37571f1ec9
    }

Key Considerations:

  1. Deposit and Sell as Separate Transactions: While the user sees a single transaction for both the deposit and sell operations, the merchant must handle the deposit transaction separately and wait for the callback webhook to confirm successful deposit before proceeding with the sale.
  2. API Integration: The merchant must use the APIs to fetch deposit addresses, confirm the deposit transaction through the webhook, and track all transactions to reconcile the deposits with sales.
  3. Network Support: Ensure that the correct network (such as MATIC, BSC, or others) is specified during the deposit process.

Check more details about the API endpoint here.