问题 USPS:API授权失败


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

9281
2018-04-02 01:38


起源

为什么你认为RateV4应该有效? - stark
noPCommerce论坛 表明测试服务尚未更新为RateV4;虽然这个帖子很古老。您可以通过致电USPS客户代表并要求澄清来获得最佳服务。 - sarnold
我试过v3和v2,他们产生了同样的问题。 v2已禁用,因此它不再起作用。 - Sarmen B.


答案:


我在测试Ratev4(以及用于国际货运的v2)方面遇到了同样的问题。只是要求他们将您带到生产中,这很容易,但请确保您使用正确的URL。 除此之外,根据我的理解,你的设置无论如何都不会起作用,因为你要求的是头等舱的费率,重量是1磅。头等舱只能达到13盎司......


1
2017-11-16 23:41





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


5
2018-06-27 20:56



要执行此操作,只需发送电子邮件至 uspstechnicalsupport@mailps.custhelp.com  随着消息 Please move User ID xxxxxx to the production server - random65537


我假设您已在此处注册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帐户。

这就是为什么您在生成的运输标签上收到此文本 - “Sample Do Not Mail”。

您可以在此处设置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 Internet客户服务中心(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服务器。


5
2018-01-16 06:58