买家充币

接口调用

POST https://open.tronify.io/api/tronRent/user/recharge

以下参数带*字段为必填,不带*号为选填

Headers

Name
Type
Description

api-key*

String

访问tronify.io买家管理平台获取

Request Body

Name
Type
Description

address*

String

用户地址(钱包地址)

sourceFlag*

String

渠道来源(需要双方约定一个名称来代表三方的渠道)

balance*

String

充值trx数量

{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "visible": false,
        "txID": "b4bb945886a562b2be5e01cff2bab4ec9d994fbc8879dcb3a06331c242d7e518",
        "raw_data": {
            "contract": [
                {
                    "parameter": {
                        "value": {
                            "amount": 2000000,
                            "owner_address": "41dcf5a07cfac1534c2410714d6ba6576f49c4a6d7",
                            "to_address": "418dfb584145620fbe46b7d557b1edff4c448a0752"
                        },
                        "type_url": "type.googleapis.com/protocol.TransferContract"
                    },
                    "type": "TransferContract"
                }
            ],
            "ref_block_bytes": "ca75",
            "ref_block_hash": "1abdca8db37bb677",
            "expiration": 1687276659000,
            "timestamp": 1687276601209
        },
        "raw_data_hex": "0a02ca7522081abdca8db37bb67740b8c29acc8d315a67080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541dcf5a07cfac1534c2410714d6ba6576f49c4a6d71215418dfb584145620fbe46b7d557b1edff4c448a07521880897a70f9fe96cc8d31"
    }
}

调用示例

// example
const params = {
    address: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    balance: 100,
    sourceFlag: 'tronLink'
}
const headers = {
  'api-key': 'your-api-key'
};
 const res = await axios.post('https://open.tronify.io/api/tronRent/user/recharge',params, { headers })
 console.log(res)
 if(res.resCode === '100'){
    const signedTx = await tronWeb.trx.sign(res.data)
    const broastTx = await tronWeb.trx.sendRawTransaction(signedTx)
    return broastTx.txid 
 }

Postman 示例

Last updated