We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 版本:7.0 overtrue/wechat 版本:3.3.20 是否使用了框架?框架名称:XFramework
公众号支付(JSAPI)沙箱模式的Notify总是提示:“Invalid request payloads.”,然而正式模式却一切正常。
发起支付:
$app = $this->getEasyWechatApp(); $payment = $app->payment; $payment->sandboxMode($this->FConfig->GetBoolean('Application.Wechat.payment.sandbox_mode')); //如果是false一切正常,true则失败 try { $attributes = [ 'trade_type' => 'JSAPI', 'body' => '****', 'detail' => TUuid::ToString($mOrderId, ''), 'out_trade_no' => TUuid::ToString($mOrderId, ''), 'total_fee' => 1, //$mTotalFee, //如果是沙箱模式,我这里写的是101,对应微信的测试的case 'openid' => $this->getWechatOpenId(), ]; $order = new Order($attributes); $result = $payment->prepare($order); if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') { $prepayId = $result['prepay_id']; $config = $payment->configForJSSDKPayment($prepayId); } } catch (EInvalidParameter $e) { //NOP } return $config;
NotifyHandler:
try { $mModel = new TOrderModel($this->FConfig, ''); $payment = $this->getEasyWechatApp()->payment; $payment->sandboxMode($this->FConfig->GetBoolean('Application.Wechat.payment.sandbox_mode')); $response = $payment->handleNotify(function ($notify, $successful) use ($mModel) { TLogger::LogVariable($notify); $order = $mModel->GetOrder(TUuid::FromString($notify['out_trade_no'])); if ($order === null) { return 'Order not exist.'; } if ($order->OrderStatus == TOrderStatus::ePaid()) { return true; } if ($successful) { $order->OrderStatus = TOrderStatus::ePaid(); TLogger::LogMessage('PAY SUCC'); TLogger::LogMessage($notify['total_fee']); } $mModel->UpdateOrderStatus($order->OrderId, $order->OrderStatus); return true; }); TLogger::LogMessage('response = '); TLogger::LogMessage($response->getContent()); $response->send(); } catch (\Exception $e) { TLogger::LogMessage($e->getMessage()); } finally { Framework::Free($mModel); }
The text was updated successfully, but these errors were encountered:
PR #1036
Sorry, something went wrong.
No branches or pull requests
我用的环境
PHP 版本:7.0
overtrue/wechat 版本:3.3.20
是否使用了框架?框架名称:XFramework
问题及现象
公众号支付(JSAPI)沙箱模式的Notify总是提示:“Invalid request payloads.”,然而正式模式却一切正常。
发起支付:
NotifyHandler:
The text was updated successfully, but these errors were encountered: