'How to generate signature for shopee v2
I have a problem with generate signature for shopee, what is funny this works for /api/v2/auth/token/get method but all other methods gives my error "Wrong sign"
$timestamp = time();
$partner_id = 123;
$shop_id = 123;
$secret_key = "xyz";
$path = "/api/v2/shop/get_shop_info";
$sign = hash_hmac('sha256', utf8_encode($partner_id . $path . $timestamp), $secret_key);
$url = [
'access_token' => $tocken,
'partner_id' => $partner_id,
'shop_id' => $shop_id,
'sign' => $sign,
'timestamp' => $timestamp,
];
$curl = curl_init('https://partner.test-stable.shopeemobile.com' . $path . '?' . http_build_query($url));
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
var_dump(json_decode($response));
Any idea what is wrong with this ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
