Why won’t the rate work with USPS? I’m using ratev4 and I get an error:
Error:
API Authorization failure. RateV4 is not a valid API name for this protocol.
UspsCom::DoAuth
Here is my code:
<?php
$devurl = "testing.shippingapis.com/ShippingAPITest.dll";
$puburl = "https://secure.shippingapis.com/ShippingAPITest.dll";
$service = "RateV4";
$userid = "690DEVBL1739";
$xml = rawurlencode('<RateV4Request USERID="xxxxx">
<Revision/>
<Package ID="1ST">
<Service>FIRST CLASS</Service>
<FirstClassMailType>LETTER</FirstClassMailType>
<ZipOrigination>44106</ZipOrigination>
<ZipDestination>20770</ZipDestination>
<Pounds>1</Pounds>
<Ounces>0.0</Ounces>
<Container/>
<Size>REGULAR</Size>
<Machinable>true</Machinable>
</Package>
</RateV4Request>');
$request = $devurl . "?API=" . $service . "&xml=" . $xml;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo "<pre>";
print_r($response);
echo "</pre>";
I’ve had the same issues with testing Ratev4 (and v2 for intl shipments) stuff. Just asking them to move you to production fixed that easily , but make sure you use the right urls of course.
Other than that, from what I understand your setup wouldn’t work anyway, because you’re asking for a rate for first class and the weight is 1 pound. First class only goes up to 13 ounce…