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

微信退款多个支付如app,小程序等appId未做区分 #107

Open
DestinyCong opened this issue Jul 20, 2020 · 0 comments
Open

微信退款多个支付如app,小程序等appId未做区分 #107

DestinyCong opened this issue Jul 20, 2020 · 0 comments

Comments

@DestinyCong
Copy link

DestinyCong commented Jul 20, 2020

/**
* 微信退款
* @param request
* @return
*/
public RefundResponse refund(RefundRequest request) {
WxPayRefundRequest wxRequest = new WxPayRefundRequest();
wxRequest.setOutTradeNo(request.getOrderId());
wxRequest.setOutRefundNo(request.getOrderId());
wxRequest.setTotalFee(MoneyUtil.Yuan2Fen(request.getOrderAmount()));
wxRequest.setRefundFee(MoneyUtil.Yuan2Fen(request.getOrderAmount()));

    wxRequest.setAppid(wxPayConfig.getAppId());
    wxRequest.setMchId(wxPayConfig.getMchId());
    wxRequest.setNonceStr(RandomUtil.getRandomStr());
    wxRequest.setSign(WxPaySignature.sign(MapUtil.buildMap(wxRequest), wxPayConfig.getMchKey()));

}

支付时是这么写的
//小程序和app支付有独立的appid,公众号、h5、native都是公众号的appid
if (request.getPayTypeEnum() == BestPayTypeEnum.WXPAY_MINI){
wxRequest.setAppid(wxPayConfig.getMiniAppId());
}else if (request.getPayTypeEnum() == BestPayTypeEnum.WXPAY_APP){
wxRequest.setAppid(wxPayConfig.getAppAppId());
}else {
wxRequest.setAppid(wxPayConfig.getAppId());
}

@DestinyCong DestinyCong changed the title 微信退款多个支付如app,小程序等appID 微信退款多个支付如app,小程序等appId未做区分 Jul 20, 2020
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

1 participant