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

小程序支付签名问题 #48

Open
alexsunnysun opened this issue Apr 10, 2020 · 4 comments
Open

小程序支付签名问题 #48

alexsunnysun opened this issue Apr 10, 2020 · 4 comments

Comments

@alexsunnysun
Copy link

Payment.js generateChooseWXPayInfo函数 appId: this.wechatConfig.appId
这个会appid是我的公众号appid,在miniProgram下还有一个appid这个是小程序的
那么,我在生成wx.requestPayment所需内容的时候签名就有问题了。

请问,现在支付是不是还没有完全适配小程序?

@JasonBoy
Copy link
Owner

小程序不确定了,是只有appid的区别么,还是很多接口都不一样的?

@JasonBoy JasonBoy added this to the v6.0 milestone Apr 13, 2020
@alexsunnysun
Copy link
Author

alexsunnysun commented Apr 16, 2020

小程序不确定了,是只有appid的区别么,还是很多接口都不一样的?

只有appid,涉及到返回给前端的签名,我现在只是临时解决了下。
Payment.js
generateChooseWXPayInfo(prepayId, miniProgram, signType) {
const params = {
appId: miniProgram ? this.wechatConfig.miniProgram.appId : this.wechatConfig.appId,
timeStamp: utils.timestamp(),
nonceStr: utils.nonceStr(),
package: 'prepay_id=' + prepayId,
signType: signType || SIGN_TYPE.MD5,
};
const ret = this.generateGeneralPaymentSignature(params, params.signType);
return Promise.resolve({
timestamp: params.timeStamp,
nonceStr: params.nonceStr,
package: params.package,
signType: params.signType,
paySign: ret.paySign,
});
}

@JasonBoy
Copy link
Owner

@alexsunnysun 临时也可以自己extends Payment, 然后实现 generateChooseWXPayInfo()

@alexsunnysun
Copy link
Author

@alexsunnysun 临时也可以自己extends Payment, 然后实现 generateChooseWXPayInfo()

好咧,希望您这边可以做个处理哈,我们就简单了。哈哈

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

No branches or pull requests

2 participants