11

为什么该费率不适用于 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>";
4

3 回答 3

8

我假设您已经在此处注册了 USPS Web Tools:

https://secure.shippingapis.com/registration/

并已收到 USPS 确认您的帐户处于活动状态:

如果您需要设置 USPS 或您的客户在结账时收到此错误(见下文),您应确认以下内容

Confirm that our USPS API access is approved

Confirm that it is not in test mode and is in production mode
    If USPS says your account is active, this does not mean it is in production mode, - you need to call USPS and specifically request that it be moved to production mode after your account has been approved. A good idea is to perform this quick test:

使用您自己的 USERID 将以下内容插入浏览器,代替任何浏览器 URL 中的 XXXX:

https://secure.shippingapis.com/ShippingAPITest.dll?API=CarrierPick ... USERID="XXXX">ABC Corp.Suite 7771390 Market StreetHoustonTX770581234

如果您的 USPS 帐户处于活动状态,它应该接受用户名。

Confirm that your username and password is for this site only. USPS only allows 1 domain per account.

http://production.shippingapis.com/ShippingAPI.dll

问题是默认情况下,您无权访问 USPS 的生产 API。他们必须先批准你。请记住,它们只允许您在每个帐户的一个网站上使用它,因此如果您为客户、客户或您自己以外的其他商业实体设置 Magento,您应该为他们设置一个单独的 USPS 帐户.

这就是您在生成的运输标签上收到此文本的原因 - “请勿邮寄样品”。

您可以在此处设置您的 USPS WebTools 帐户:

http://www.usps.com/webtools/

设置帐户后,他们将允许您访问测试环境。USPS 测试 API 的 URL 是:http ://testing.shippingapis.com/ShippingAPITest.dll

我建议要求 USPS 打开生产模式。当 USPS 批准您使用生产 API 时,您应该使用以下 URL:

http://production.shippingapis.com/ShippingAPI.dll

https://secure.shippingapis.com/ShippingAPI.dll

完成测试后,请向 USPS 互联网客户服务中心 (ICCC) 发送电子邮件。他们将切换您的个人资料以允许您访问生产服务器,并将为您提供生产 URL。

ICCC 的工作人员如下: 东部时间周一至周五上午 8:00 至晚上 8:30 东部时间周六上午 8:00 至下午 6:00 周日和邮政节假日 - 除以下节假日外关闭:马丁路德金;总统日; 哥伦布日; 和退伍军人节,时间为东部时间上午 9:00 至下午 6:00

电子邮件:uspstechsupport@esecurecare.net 电话:1-800-344-7779

但请记住,为每个网站(或每个域至少一个)设置一个单独的 USPS 帐户非常重要。如果您被发现在多个网站上使用您的帐户,USPS 将禁止您访问他们的生产服务器。

要请求访问 USPS 生产 API,请在此处填写表格:http ://www.usps.com/webtools/webtoolsapirequestform.htm

USPS 不允许您使用他们的 API 进行批处理或数据清理,因此请务必不要选中申请表上的这些框。

一旦 USPS 允许您访问他们的生产 API 服务器,一切都应该与所有 USPS 运输选项相对应。如果您仍然遇到问题,请再次检查您是否有权访问 USPS 的生产 API 服务器。

于 2015-01-16T06:58:04.217 回答
5

我有同样的问题。RateV4 对 USPS 的测试服务器无效,只能用于生产。我联系了他们的支持人员并试图获得一个有效的 API 进行测试,但他们发送的只是他们文档的链接(其中仅包含生产 API,不包含测试)。最后,我只是要求他们将我的帐户转移到生产环境中,他们做到了。

于 2012-06-27T20:56:39.317 回答
1

我在测试 Ratev4(和用于国际货运的 v2)东西时遇到了同样的问题。只需要求他们将您转移到生产环境即可轻松解决,但请确保您使用正确的网址。除此之外,据我了解,您的设置无论如何都行不通,因为您要的是头等舱的费率,而重量是 1 磅。头等舱最多只有 13 盎司...

于 2012-11-16T23:41:02.793 回答