$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.yukoapp.com/api/v1/public/points/estimate");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"customer" => [
"id" => "cus_847362",
"email" => "rahul.sharma@example.com",
],
"items" => [
[
"product_id" => "prod_1001",
"variant_id" => "var_1001_red_m",
],
[
"product_id" => "prod_2044",
"variant_id" => "var_2044_black_42",
],
],
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type: application/json",
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);