Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I working in connecting our system in Lazada and need to retrieve items. this is my code.

What I have tried:

<pre>$region = "https://api.lazada.com.ph/rest";
    $getproductitem = "/products/get";
    $app_key = 110150;
    $date = new DateTime();
    $timestamp = 1656029861000;
    $access_token = "token***";
    $app_secret = "secret***";
    $sign_method="sha256";
    $base_str = $getproductitem.'access_token'.$access_token.'app_key'.$app_key.'sign_method'.$sign_method.'timestamp'.$timestamp; 
    $sign = hash_hmac('sha256', $base_str, $app_secret, false);
    //$sign = hex(sha256($getproductitem.'access_token'.$access_token.'app_key'.$app_key.'sign_method'.$sign_method.'timestamp'.$timestamp));

    //return $uri = "https://api.lazada.com.ph/rest/products/get?app_key=$app_key&access_token=$access_token&sign_method=$sign_method×tamp=$timestamp&sign=$sign";
    
    $response = Http::get($region.$getproductitem,  [
        "app_key" => $app_key,
        "access_token" => $access_token,
        "sign_method" => $sign_method,
        "timestamp" =>  $timestamp,
        "sign" => $sign,
     ]); 

     return $response->json();
but the return is this.

{ "type": "ISV", "code": "IncompleteSignature", "message": "The request signature does not conform to platform standards", "request_id": "212a721616560299294283218" }

I follow the instruction according to their documentation about setting of sign still i got error. thanks for help.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900