function calcularFrete($cepDestino){ $data = [ "from" => ["postal_code" => "16000000"], // seu CEP "to" => ["postal_code" => $cepDestino], "package" => [ "height" => 4, "width" => 12, "length" => 18, "weight" => 0.3 ] ]; $ch = curl_init("https://sandbox.melhorenvio.com.br/api/v2/me/shipment/calculate"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => [ "Authorization: Bearer " . MELHOR_ENVIO_TOKEN, "Content-Type: application/json" ] ]); $response = json_decode(curl_exec($ch), true); curl_close($ch); return $response; }function criarPixAsaas($order){ $data = [ "customer" => null, "billingType" => "PIX", "value" => (float)$order['total'], "description" => "Pedido MTH #" . $order['id'] ]; $ch = curl_init(ASAAS_URL . "/payments"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => [ "Content-Type: application/json", "access_token: " . ASAAS_API_KEY ] ]); $response = json_decode(curl_exec($ch), true); curl_close($ch); return $response; }Produto inválido