wechat-pay

wechat pay sdk tool

License

License

GroupId

GroupId

me.gaigeshen.wechat
ArtifactId

ArtifactId

wechat-pay
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

wechat-pay
wechat pay sdk tool
Project URL

Project URL

https://github.com/gaigeshen/wechat-pay
Source Code Management

Source Code Management

https://github.com/gaigeshen/wechat-pay

Download wechat-pay

How to add to project

<!-- https://jarcasting.com/artifacts/me.gaigeshen.wechat/wechat-pay/ -->
<dependency>
    <groupId>me.gaigeshen.wechat</groupId>
    <artifactId>wechat-pay</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/me.gaigeshen.wechat/wechat-pay/
implementation 'me.gaigeshen.wechat:wechat-pay:1.2.0'
// https://jarcasting.com/artifacts/me.gaigeshen.wechat/wechat-pay/
implementation ("me.gaigeshen.wechat:wechat-pay:1.2.0")
'me.gaigeshen.wechat:wechat-pay:jar:1.2.0'
<dependency org="me.gaigeshen.wechat" name="wechat-pay" rev="1.2.0">
  <artifact name="wechat-pay" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.gaigeshen.wechat', module='wechat-pay', version='1.2.0')
)
libraryDependencies += "me.gaigeshen.wechat" % "wechat-pay" % "1.2.0"
[me.gaigeshen.wechat/wechat-pay "1.2.0"]

Dependencies

compile (11)

Group / Artifact Type Version
org.dom4j : dom4j jar 2.1.1
jaxen : jaxen jar 1.2.0
com.alibaba : fastjson jar 1.2.39
org.apache.httpcomponents : fluent-hc jar 4.5.8
com.google.guava : guava jar 23.0
org.bouncycastle : bcprov-jdk15on jar 1.61
commons-beanutils : commons-beanutils jar 1.9.3
commons-codec : commons-codec jar 1.11
org.apache.commons : commons-lang3 jar 3.8.1
org.slf4j : slf4j-api jar 1.7.26
org.projectlombok : lombok Optional jar 1.18.6

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

微信支付开发手册

License Build Status Maven Central Sonatype Nexus (Snapshots) GitHub last commit

添加依赖

<dependency>
  <groupId>me.gaigeshen.wechat</groupId>
  <artifactId>wechat-pay</artifactId>
  <version>${VERSION}</version>
</dependency>

构造配置实例

Config config = Config.builder()
    .appid("your appid")
    .mchId("your mchId")
    .key("your key")
    .secret("your secret")
    .build();

构造请求执行器实例

InputStream in = ...;
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(in, "your password".toCharArray());

SSLContext sslContext = SSLContextBuilder.create().loadKeyMaterial(keyStore, "your password".toCharArray()

HttpClientExecutor httpClient = new HttpClientExecutor(2000, 2000, 3000, sslContext);
RequestExecutor executor = new RequestExecutor(httpClient, config);

// 在必要的时候关闭
executor.close();

使用方式

// 普通请求
Request req = ...;
Response resp = executor.execute(req);

// 涉及下载文件的请求
Request req = ...;
ResponseBodyHandler handler = ...;
Response resp = executor.execute(req, handler);

Versions

Version
1.2.0
1.1.0
1.0.0