我正在使用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
));
答案 0 :(得分:2)
看起来我们的InstaLabel功能非常适合https://goshippo.com/shipping-api/instalabel
该链接上有一个完整的PHP示例,但这里是您指定的代码:
$transaction = Shippo_Transaction::create( array(
'shipment' => $shipment,
'carrier_account' => 'b741b99f95e841639b54272834bc478c',
'servicelevel_token' => 'usps_priority',
);
);