请求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
out_order_no 传了没有?