李佳民 / ups-rates
一个简单的工具,用于返回UPS的运费。
v5.5.1
2022-06-07 15:57 UTC
Requires
- php: ^7.2
- illuminate/support: ^6.0
This package is auto-updated.
Last update: 2024-09-07 21:30:04 UTC
README
UPS Rates 描述
此包用于向UPS web服务发送运费报价请求。
使用Composer安装,编辑您的composer.json
文件以包含
"require": {
"sujanshresthanet/ups-rates": "1.*"
}
从命令行更新Composer
composer update
在您的app/config/app.php
文件中的providers
数组中添加一个新的服务提供者
'Shipment_ups\Ups\UpsServiceProvider'
在同一配置文件中,将类别名添加到aliases
数组
'Ups' => 'Shipment_ups\Ups\Facades\Ups'
示例
$return = Ups::getQuote(
array(
'access_key' => 'your key',
'username' => 'your username',
'password' => 'your password',
'account_number' => 'your account number',
),
array(
'from_zip' => '37902',
'from_state' => 'TN', // Optional, may yield a more accurate quote
'from_country' => 'US', // Optional, defaults to US
'to_zip' => '90210',
'to_state' => 'CA', // Optional, may yield a more accurate quote
'to_country' => 'US', // Optional, defaults to US
'packages' => 1,
'weight' => 50,
'measurement' => 'LBS', // Currently the UPS API will only allow LBS and KG, default is LBS
'negotiated_rates' => true // Optional, set true to return negotiated rates from UPS
)
);
返回值
Array
(
[03] => Array
(
[service] => UPS Ground
[rate] => 52.32
)
[12] => Array
(
[service] => UPS 3 Day Select
[rate] => 145.09
)
[02] => Array
(
[service] => UPS 2nd Day Air
[rate] => 235.40
)
[01] => Array
(
[service] => UPS Next Day Air
[rate] => 301.46
)
)