Skip to content

报关

该接口用于商户提交海关需要的订单附加信息。

请求参数类型描述
base_uristring声明接入点https://apihk.mch.weixin.qq.com/global/(香港接入)
jsonobject声明请求的JSON数据结构
appidstring机构APPID
mchidstring商户号
out_trade_nostring商户订单号
transaction_idstring微信订单号
customsstring海关
merchant_customs_nostring商户海关备案号
dutyinteger关税
sub_order_nostring商户子订单号
fee_typestring货币类型
order_feeinteger子订单金额
transport_feeinteger物流费用
product_feeinteger商品费用
php
$instance->v3->customs->orders->postAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'sub_order_no'        => '20150806125346',
    'fee_type'            => 'CNY',
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/customs/orders')->postAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'sub_order_no'        => '20150806125346',
    'fee_type'            => 'CNY',
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/customs/orders']->postAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'sub_order_no'        => '20150806125346',
    'fee_type'            => 'CNY',
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->customs->orders->post([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'sub_order_no'        => '20150806125346',
    'fee_type'            => 'CNY',
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/customs/orders')->post([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'sub_order_no'        => '20150806125346',
    'fee_type'            => 'CNY',
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/customs/orders']->post([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'sub_order_no'        => '20150806125346',
    'fee_type'            => 'CNY',
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
appidstring机构APPID
mchidstring商户号
statestring报关状态
out_trade_nostring商户订单号
transaction_idstring微信订单号
sub_order_nostring商户子订单号
sub_order_idstring微信子订单号
verify_departmentstring核验机构
verify_department_trade_idstring核验机构交易流水号

参阅 官方文档

报关查询

商户通过订单号查询提交的订单附加信息及订单报关状态。

请求参数类型描述
base_uristring声明接入点https://apihk.mch.weixin.qq.com/global/(香港接入)
queryobject声明请求的查询参数
appidstring机构APPID
mchidstring商户号
order_typestring订单类型
out_trade_no | transaction_id | sub_order_no | sub_order_id 枚举值之一
order_nostring订单号
customsstring海关
offsetinteger偏移量
limitinteger请求最大记录条数
php
$instance->v3->customs->orders->getAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'query' => [
    'appid'      => 'wxd678efh567hg6787',
    'mchid'      => '1230000109',
    'order_type' => 'out_trade_no',
    'order_no'   => '20150806125346',
    'customs'    => 'SHANGHAI_ZS',
    'offset'     => 1,
    'limit'      => 20,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/customs/orders')->getAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'query' => [
    'appid'      => 'wxd678efh567hg6787',
    'mchid'      => '1230000109',
    'order_type' => 'out_trade_no',
    'order_no'   => '20150806125346',
    'customs'    => 'SHANGHAI_ZS',
    'offset'     => 1,
    'limit'      => 20,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/customs/orders']->getAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'query' => [
    'appid'      => 'wxd678efh567hg6787',
    'mchid'      => '1230000109',
    'order_type' => 'out_trade_no',
    'order_no'   => '20150806125346',
    'customs'    => 'SHANGHAI_ZS',
    'offset'     => 1,
    'limit'      => 20,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->customs->orders->get([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'query' => [
    'appid'      => 'wxd678efh567hg6787',
    'mchid'      => '1230000109',
    'order_type' => 'out_trade_no',
    'order_no'   => '20150806125346',
    'customs'    => 'SHANGHAI_ZS',
    'offset'     => 1,
    'limit'      => 20,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/customs/orders')->get([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'query' => [
    'appid'      => 'wxd678efh567hg6787',
    'mchid'      => '1230000109',
    'order_type' => 'out_trade_no',
    'order_no'   => '20150806125346',
    'customs'    => 'SHANGHAI_ZS',
    'offset'     => 1,
    'limit'      => 20,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/customs/orders']->get([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'query' => [
    'appid'      => 'wxd678efh567hg6787',
    'mchid'      => '1230000109',
    'order_type' => 'out_trade_no',
    'order_no'   => '20150806125346',
    'customs'    => 'SHANGHAI_ZS',
    'offset'     => 1,
    'limit'      => 20,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
appidstring机构APPID
mchidstring商户号
transaction_idstring微信订单号
verify_departmentstring核验机构
verify_department_trade_idstring核验机构流水号
offsetinteger偏移量
limitinteger请求最大记录条数
total_countinteger查询结果总条数
dataobject[]报关数据包
sub_order_nostring商户子单号
sub_order_idstring微信子单号
mch_customs_nostring商户海关备案号
customsstring海关代码
fee_typestring币种
order_feeinteger子单金额
dutyinteger关税
transport_feeinteger物流费用
product_feeinteger商品费用
statestring报关状态
explanationstring报关结果说明
modify_timestring最后更新时间

参阅 官方文档

报关信息修改

该接口用于商户修改订单附加信息。

请求参数类型描述
base_uristring声明接入点https://apihk.mch.weixin.qq.com/global/(香港接入)
jsonobject声明请求的JSON数据结构
appidstring机构APPID
mchidstring商户号
out_trade_nostring商户订单号
transaction_idstring微信订单号
sub_order_nostring商户子订单号
customsstring海关编码
merchant_customs_nostring商户海关备案号
dutyinteger关税
order_feeinteger子订单金额
transport_feeinteger物流费用
product_feeinteger商品费用
php
$instance->v3->customs->orders->patchAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'sub_order_no'        => '20150806125346',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/customs/orders')->patchAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'sub_order_no'        => '20150806125346',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/customs/orders']->patchAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'sub_order_no'        => '20150806125346',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->customs->orders->patch([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'sub_order_no'        => '20150806125346',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/customs/orders')->patch([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'sub_order_no'        => '20150806125346',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/customs/orders']->patch([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/global/', // 接入点(香港接入)
  'json' => [
    'appid'               => 'wxd678efh567hg6787',
    'mchid'               => '1230000109',
    'out_trade_no'        => '20150806125346',
    'transaction_id'      => '1000320306201511078440737890',
    'sub_order_no'        => '20150806125346',
    'customs'             => 'SHANGHAI_ZS',
    'merchant_customs_no' => '123456',
    'duty'                => 888,
    'order_fee'           => 888,
    'transport_fee'       => 888,
    'product_fee'         => 888,
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
appidstring机构APPID
mchidstring商户号
statestring报关状态
out_trade_nostring商户订单号
transaction_idstring微信订单号
sub_order_nostring商户子订单号
sub_order_idstring微信子订单号
modify_timestring最后更新时间
verify_departmentstring核验机构
verify_department_trade_idstring核验机构流水号

参阅 官方文档

Published on the GitHub by TheNorthMemory