查询报关接口

通过 customs 对象的 id 查询一个已创建的 customs 对象。通过查询接口确认报关的状态。

请求参数描述
CUSTOMS_ID required string报关对象 id,该参数仅需要填写在请求地址内。

返回

返回一个已存在的 customs 对象或者一个错误,详见 错误

定义

GET https://api.pingxx.com/v1/customs/{CUSTOMS_ID}
$cus = \Pingpp\Customs::retrieve($id);
Customs.retrieve(id)
Pingpp::Customs.retrieve(customs_id)
此语言 SDK 暂不支持该接口。
pingpp.Customs.retrieve()
customs, err := customs.Get("cus_id")
Customs.Retrieve(cu.Id)

请求示例

curl https://api.pingxx.com/v1/customs/14201607013878045463 \
-H "Pingplusplus-Signature: SIGNATURE" \
-u sk_live_ibbTe5jLGCi5rzfH4OqPW9KC: \
try {
    $cus = \Pingpp\Customs::retrieve('14201609281040220109');           // 报关对象id ,由 Ping++ 生成
    echo $cus;                                                         // 输出 Ping++ 返回的 custom 对象信息
} catch (\Pingpp\Error\Base $e) {
    if ($e->getHttpStatus() != null) {
        header('Status: ' . $e->getHttpStatus());
        echo $e->getHttpBody();
    } else {
        echo $e->getMessage();
    }
}
public Customs retrieve(String id) {
        Customs obj = null;
        try {
            obj = Customs.retrieve(id);
            System.out.println(obj);
        } catch (PingppException e) {
            e.printStackTrace();
        }
        return obj;
}
customs_id = customs['id']
## 查询
customs = Pingpp::Customs.retrieve(customs_id)
puts customs
此语言 SDK 暂不支持该接口。
try:
    customs_info = pingpp.Customs.retrieve("14201607013878045463")
    print customs_info
except Exception as e:
    print e.http_body
func ExampleCustoms_get() {
  customs, err := customs.Get("cus_id")
  if err != nil {
    log.Fatal(err)
    return
  }
  content, _ := json.Marshal(customs)
  fmt.Println(string(content))
}
public static void Example(string appId, string chId)
{
    var cuParams = new Dictionary<string, object>
    {
        {"app", appId},
        {"charge", chId},
        {"channel", "upacp_pc"},
        {"trade_no", new Random().Next(1, 999999999).ToString()},
        {"customs_code", "GUANGZHOU"},
        {"amount", 1},
        {"is_split", true},
        {"sub_order_no", new Random().Next(1, 999999).ToString()},
        {"extra", new Dictionary<string, object>{
            {"pay_account", "123456"},
            {"certif_type", "02"},
            {"customer_name", "customer name"},
            {"certif_id", "62148502"},
            {"tax_amount", 10}
        }}
    };

    Console.WriteLine("****发起海关报关请求****");
    var cu = Customs.Create(cuParams);
    Console.WriteLine(cu);
    Console.WriteLine();


    Console.WriteLine("****查询海关报关对象****");
    Console.WriteLine(Customs.Retrieve(cu.Id));
    Console.WriteLine();
}

返回示例

报关成功:
{
    "id": "14201607013878045463",
    "object": "customs",
    "app": "app_LibTW1n1SOq9Pin1",
    "charge_id": "ch_L8qn10mLmr1GS8e5OODmHaL4",
    "channel": "alipay",
    "trade_no": "15112496832609",
    "customs_code": "GUANGZHOU",
    "amount": 100,
    "status": "succeeded",
    "created": 1410834527,
    "time_succeeded": 1410838127,
    "failure_code": null,
    "failure_msg": null,
    "transaction_no": "201609061456194799218",
    "extra":{}
}
报关失败:
{
    "id": "14201607013878045463",
    "object": "customs",
    "app": "app_LibTW1n1SOq9Pin1",
    "charge_id": "ch_L8qn10mLmr1GS8e5OODmHaL4",
    "channel": "alipay",
    "trade_no": "15112496832609",
    "customs_code": "GUANGZHOU",
    "amount": 100,
    "status": "failed",
    "created": 1410834527,
    "failure_msg": "报关失败",
    "transaction_no": null,
    "extra":{}
}