PHP code example of sunotc / sdk-php

1. Go to this page and download the library: Download sunotc/sdk-php 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/ */

    

sunotc / sdk-php example snippets


$ composer 

use SunOtc\OtcService

    $data       = '{"app_id":"123","merc_order_id":"200611184930170114"}';
    $OtcService = (new OtcService(Dictionary::PUBLIC_KEY, Dictionary::PRI_KEY));
    $OtcService->getOrderMsg($data);
    //                //查询交易限制
    $data       = '{"app_id":"123"}';
    $OtcService = (new OtcService(Dictionary::PUBLIC_KEY, Dictionary::PRI_KEY));
    $OtcService->getTradeLimit($data);*/
    
    //查询商户资产
     $data = '{"app_id":"123","merc_order_id":"200611184930170114"}';
     $OtcService = (new OtcService(Dictionary::PUBLIC_KEY,Dictionary::PRI_KEY));
     $OtcService->getMercAsset($data);
    
    //        //查询价格
    $data       = '{"app_id":"123","coin":"USDT"}';
    $OtcService = (new OtcService(Dictionary::PUBLIC_KEY, Dictionary::PRI_KEY));
    $OtcService->getTradePrice($data);
        
        
//返回数据
$address_info  = '{
                      "code":0,
                      "message":"success",
                      "data":[
                          {
                              "pay_type":"BANK",
                              "amount_min":1000,
                              "amount_max":5000
                          },
                          {
                              "pay_type":"WECHAT",
                              "amount_min":1000,
                              "amount_max":5000
                          },
                          {
                              "pay_type":"ALIPAY  ",
                              "amount_min":1000,
                              "amount_max":5000
                          }
                      ],
                      "time":1592729822
                  }';