使用PayJS来获取支付请求
为了能够享受静态类型检查,我为每个API调用的请求参数和 响应体 创建了一个对象。
对象的字段和PayJS文档中列举的是一致。
每个请求对象有且只有一个构造函数,这个构造函数 的参数是必填的字段,对于选填的字段用户可以通过 Getter Setter方法来设置
提供了通用的API接口,创建时需要传入用户mchid以及key。
使用时:
-
apiNative
获得二维码
-
apiCheck
查询订单
函数名和请求的url是保持一致的
具体用法查考测试用例
推荐使用PayJSUnirest作为实现类
- clone到本地
- 运行mvn install 将这个SDK安装到本地厂库
- 在其他项目中使用pom文件引入就行了
<groupId>com.github.fish56</groupId>
<artifactId>PayJS</artifactId>
<version>1.0</version>
具体用法参考测试用例以及注释