ihaolin / Wepay
Licence: mit
轻量的微信支付组件(A Lightweight Wechat Pay Component)
Stars: ✭ 343
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Wepay
Oss.clients.sns
社交网站sdk(标准库),微信公众号(订阅号,服务号,小程序)接口sdk-包含消息回复(明文和安全模式),Oauth2.0授权等
Stars: ✭ 136 (-60.35%)
Mutual labels: wechat-sdk, wechat
Weixin Java Cp Demo
基于Spring Boot 和 WxJava 实现的微信企业号/企业微信 后端Demo
Stars: ✭ 175 (-48.98%)
Mutual labels: wechat-sdk, wechat
Wechat
轻量的微信公众号组件(A Lightweight Wechat Component)
Stars: ✭ 195 (-43.15%)
Mutual labels: wechat-sdk, wechat
Yii2 Easy Wechat
WeChat SDK for yii2 , based on overtrue/wechat.
Stars: ✭ 188 (-45.19%)
Mutual labels: wechat-sdk, wechat
Wechat
API, command and message handling for WeChat in Rails
Stars: ✭ 1,251 (+264.72%)
Mutual labels: wechat-sdk, wechat
Cordova Plugin Wechat
A cordova plugin, a JS version of Wechat SDK
Stars: ✭ 1,198 (+249.27%)
Mutual labels: wechat-sdk, wechat
Abp.wechat
Abp 微信 SDK 模块,包含对微信小程序、公众号、企业微信、开放平台、第三方平台等相关接口封装。
Stars: ✭ 168 (-51.02%)
Mutual labels: wechat-sdk, wechat
Tom Vpr
how does voiceprint recognition work in wechat page
Stars: ✭ 37 (-89.21%)
Mutual labels: wechat-sdk, wechat
Gopay
QQ、微信(WeChat)、支付宝(AliPay)的Go版本SDK。【微信支付V3已支持,推荐使用微信V3接口】
Stars: ✭ 1,034 (+201.46%)
Mutual labels: wechat-sdk, wechat
Go Workwx
a sensible Work Weixin(企业微信, Wechat Work) SDK for Go
Stars: ✭ 181 (-47.23%)
Mutual labels: wechat-sdk, wechat
Laravel Wechat
微信 SDK for Laravel, 基于 overtrue/wechat
Stars: ✭ 2,690 (+684.26%)
Mutual labels: wechat-sdk, wechat
Wepay
轻量的微信支付组件(A Lightweight Wechat Pay Component)
-
包引入:
<dependency> <groupId>me.hao0</groupId> <artifactId>wepay-core</artifactId> <version>1.3.2</version> </dependency>
-
依赖包,注意引入项目时是否需要exclude:
<dependency> <groupId>me.hao0</groupId> <artifactId>common</artifactId> <version>1.1.2</version> </dependency>
-
基本用法:
Wepay wepay = WepayBuilder .newBuilder(appId, appKey, mchId) .config1(...) // 其他可选配置 ... .build(); wepay.module().api();
-
已实现的组件:
- 支付
pay()
; - 退款
refund()
; - 订单
order()
; - 通知
notify()
; - 账单
bill()
。
- 支付
-
API文档这里。
-
关于测试:
-
测试用例中是一些基本测试,需作一些配置:
// 在test/reources目录中配置dev.properties // 包括appId(APP ID), appKey(支付密钥), mchId(商户号) Properties props = new Properties(); InputStream in = Object.class.getResourceAsStream("/dev.properties"); props.load(in); in.close(); // 配置证书,退款需要证书,不配置可测试除退款的接口 Path path = Paths.get("/path/to/your_cert.p12"); byte[] data = Files.readAllBytes(path); wepay = WepayBuilder.newBuilder( props.getProperty("appId"), props.getProperty("appKey"), props.getProperty("mchId")) .certPasswd(props.getProperty("mchId")) .certs(data) .build();
-
wepay-demo项目是一个可运行web项目,方便测试,可按如下步骤进行测试,复制wepay-demo中的
app-example.properties
为app.properties
,并作相应配置:# 微信app id appId= # 微信支付key appKey= # 商户号 mchId= # 支付通知url payNotifyUrl=${your_domain}/notifies/paid
-
注意:**
payNotifyUrl
**应该配置为微信服务器可以外网调用的地址,本地测试建议使用ngrok工具来作本地外网映射。 -
到wepay-demo根目录运行以下命令即可:
mvn clean jetty:run -Dmaven.test.skip -Djetty.port={自定义端口号}
-
动态二维码支付可访问(请求正常后,会出现由联图生成的二维码图片,用微信扫描支付成功后,后台会得到对应通知
Notifies
):http://localhost:{port}/pays/qrpay?orderNumber={自定义订单号}
-
退款可访问(提交成功后,微信会有消息通知):
http://localhost:{port}/refunds/apply?orderNumber={商户订单号} ```
-
-
相关文档:
-
历史版本:
-
1.0.0:
- 基本功能实现。
-
1.1.0:
- 增加账单查询。
-
1.1.1:
- 修复prepayId。
-
1.1.2:
- 修复JS/APP支付签名问题。
-
1.2.2:
- 增加退款查询字段: 退款状态, 退款金额, 退款入账方。
-
1.2.3:
- fix isNullOrEmpty。
-
1.2.4:
- 升级common至1.1.2, 可配置解析微信XML的编码类型, 默认为UTF-8, 防止与本地默认编码不一致。
-
1.2.5:
- 二维码支付结果更新为QrPayResponse,并增加prepay_id字段。
-
1.3.0:
- 获取微信响应内容,签名校验失败时,抛出异常SignException。
-
1.3.1:
- 修复
goods_tag
字段名。
- 修复
-
1.3.2:
- 修复
clientIp
字段为clientIp
。
- 修复
-
-
相关组件:
有事请烧钱
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].