该接口可以检测淘宝订单号是否使用淘客下单,避免商家损失佣金
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;
}
}
4、接口返回结果
{
"code": 200,
"msg": "请求成功【success】",
"data": {
"taoke": true,
"remark": "请注意,该订单为淘客订单",
"hasNextPage": "1",
"orders": []
}
}