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

微信公众号支付时,timeStamp参数类型 #35

Closed
jwwb681232 opened this issue Dec 7, 2017 · 1 comment
Closed

微信公众号支付时,timeStamp参数类型 #35

jwwb681232 opened this issue Dec 7, 2017 · 1 comment

Comments

@jwwb681232
Copy link

jwwb681232 commented Dec 7, 2017

问题描述

在做Api接口时返回给前端的timeStamp类型是Int类型,当jsApi直接调用此返回参数时,报错timeStamp不存在,改为String类型就好了,建议直接在生成支付参数时就改为String类型

代码

public function pay(array $config_biz = [])
    {
        if (is_null($this->user_config->get('app_id'))) {
            throw new InvalidArgumentException('Missing Config -- [app_id]');
        }
        $payRequest = [
            'appId'     => $this->user_config->get('app_id'),
        -   'timeStamp' => time(),
        +   'timeStamp' => (string)time(),
            'nonceStr'  => $this->createNonceStr(),
            'package'   => 'prepay_id='.$this->preOrder($config_biz)['prepay_id'],
            'signType'  => 'MD5',
        ];
        $payRequest['paySign'] = $this->getSign($payRequest);
        return $payRequest;
    }
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