1. Go to this page and download the library: Download uduncloud/udun-wallet-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uduncloud / udun-wallet-sdk example snippets
composer
{
"uduncloud/udun-wallet-sdk": "^1.0"
}
}
use udun\Dispatch\UdunDispatch;
class UdunController{
protected $udunDispatch ;
public function __construct()
{
// 控制器初始化
$this->initialize();
}
protected function initialize(){
$this->udunDispatch = new UdunDispatch([
'merchant_no' => 30000, //商户号
'api_key' => 'c789xxxxxxxxxxxxxxxxx388ecxxx',//apikey
'gateway_address'=>'https://sig11.udun.io', //节点
'callUrl'=>'https://localhost/callUrl', //回调地址
'debug' => false //调试模式
]);
}
}
##使用示例
namespace xxxx;
class Index extends UdunController{
//查询支持的交易对
public function supportCoins()
{
$result = $this->udunDispatch->supportCoins(true);
return json($result);
}
//创建地址
public function createAddress()
{
$result = $this->udunDispatch->createAddress('195');
return json($result);
}
//验证地址合法性
public function checkAddress()
{
$result = $this->udunDispatch->checkAddress('195','TEpK1aWkjDue6j8reeeMqG7hdJ5tRytyAF');
return json($result);
}
//查询地址是否存在
public function existAddress()
{
$result = $this->udunDispatch->existAddress('195','TEpK1aWkjDue6j8reeeMqG7hdJ5tRytyAF');
return json($result);
}
//申请提币
public function withdraw()
{
$result = $this->udunDispatch->withdraw('sn00001','195','195','TEpK1aWkjDue6j8reeeMqG7hdJ5tRytyAF',10);
return json($result);
}
//交易回调
public function callback()
{
$result = $this->udunDispatch->callback();
return json($result);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.