Introduction Utransfa

Utransfa: is a crypto payments system designed to adapt to your evolving needs. You can accept, convert, pay out, and store a variety of cryptocurrencies with ease. Its flexible structure allows you to switch counterparties effortlessly, minimizing your risk of single-point failure.

Creating Merchant

In order for you to begin to run the required operations, you'd need a merchant ID, one of the ways to get it is as follows.

The process of adding a merchant is followed by webhook, the webhook url receives a POST request of the entire notification (withdrawal / deposit).

POST REQUEST :
  • POST: url: https://utransfa.com/utransfa/add_merchant
  • YOUR CODE PHP <?php
    // Set content type to JSON
    header('Content-Type: application/json');
    // Check if the request method is POST
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $input = json_decode(file_get_contents('php://input'), true);
    }
    ?>


    Python
    from flask import Flask, request, jsonify
    app = Flask(__name__)
    @app.route('/your-endpoint', methods=['POST'])
    def your_function():
    # Set content type to JSON
    if request.method == 'POST':
    input_data = request.get_json()
    # Process input_data as needed
    return jsonify(input_data)
    if __name__ == '__main__':
    app.run()
JSON

                  
  {
      "email": "testing@utransfa.com",
      "merchant_name": "Utransfa",
      "web_hook": "https://yourdomain.com/endpoint"
      
      
  }

Output Example:

  {
      "merchant_key": "8f44d8fa2ae82326fb29bb95be7389",
      "msg": "Merchant created successfully",
      "status": "created"
     
  }

Deposit Funds

Note

During the process of generating address, what's important is passing the right symbols. tusdt, btc, trx, erc20 where tusdt represents USDT-TRC20.

POST REQUEST :
  • POST: url: https://utransfa.com/utransfa/create_address
JSON

  {
      "merchant_key": "8f44d8fa2ae82326fb29bb95be7389",
      "symbol": "tusdt"
  },

Output Example:

  {
        "address": "TEebexXTJJvCcxbPg1qLUvbdU94VnAu94Y",
        "symbol":  "tusdt",
        "address_id": 1334183,
        "symbol_img_url": "https://utransfa.com/utransfa/web/images/TEebexXTJJvCcxbPg1qLUvbdU94VnAu94Y.png"
     
  }

webhook: JSON

  {
      "txid": "98718d5d5b171218a2996c34bcb7fafacaca94f9907e00c73ff35a889eb07897",
      "address_to": "TLPjdwGx4cFjJqYnu5sKFzzzR3q3gcBVT1",
      "symbol": "tusdt",
      "amount": 23,
      "confirmation": 3,
      "real_Fee": 1.3,
      "msg": "payments confirmed"
      "status": "succesful",
      "type": "deposit",
      "deposit_id": "23456787"
  },

Funds Withdrawal

Note

To process withdrawals only four paramenters are required: these are

  • merchant_id
  • ,
  • address(crypto address e.g a valid usdt, btc, or erc20 address)
  • ,
  • symbol
  • ,
  • amount(if it's btc remember not to pass a large interger there)

POST REQUEST :
  • POST: url: https://utransfa.com/utransfa/transfa_funds
JSON

  {
      "merchant_id": "8f44d8fa2ae82326fb29bb95be7389",
      "address": "TLPjdwGx4cFjJqYnu5sKFzzzR3q3gcBVT1",
       "symbol": "tusdt",
        "amount": 23
  },

Response Example:

  {
        "msg": "awaiting payments",
        "status":  "pending",
        "withdrawal_id": 482323,
        "symbol":  "tusdt"
  }

On your code, store withdrawal_id in your database, you'd need it to compare transaction status when the system sends back webhook.

Note

Only succesful withdrawals are sent to the webhook

After the response: If the withdrawal was succesful, a post request would be sent to your webhook containing the following data.

JSON

  {
      "txid": "98718d5d5b171218a2996c34bcb7fafacaca94f9907e00c73ff35a889eb07897",
      "address_to": "TLPjdwGx4cFjJqYnu5sKFzzzR3q3gcBVT1",
      "symbol": "tusdt",
      "amount": 23,
      "confirmation": 3,
      "real_Fee": 1.3,
      "msg": "payments confirmed"
      "status": "succesful",
      "type": "withdrawal",
      "withdrawal_id": "23456787"
  },

Get Address Info

Note

To process withdrawals only four paramenters are required: these are

  • merchant_id
  • ,
  • address(crypto address e.g a valid usdt, btc, or erc20 address)
  • ,
  • symbol
  • ,
  • amount(if it's btc remember not to pass a large interger there)

POST REQUEST :
  • POST: url: https://utransfa.com/utransfa/transfa_funds
JSON

  {
      "merchant_id": "8f44d8fa2ae82326fb29bb95be7389",
      "address": "TLPjdwGx4cFjJqYnu5sKFzzzR3q3gcBVT1",
       "symbol": "tusdt",
        "amount": 23
  },

Response Example:

  {
        "msg": "awaiting payments",
        "status":  "pending"
  }

Note

Only succesful withdrawals are sent to the webhook

After the response: If the withdrawal was succesful, a post request would be sent to your webhook containing the following data.

JSON

  {
      "txid": "98718d5d5b171218a2996c34bcb7fafacaca94f9907e00c73ff35a889eb07897",
      "address_to": "TLPjdwGx4cFjJqYnu5sKFzzzR3q3gcBVT1",
      "symbol": "tusdt",
      "amount": 23,
      "confirmation": 3,
      "real_Fee": 1.3,
      "msg": "payments confirmed"
      "status": "succesful"
  },

Resend Webhook

Note

To resend webhooks of either type: deposit or type: withdraw, the following paramenters are required

  • merchant_id
  • ,
  • type(deposit or withdrawal)
  • ,
  • hook_id(the hook id is the transaction ID, usually 8 length of intergers, the id generated when transaction is created)

POST REQUEST :
  • POST: url: https://utransfa.com/utransfa/sendhooks
JSON

  {
      "merchant_id": "8bdf58799fcb7b0098b3bdd98aa5ea",
      "type": "deposit",
       "hook_id": "1375689"
  },

Response Example:

  {
        "status": "successful",
        "url":  "url from database",
        "type":  "deposit",
        "route":  "api"
  }

Note

On your webhook end point listen for POST request

The following data payload is sent to your webhook depending if it's deposit or withdrawal

Note

On your code do this:

When listening to the post request, use type to check if it's withdrawl or deposit:

PHP

      
        
             // Set content type to JSON
header('Content-Type: application/json');
      if($_SERVER['REQUEST_METHOD']=="POST"){
            
           // Get the input data
        $input = json_decode(file_get_contents('php://input'), true);
        
        $txid = $input['txid'];
        $type = $input['type'];
        $address_to = $input['address_to'];
        $amount = $input['amount'];
        $symbol = $input['symbol'];
        $confirmations = $input['confirmation'];
        $status = $input['status'];
        if($type=="deposit"){
            $deposit_id = $input['deposit_id'];
            
            
            }else if($type=="withdrawal"){
             $withdrawal_id = $input['withdraw_id'];
            
            
            }
            
            
            }

Python

      
      from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse

app = FastAPI()

@app.post("/webhook")
async def webhook(request: Request):
    # Get the input data
    input_data = await request.json()
    
    txid = input_data.get('txid')
    type_ = input_data.get('type')
    address_to = input_data.get('address_to')
    amount = input_data.get('amount')
    symbol = input_data.get('symbol')
    confirmations = input_data.get('confirmation')
    status = input_data.get('status')
    
    if type_ == "deposit":
        deposit_id = input_data.get('deposit_id')
        # Process deposit logic here (if needed)

    elif type_ == "withdrawal":
        withdrawal_id = input_data.get('withdraw_id')
        # Process withdrawal logic here (if needed)

    return JSONResponse(content={"status": "success"})

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)


JSON

  {
      "txid": "98718d5d5b171218a2996c34bcb7fafacaca94f9907e00c73ff35a889eb07897",
      "address_to": "TLPjdwGx4cFjJqYnu5sKFzzzR3q3gcBVT1",
      "symbol": "tusdt",
      "amount": 23,
      "confirmation": 3,
      "real_Fee": 1.3,
      "msg": "payments confirmed"
      "status": "succesful",
       "type": "deposit",
        "depoosit_id": "1375689"
  },