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

微信支付下单错误 #376

Closed
pavlelee opened this issue Apr 1, 2016 · 28 comments
Closed

微信支付下单错误 #376

pavlelee opened this issue Apr 1, 2016 · 28 comments

Comments

@pavlelee
Copy link

pavlelee commented Apr 1, 2016

我用的环境

PHP 版本:php5.6
overtrue/wechat 版本:3.0

问题及现象

$options = [
    'debug'  => true,
    'app_id'  => '',         // AppID
    'secret'  => '',     // AppSecret
    'oauth' => [
        'scopes'   => ['snsapi_userinfo'],
        'callback' => '',
    ],
    // payment
    'payment' => [
        'merchant_id'        => '',
        'key'                => '',
        'cert_path'          => '', // XXX: 绝对路径!!!!
        'key_path'           => '',      // XXX: 绝对路径!!!!
        'notify_url'         => '',
        'device_info'        => 'WEB',
    ],
    'log' => [
        'level' => 'debug',
        'file'  => '/tmp/easywechat.log', // XXX: 绝对路径!!!!
    ],
];

return new Application($options);


$attributes = [
        'body'             => $detail,
        'out_trade_no'     => date('YmdHis') . rand(1000, 9999),
        'total_fee'        => $fee,
        'trade_type'       => 'JSAPI',
    ];

    $order = new Order($attributes);

    $res = $payment->prepare($order);

一直提示签名错误
@overtrue
Copy link
Collaborator

overtrue commented Apr 1, 2016

配置里的:

 'app_id'  => '',         // AppID
 'secret'  => '',     // AppSecret

还有 

'payment' => [
        'merchant_id'        => '',
        'key'                => '',

项目代码是空的还是你在 issue 里留空的?

@pavlelee
Copy link
Author

pavlelee commented Apr 1, 2016

我去除了。。。

@pavlelee
Copy link
Author

pavlelee commented Apr 1, 2016

我发现新版本,代码提示太不好了

@overtrue
Copy link
Collaborator

overtrue commented Apr 1, 2016

你确定上面我提到的部分都是正确的?

@pavlelee
Copy link
Author

pavlelee commented Apr 1, 2016

我认真核对很多次了

@overtrue
Copy link
Collaborator

overtrue commented Apr 1, 2016

@Liv1020 你的notify_url呢?

@overtrue
Copy link
Collaborator

overtrue commented Apr 1, 2016

@pavlelee
Copy link
Author

pavlelee commented Apr 1, 2016

写了,我给的那些参数都写了,只不过我去除了

@overtrue
Copy link
Collaborator

overtrue commented Apr 1, 2016

@Liv1020 你的wechat 具体版本是多少?

composer info overtrue/wechat

@pavlelee
Copy link
Author

pavlelee commented Apr 1, 2016

果然微信api是最垃圾的,openid没发现要必传。我回去试试。麻烦你了

@overtrue
Copy link
Collaborator

overtrue commented Apr 1, 2016

再找找原因吧,他们的文档坑多着呢

@pavlelee
Copy link
Author

pavlelee commented Apr 1, 2016

好的,麻烦你了。

@huijimuhe
Copy link

请问我也遇到这个问题搞2天了。
我的环境是2.1,laravle4.2.
UnifiedOrder-》getResponse提示签名错误,我把request打印出来和微信的api签名检查工具核对了,完全一模一样。
请问有人遇到过这个坑么

@pavlelee
Copy link
Author

pavlelee commented Apr 7, 2016

这个确实签名不行

@overtrue
Copy link
Collaborator

overtrue commented Apr 7, 2016

@huijimuhe 用的2.0?

@huijimuhe
Copy link

2.1

@overtrue
Copy link
Collaborator

overtrue commented Apr 7, 2016

@huijimuhe 建议用 3

@pavlelee
Copy link
Author

pavlelee commented Apr 7, 2016

我用的3也是一样的

@overtrue
Copy link
Collaborator

overtrue commented Apr 7, 2016

@Liv1020 因为群里有人已经把支付做好了,下单什么的也都OK了,因为我也没有相关项目,所以我也无法知道这个出现的原因。所以只能靠你们去尝试检查参数的结构来确认问题了。

@huijimuhe
Copy link

@Liv1020 请问你解决没有 ?

@pavlelee
Copy link
Author

@huijimuhe 我自己签名倒是可以,我也不知道,都一样的

@overtrue
Copy link
Collaborator

overtrue commented Apr 22, 2016

@Liv1020 @huijimuhe 更新到 3.0.15 看看 #402

@Geniusbabypandas
Copy link

我来学习一下

@cevin
Copy link

cevin commented Jun 6, 2016

3.0.18 也碰到签名错误的问题

@samplecmsv1
Copy link

key这个参数 请问如何签名呢?

@overtrue
Copy link
Collaborator

overtrue commented Jun 17, 2016

@samplecms 提问请带上下文及必要细节,节省大家时间,谢谢!

@canon4ever
Copy link

canon4ever commented Jul 19, 2016

支付sdk未发现问题,我用着很好,一切顺畅,从未出过错误。
我估计你们还是用的不对。

@yaoshanliang
Copy link

我也是哎,统一下单签名错误,试了跟微信工具的签名比较了,一样的。

版本:3.3.15

@overtrue

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

8 participants