【发布时间】:2012-04-02 01:38:38
【问题描述】:
为什么 USPS 无法使用该费率?我正在使用 ratev4,但出现错误:
错误:
API Authorization failure. RateV4 is not a valid API name for this protocol.
UspsCom::DoAuth
这是我的代码:
<?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>";
【问题讨论】:
-
你为什么认为 RateV4 应该是有效的?
-
The noPCommerce Forums 提示测试服务没有升级到RateV4;虽然那个帖子很古老。最好致电您的 USPS 客户代表并要求澄清。
-
我已经尝试过 v3 和 v2 并且它们产生了同样的问题。 v2 被禁用,所以它不再工作了。