我很难将卖家帐户连接到lazada开放平台我将回拨添加到我的网站/回拨URL
$c = new LazopClient($this->LazURL, $this->appKey, $this->appSecret);
$request = new LazopRequest('/auth/token/create');
$request->addApiParam('code',$code);
dd($c->execute($request));
它返回到mywebsite/callbackurl?代码=xxxxxx,带有错误ISP";无效的授权码";
"{"代码":"无效代码","类型":"ISP","消息":"授权代码无效","请求id":"21223b821626709993104138"};
希望有人能在问题上帮助我
谢谢
线程很旧,但我希望这能在某种程度上有所帮助。我追了Lazada的人将近一个月,让API为获得转换而工作。他们的OPEN SDK根本不起作用。因此,您需要使用API调用方法从缺勤帐户获取数据。下面是我用来从他们的Open API获取数据的完整PHP代码。
要获取凭据详细信息,请导航到Lazada缺勤帐户->集成->打开API
<?php
$app_id = LiteApp Key;
$secret = LiteApp Secret;
$user_token = User Token;
function hmac_sha256($data, $key){
return hash_hmac('sha256', $data, $key);
}
function msectime() {
list($msec, $sec) = explode(' ', microtime());
return $sec . '000';
}
$timeStamp = msectime();
function generateSign($apiName,$params,$secret)
{
ksort($params);
$stringToBeSigned = '';
$stringToBeSigned .= $apiName;
foreach ($params as $k => $v)
{
$stringToBeSigned .= "$k$v";
}
unset($k, $v);
return strtoupper(hmac_sha256($stringToBeSigned,$secret));
}
$options = array(
'app_key' => $app_id,
'timestamp' => $timeStamp,
'sign_method' =>'sha256',
'userToken'=> $user_token,
'dateStart'=> '2021-11-01',
'dateEnd'=> '2021-11-15',
'offerId'=> OFFER ID, #You can get this from conversion report.
'limit' => 10,
'page' => 1,
);
$signature = generateSign('/marketing/conversion/report',$options,$secret);
$url = "https://api.lazada.co.th/rest/marketing/conversion/report";
#List of available endpoint - https://open.lazada.com/doc/doc.htm?spm=affiliate.home.0.0.5b81623b6bdk7G#?docId=108065&nodeId=10443
$i=0;
foreach ($options as $key => $value)
{
if($i == 0){
$url .= "?" ."$key=" . urlencode($value);
}else{
$url .= "&" ."$key=" . urlencode($value);
}
$i++;
}
$url.= '&sign='.$signature;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
尝试使用Lazada npm包Lazada开放平台sdk
检查$this->使用的值;LazURL
您可能正在使用特定于国家/地区的api端点,如api.lazada.sg,但是对于/auth-api,您必须使用全局api.lazada.com端点。