0

我正在使用Shippo API尝试将我的费率/包裹设置为 USPS 优先级。根据文档,我觉得我需要添加/编辑$rate数组,但我似乎无法弄清楚。

// Select the rate you want to purchase.
// We simply select the first rate in this example.

// $rate = $shipment["rates_list"][0];
$rate = array(
    'object_state'          => 'VALID',
    'provider'              => 'USPS',
    'servicelevel_name'     => 'Priority Mail',
    'servicelevel_token'    => 'usps_priority'
    );

// Purchase the desired rate
$transaction = Shippo_Transaction::create(array(
    'rate'=> $rate["object_id"],
    //'rate' => $rate["usps_priority"],
    'async'=> false
));
4

1 回答 1

2

看起来我们的 InstaLabel 功能非常适合您https://goshippo.com/shipping-api/instalabel

该链接上有一个完整的 PHP 示例,但这是您指定的代码:

$transaction = Shippo_Transaction::create( array(
    'shipment' => $shipment,
    'carrier_account' => 'b741b99f95e841639b54272834bc478c',
    'servicelevel_token' => 'usps_priority',
);
);
于 2016-05-05T21:49:04.070 回答