天天看點

檢測淘寶訂單号是否使用淘客下單接口 檢測淘客接口 淘客檢測接口

該接口可以檢測淘寶訂單号是否使用淘客下單,避免商家損失傭金

1、注冊訂單俠開放平台賬号

注冊位址: https://www.dingdanxia.com/user/register/index.html  

2、擷取接口秘鑰apikey

登入個人中心 - 系統設定 - 接口管理 找到接秘鑰apikey,apikey 接口秘鑰是調用接口的唯一憑證,請妥善保管! 

3、PHP代碼調用示例

<?php
// +----------------------------------------------------------------------
// | 訂單俠開放平台 www.dingdanxia.com  [ 專為淘客開發者提供一站式API解決方案 ] 
// +----------------------------------------------------------------------
//接口秘鑰
$apikey = '這裡填寫你的apikey';
//檢測淘寶訂單号是否使用淘客下單
$apiurl = "http://api.tbk.dingdanxia.com/shop/check_tk_order";
 
 
//開始調用
$result = curl_post($apiurl, array(
    //接口秘鑰
        "apikey"    => $apikey,
        "order_no"  =>淘寶訂單号
	    
));
 
 
//列印結果
print_r($result);
 
/**
 * post請求
 * @param string $url
 * @param array $params
 * @param int $timeout
 */
function curl_post($url, $params, $timeout = 3) {
    try {
        foreach ($params as $key => $val) {
            $post[] = "{$key}={$val}";
        }
        $post_data  = implode('&', $post);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
        return curl_exec($ch);
    }
    catch (Exception $e) {
        return false;
    }
}           
{
	"code": 200,
	"msg": "請求成功【success】",
	"data": {
	  	"taoke": true,
		"remark": "請注意,該訂單為淘客訂單",
		"hasNextPage": "1",
		"orders": []
	}
}