Quickstart

Welcome to the Saber Money Off-Ramp Integration Quickstart Guide. This guide will assist you in integrating Saber Money's fiat off-ramp solution into your application efficiently.

Overview

Through this guide, you will be able to sell crypto for fiat and have it deposited into a user's bank account.

Prerequisites

Before you can get started ensure:

  1. Register as a Saber merchant: In case you have not, get started by reaching out to our team.
  2. Setting up your keys: Keep your keys handy. Each API call requires an authentication signature. Create it using the guide Authentication: Configuring Your Keys
  3. Create a user: A user forms the base of operations. Create your user using the guide Guide
  4. Configure your webhooks: Saber sends a webhook for various important milestones in the flow. Set up your webhooks using the guide Webhook Configuration and IP

Implementation


Step 1: Deposit crypto into Saber

  • Fetch a deposit address for a user using the fetch deposit API as shown below. (Alternatively, internal transfer can also be done)
curl --location 'https://mudrex.com/api/v1/wallet/user_deposit_address?symbol=BTC' \
--header 'X-Timestamp: {{timestamp}}' \
--header 'X-Client-Id: {{client_id}}' \
--header 'X-Request-Id;{{request_id}}' \
--header 'X-User-Id;{{user_id}}' \
--header 'X-Secret-Key;{{secret_key}}'
{
  "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"
    }
  ]
}

Find more info on the API here

Step 2: Wait for a success callback

As soon as your crypto deposit hits our systems, we will send a webhook to your configured endpoint.

{
    "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 xyz",
    "id": "91994108-9eff-4999-8e8f-238df8bd4961",
    "event": "deposit",
    "address": "0x123xxxx",
    "user_id": "user1234"
}

Once this webhook is received it will be visible on the transaction tab on the Saber dashboard.

Find more info about the webhook here

Step 3: Initiate a sell crypto transaction

  • In this step, the user's KYC is checked for. If it is not complete, you will be required to complete it. Follow the guide here to complete a user's KYC
  • A user must have a valid Indian bank account registered. If not, a bank account can be added for the user. Follow the guide here to add a bank account for a user.
  • Use the sell API to initiate a sell transaction
    curl --location 'https://mudrex.com/api/v1/wallet/conversion/fiat/sell' \
    --header 'X-Timestamp: {{timestamp}}' \
    --header 'X-Client-Id: {{client_id}}' \
    --header 'X-Request-Id;{{request_id}}' \
    --header 'X-User-Id;{{user_id}}' \
    --header 'X-Secret-Key;{{secret_key}}' \
    --data '{
        "source_id": "65d246fc-6a5b-43d7-89bf-944e95ff2279",
        "fiat_symbol": "INR",
        "crypto_symbol": "USDT",
        "fiat_amount": 100,
        "crypto_amount": 1.14,
        "payment_method": "bank_transfer"
    }'
    
    {
      "success": true,
      "data": {
        "status": "CREATED",
        "fiat_amount": 100,
        "transaction_type": "SELL",
        "fiat_symbol": "INR",
        "failure_code": null,
        "exchange_rate": 82.56976,
        "id": "a892dc4a-aecb-4a22-9de4-2990b4179b77",
        "crypto_symbol": "USDT",
        "created_at": "2022-10-03 07:51:15",
        "bank_transaction_id": null,
        "source_id": "65d246fc-6a5b-43d7-89bf-944e95ff2279",
        "failure_desc": null,
        "crypto_amount": 1.14
      }
    }
    
    Find more info on the API here

Step 4: Wait for a success callback

As soon as the fiat deposit is complete, we will send a webhook to your configured endpoint.

{
  "event" : "SELL",
  "user_id": "77c4562e-ce47-4054-9d4e-4df69ca11a11", 
  "client_id": "3a309275-5936-4c79-8375-0ebb897502f0",
  "transaction_status": "COMPLETED", 
  "invested_at": "2022-11-16T09:30:13", 
  "transaction_id": "4f4d9561-b12f-4cdd-9726-d29333892fc9", 
  "transfer_type": "bank_transfer", 
  "bank_reference_id": "1176073620125", 
  "usd_amount": "1.21000000", 
  "fiat_amount": "100.00000000"
}

Once this webhook is received it will be visible on the transaction tab on the Saber dashboard.


Congratulations! 🥳 You have completed the integration with Saber.

For more APIs relative to offramp, please read the API reference guide here