收藏
回答

特约商户进件接口,验签都通过了,但是返回 "解析 Json 出错" ?

验签通过了,这是body加密前:

{"business_info":{"merchant_shortname":"zhangsan","service_phone":"13691400000","sales_info":{"sales_scenes_type":["SALES_SCENES_STORE"]}},"business_code":"2020091513522509609071220","contact_info":{"contact_name":"zhangsan","mobile_phone":"13600000000","contact_email":"wxm@test.com","contact_id_number":"122123199110261350"},"subject_info":{"subject_type":"SUBJECT_TYPE_INDIVIDUAL","identity_info":{"owner":true,"id_doc_type":"IDENTIFICATION_TYPE_IDCARD","id_card_info":{"id_card_name":"saffsas","id_card_copy":"PqGLQL7VQgAb-yWQ05VozSlslCmEzZdyIHxZ0kBJ3_UpqTBUkSLIHzAmAQEXlZPshr9ZKaETBNPT-XebpyrYeMORCT1edHRQvPnxk1Y3K8Y","id_card_number":"456736178110251350","card_period_end":"2025-11-11T00:00:00+08:00","card_period_begin":"2015-11-11T00:00:00+08:00","id_card_national":"PqGLQL7VQgAb-yWQ05VozQv-98IMB_8uhgYIP3HrjJNEyXxGoW4Xhg6rAP-x7mEgj5dwCvf1AMV2gWA3tR206paN074zr30E7GB9Uc2P0zk"}},"business_license_info":{"license_number":"122435322342342","merchant_name":"ceshi","legal_person":"sfasdfs","license_copy":"PqGLQL7VQgAb-yWQ05VozXnJ_QvyWmrHMGnOwNEkVik5YHH7TAHXHsZQYc8egIkN5p3y5SP_7YGTAjckm8QqQuMGZZ4UDPvNNNAKuMlgxyM"}},"settlement_info":{"settlement_id":"719","qualification_type":"12121"}}

加密后:

SzEphs/MwbV/D8EH9oORV75nJw4JJdzjIxHOu9HtHTlTUlxxwX7a+Q/9ZUrbMQKFDzquUwa9hNQiBmeb1UU4AwOU5Udh/l5b76ItyxXrcDDu1uuri6tA7iv3RhVmhxdFdu2QBj/dcsUk99Fd5sDXDnUD0XdumonYnYOnFvlZydxf06X169pFo84vT19bM2uRJDsEeJtmIpk3zqjpGGQGOjGMDyPXhOp25sKOt9taDMt7qMx04UI1XwKQBZ8Enien66wBq8Zaaaa8pGXXdbvj+u6tTWvTGJgXvKjhTeWA3/u36cooE0Dj3UZDfq4yeC/A3/EhaKHdrSVbmGg5xL9Bkw==

返回headers:

'Request-ID': 'xbfkfw'

返回内容

{"code":"PARAM_ERROR","detail":{"location":null,"value":"SzEphs/MwbV/D8EH9oORV75nJw4JJdzjIxHOu9HtHTlTUlxxwX7a+Q/9ZUrbMQKFDzquUwa9hNQiBmeb1UU4AwOU5Udh/l5b76ItyxXrcDDu1uuri6tA7iv3RhVmhxdFdu2QBj/dcsUk99Fd5sDXDnUD0XdumonYnYOnFvlZydxf06X169pFo84vT19bM2uRJDsEeJtmIpk3zqjpGGQGOjGMDyPXhOp25sKOt9taDMt7qMx04UI1XwKQBZ8Enien66wBq8Zaaaa8pGXXdbvj+u6tTWvTGJgXvKjhTeWA3/u36cooE0Dj3UZDfq4yeC/A3/EhaKHdrSVbmGg5xL9Bkw=="},"message":"解析 Json 出错 (位置: /body): * Line 1, Column 1\n  Syntax error: value, object or array expected.\n"}

-----------------更新---------------------

在尝试把加密后的字符串用data包一层之后:

{"data": "SzEphs/MwbV/D8EH9oORV75nJw4JJdzjIxHOu9HtHTlTUlxxwX7a+Q/9ZUrbMQKFDzquUwa9hNQiBmeb1UU4AwOU5Udh/l5b76ItyxXrcDDu1uuri6tA7iv3RhVmhxdFdu2QBj/dcsUk99Fd5sDXDnUD0XdumonYnYOnFvlZydxf06X169pFo84vT19bM2uRJDsEeJtmIpk3zqjpGGQGOjGMDyPXhOp25sKOt9taDMt7qMx04UI1XwKQBZ8Enien66wBq8Zaaaa8pGXXdbvj+u6tTWvTGJgXvKjhTeWA3/u36cooE0Dj3UZDfq4yeC/A3/EhaKHdrSVbmGg5xL9Bkw=="}

解析成功,但是返回:

{"code":"PARAM_ERROR","detail":{"location":"body","value":""},"message":"输入源“/body/business_code”映射到字段“业务申请编号 ”必填性规则校验失败,此字段为必填项"}

但是加密前的对象里是有 business_code 的


--------更新----------------

知道了,原来是部分值需要加密,而不是把整个data加密

最后一次编辑于  11-05
回答关注问题邀请回答
收藏

2 个回答

  • XueMin
    XueMin
    11-04

    看了下文档,可能是日期时间格式

    日期格式

    所有的日期对象,使用ISO 8601所定义的格式。示例:


    yyyy-MM-DDTHH:mm:ss.SSSZ
    yyyy-MM-DDTHH:mm:ssZ
    yyyy-MM-DDTHH:mm:ss.SSS+08:00
    yyyy-MM-DDTHH:mm:ss+08:00
    


    11-04
    有用
    回复 1
    • XueMin
      XueMin
      11-04
      日期重新格式化了,还是不行,如下:
      11-04
      回复
  • 北望沣渭
    北望沣渭
    11-03

    php json_encode的时候,给添加上 `JSON_UNESCAPED_UNICODE`选项试试。

    11-03
    有用
    回复 1
    • XueMin
      XueMin
      11-04
      谢谢提醒,我这边是python,我试下json.dumps(d, ensure_ascii=False, encoding='utf-8'))
      不过其它接口我都调通了,除了这个接口是敏感信息要加密才没通。看报错就像是没解密就直接json解析了
      11-04
      回复
登录 后发表内容
问题标签