收藏
回答

服务商-完结分账APIv3,"message":"输入源“/sub_mchid”映射到字段“电商 ?

请求json数据为

{"sub_mchid":"1612109959","transaction_id":"4200001149202107231780667646","out_trade_no":"P202107230001","description":"分账完结"}


请求代码

$resp = $instance->chain('v3/ecommerce/profitsharing/finish-order')->post([
    'json' => $bodyJson,
    'headers' => [
        "Content-type"=> "application/json",
    ]
]);
// echo $resp->getStatusCode() . ' ' . $resp->getReasonPhrase(), PHP_EOL;
echo $resp->getBody();


返回错误

Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://api.mch.weixin.qq.com/v3/ecommerce/profitsharing/finish-order` resulted in a `400 Bad Request` response:
{"code":"PARAM_ERROR","detail":{"location":null,"value":""},"message":"输入源“/sub_mchid”映射到字段“电商 (truncated...)
 in /www/wwwroot/test.sdrdcc.com/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /www/wwwroot/test.sdrdcc.com/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response), NULL, Array, NULL)
#1 /www/wwwroot/test.sdrdcc.com/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /www/wwwroot/test.sdrdcc.com/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 /www/wwwroot/test.sdrdcc.com/vendor/guzzlehttp/promises/src in /www/wwwroot/test.sdrdcc.com/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

回答关注问题邀请回答
收藏

1 个回答

  • 郑旭东
    郑旭东
    2021-07-23

    out_order_no 传了没有?

    2021-07-23
    有用
    回复 3
    • sentangle
      sentangle
      2021-07-23
      上面有请求的json数据,这个参数传递了!
      2021-07-23
      回复
    • 郑旭东
      郑旭东
      2021-07-24回复sentangle
      你传的是out_trade_no
      2021-07-24
      回复
    • sentangle
      sentangle
      2021-07-24
      谢谢提醒!
      2021-07-24
      回复
登录 后发表内容