Skip to content
New issue

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

微信支付回调验证 INVALID_ARGUMENT: Convert To Array Error! Invalid Xml! #310

Closed
binxyz opened this issue Dec 10, 2019 · 3 comments
Closed

Comments

@binxyz
Copy link

binxyz commented Dec 10, 2019

包版本号

v2.8.6

问题描述

微信支付回调验证 报错 INVALID_ARGUMENT: Convert To Array Error! Invalid Xml!

你的代码

public function notify()
{
$result = Pay::wechat()->verify();
$attach = json_decode($result->attach, true);
$params = [
'user_id' => $attach['user_id'],
'out_trade_no' => $attach['order_no'],
'payment_flow_id' => $attach['payment_flow_id'],
'money' => bcdiv($result->cash_fee, 100, 2),
'transaction_id' => $result->transaction_id,
];
Log::info('微信支付回调参数'.json_encode($params));

    $payment = PaymentFlow::find($params['payment_flow_id']);
    $order = Order::where('no', $payment->order_no)->first();
    $result = $this->finance->wechatCallback($params, $payment, $order);
    if ($result) {
        $this->successOrder($order);
    }
    Log::info('微信支付回调service出口');
    return Pay::wechat()->success();
}

报错详情

[2019-12-10 20:31:57] local.ERROR: INVALID_ARGUMENT: Convert To Array Error! Invalid Xml! {"exception":"[object] (Yansongda\Pay\Exceptions\InvalidArgumentException(code: 3): INVALID_ARGUMENT: Convert To Array Error! Invalid Xml! at /sites/testing/pin-backend/vendor/yansongda/pay/src/Gateways/Wechat/Support.php:326)
[stacktrace]
#0 /sites/testing/pin-backend/vendor/yansongda/pay/src/Gateways/Wechat.php(178): Yansongda\Pay\Gateways\Wechat\Support::fromXml('')
#1 /sites/testing/pin-backend/app/Http/Controllers/Front/PayController.php(27): Yansongda\Pay\Gateways\Wechat->verify()
#2 [internal function]: App\Http\Controllers\Front\PayController->notify()
#3 /sites/testing/pin-backend/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#4 /sites/testing/pin-backend/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('notify', Array)
#5 /sites/testing/pin-backend/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\Front\PayController), 'notify')
#6 /sites/testing/pin-backend/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\Routing\Route->runController()
#7 /sites/testing/pin-backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php(680): Illuminate\Routing\Route->run()
#8 /sites/testing/pin-backend/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Dingo\Api\Http\Request))
#9 /sites/testing/pin

sdk 日志

2019-12-10 14:08:39 > yansongda.pay.INFO > Received Wechat Request [""]

nginx/apache 日志

涉及到 异步通知、同步通知 的问题,请贴出来
image

@binxyz
Copy link
Author

binxyz commented Dec 10, 2019

    • [10/Dec/2019:21:03:37 +0800] "POST /api/notify HTTP/1.0" 200 96 "-" "Mozilla/4.0" "58.251.80.51"
    • [10/Dec/2019:21:03:39 +0800] "POST /api/notify HTTP/1.0" 500 95 "http://t.hwache.cn/sureOrder/7972f32c-5df2-4e61-be0e-7049f4c0d7f2" "Mozilla/5.0 (Linux; Android 7.1.1; OPPO A83 Build/N6F26Q; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045008 Mobile Safari/537.36 MMWEBID/9289 MicroMessenger/7.0.9.1560(0x27000934) Process/tools NetType/4G Language/zh_CN ABI/arm64" "49.94.36.167"

@binxyz
Copy link
Author

binxyz commented Dec 12, 2019

项目是laravel 5.8的 告诉微信成功回调return Pay::wechat()->success(); 这样写不行, 要写全return Pay::wechat()->success()->send();

@binxyz binxyz closed this as completed Dec 12, 2019
@fishbigbig
Copy link

也遇到了,重新安装 composer require yansongda/pay:~2 用这个版本的 不要用指定的版本
解决问题 。。。。我是laravel8 php7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants