中医讲课,听课后发红包。頁面上是給了,可刮不了微信,这是什么原因
预支付接口回文:输入源“/appid”映射到字段“公众号I (truncated...)是什么原因?在调用“JSAPI下单”接口/v3/pay/transactions/jsapi 时响应内容里提示:“输入源“/appid”映射到字段“公众号I (truncated...)” 我确认我填写的appid是小程序的不是公众号的,使用的是官方的wechatpay-apiv3/wechatpay-php sdk,核心代码如下: // 获取预支付id public static function orderInfo($p){ $url = 'https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi'; // $url = '/v3/pay/transactions/jsapi'; $appId = Config::WxAppId; $mchId = Config::WxMchId; $mchName = Config::WxMchName; $serial_no = Config::WxPayCartNo; $orderNo = dechex(time()) . rand(1000, 9999); $notify_url = Config::Host . Config::BasePath . '/wechat/payNotify'; $score = $p['score']; $openId = '我自己的openid'; // 从本地文件中加载「商户API私钥」,「商户API私钥」会用来生成请求的签名 $merchantPrivateKey = file_get_contents(SS_PLUGIN_APP_DIR.'/certs/apiclient_key.pem'); $merchantPrivateKeyInstance = Rsa::from($merchantPrivateKey, Rsa::KEY_TYPE_PRIVATE); // 从本地文件中加载「微信支付平台证书」,用来验证微信支付应答的签名 $platformCertificate = file_get_contents(SS_PLUGIN_APP_DIR.'/certs/apiclient_cert.pem'); $platformPublicKeyInstance = Rsa::from($platformCertificate, Rsa::KEY_TYPE_PUBLIC); // 从「微信支付平台证书」中获取「证书序列号」 $platformCertificateSerial = PemUtil::parseCertificateSerialNo($platformCertificate); // 构造一个 APIv3 客户端实例 $instance = Builder::factory([ 'mchid' => $mchId, 'serial' => $serial_no, 'privateKey' => $merchantPrivateKeyInstance, 'certs' => [ $platformCertificateSerial => $platformPublicKeyInstance, ], ]); $data = array( "appid" => $appId, "mchid" => $mchId, "description" => "$mchName-积分充值-$score", "out_trade_no" => $orderNo, "time_expire" => time() + 600, "attach" => "自定义数据说明", "notify_url" => $notify_url, "amount" => array( "total" => $p['price'], "currency" => "CNY" ), "payer" => array( "openid" => $openId ) ); try{ $rep = $instance->chain($url)->post($data)->getBody(); return json_decode($rep); }catch(Exception $e){ $code = $e->getCode(); return array('code' => $code, 'rep' => $e->getMessage(), 'req' => $data); } } // $e->getMessage(): 'Client error: `POST https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi` resulted in a `400 Bad Request` response:\n{"code":"PARAM_ERROR","detail":{"location":null,"value":""},"message":"输入源“/appid”映射到字段“公众号I (truncated...)\n' [图片] [图片]
06-03