My situation is
- using Laravel 7
- want to use Shopee API
Sending a request in Laravel should be like this
$res = Http::withHeaders([
'Content-Type' => 'application/json',
'Authorization' => $secret_key
])->post($api_url, [
"ordersn_list" => [$order_no],
"shopid" => $shop_id,
"partner_id" => $partner_id,
"timestamp" => $timestamp
]);
But Shopee API needs no space in the body part (cannot send as JSON format). I have tried
$res = Http::withHeaders([
'Content-Type' => 'application/json',
'Authorization' => $secret_key
])->post($api_url, $body_string);
It does not work because it must be an array. return error Argument 2 passed to Illuminate\Http\Client\PendingRequest::post() must be of the type array, string given
.