按照更新时间段增量同步推广订单信息
1、注册订单侠开放平台账号
注册地址: https://www.dingdanxia.com/user/register/index.html
2、获取接口秘钥apikey
登录个人中心 - 系统设置 - 接口管理 找到接秘钥apikey,apikey 接口秘钥是调用接口的唯一凭证,请妥善保管!
3、授权拼多多账号
登录个人中心 - 授权管理 - 拼多多授权, 授权自己的拼多多账号。
4、PHP代码调用示例
<?php
// +----------------------------------------------------------------------
// | 订单侠开放平台 www.dingdanxia.com [ 专为淘客开发者提供一站式API解决方案 ]
// +----------------------------------------------------------------------
//接口秘钥
$apikey = '这里填写你的apikey';
//拼多多订单查询接口
$apiurl = "http://api.tbk.dingdanxia.com/pdd/orderlist";
//开始调用
$result = curl_post($apiurl, array(
//接口秘钥
"apikey" => $apikey,
"start_update_time" =>"1587776407",
//最近24小时内多多进宝商品订单更新时间--查询时间结束
"end_update_time"=>"1587779867",
//最近24小时内多多进宝商品订单更新时间--查询时间开始
));
//打印结果
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;
}
}
5、接口返回结果
{
"code": 200,
"msg": "请求成功【success】",
"total_results": 1,
"data": [{
"match_channel": -1,
"goods_price": 1280,
"promotion_rate": 100,
"type": 0,
"order_status": 4,
"order_create_time": 1587779788,
"order_settle_time": 1587780120,
"order_verify_time": null,
"order_group_success_time": 1587779799,
"order_amount": 1280,
"order_modify_at": 1587780120,
"auth_duo_id": 8516041,
"cpa_new": 0,
"goods_name": "美粮坊手抓饼50片-20片早餐灌煎饼面饼皮原味手抓饼批发家庭装",
"batch_no": "",
"goods_quantity": 1,
"goods_id": 177891541,
"goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2019-06-10/f5df7b940e11e653631e5532f2e17d2c.jpeg",
"order_receive_time": null,
"custom_parameters": "1234",
"promotion_amount": 128,
"order_pay_time": 1587779799,
"group_id": 1106485232476830800,
"duo_coupon_amount": 1,
"scene_at_market_fee": 0,
"order_status_desc": "审核失败",
"fail_reason": "审核失败原因:订单发生退款",
"order_id": "43ynqdW2p2JeU+n6cXX9pg==",
"order_sn": "200425-485232476830887",
"p_id": "8735184_70977074",
"zs_duo_id": 0
}]
}
接口文档:https://www.dingdanxia.com/doc/70/86
在线测试:https://www.dingdanxia.com/apitest/70/86