setMethod('POST'); $client->setHeaders([ 'Authorization' => 'Bearer ' . $apiKey, 'Content-Type' => 'application/json' ]); $data = [ 'to_country' => 'US', 'to_zip' => '92101', 'to_state' => 'CA', 'to_city' => '', 'to_street' => '', 'amount' => 99.99, 'shipping' => 5, 'line_items' => [ [ 'id' => 135, 'quantity' => 1, 'unit_price' => 99.99, 'discount' => 0, 'product_tax_code' => '20010' ] ] ]; $client->setRawBody(Json::encode($data)); try { $response = $client->send(); echo $response->getBody(); } catch (Exception $e) { // Log exception }