Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 1.6K

LowcodeMan/pay-java-parent

forked from egan/pay-java-parent
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
develop
Branches (4)
Tags (21)
develop
master
develop-faymanwang
develop-Actinia
v2.14.6
v2.14.3-b2
2.14.3
v2.14.1
v2.13.3
v2.13.2
2.13.1
2.12.9
v2.12.7
v2.12.6
v2.12.1
v2.11.3
v2.10.1
v2.0.7
v2.0.6
2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
develop
Branches (4)
Tags (21)
develop
master
develop-faymanwang
develop-Actinia
v2.14.6
v2.14.3-b2
2.14.3
v2.14.1
v2.13.3
v2.13.2
2.13.1
2.12.9
v2.12.7
v2.12.6
v2.12.1
v2.11.3
v2.10.1
v2.0.7
v2.0.6
2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
develop
Branches (4)
Tags (21)
develop
master
develop-faymanwang
develop-Actinia
v2.14.6
v2.14.3-b2
2.14.3
v2.14.1
v2.13.3
v2.13.2
2.13.1
2.12.9
v2.12.7
v2.12.6
v2.12.1
v2.11.3
v2.10.1
v2.0.7
v2.0.6
2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
PayTest.java 4.89 KB
Copy Edit Raw Blame History
egan authored 2021年08月08日 23:05 +08:00 . 微信V3 平台证书加载
import com.egzosn.pay.common.bean.CertStoreType;
import com.egzosn.pay.common.bean.MethodType;
import com.egzosn.pay.common.bean.PayOrder;
import com.egzosn.pay.common.http.HttpConfigStorage;
import com.egzosn.pay.wx.api.WxPayConfigStorage;
import com.egzosn.pay.wx.api.WxPayService;
import com.egzosn.pay.wx.bean.RedpackOrder;
import com.egzosn.pay.wx.bean.WxSendredpackType;
import com.egzosn.pay.wx.bean.WxTransactionType;
import java.awt.image.BufferedImage;
import java.math.BigDecimal;
import java.util.Map;
import java.util.UUID;
/**
*
*
* 微信
* @author egan
* email egzosn@gmail.com
* date 2017年8月18日
*/
public class PayTest {
public static void main(String[] args) {
WxPayConfigStorage wxPayConfigStorage = new WxPayConfigStorage();
wxPayConfigStorage.setAppId("公众账号ID");
wxPayConfigStorage.setMchId("合作者id(商户号)");
//以下两个参数在 服务商版模式中必填--------
// wxPayConfigStorage.setSubAppid("子商户公众账号ID ");
// wxPayConfigStorage.setSubMchId("微信支付分配的子商户号 ");
//-----------------------------------------------
wxPayConfigStorage.setKeyPublic("转账公钥,转账时必填");
wxPayConfigStorage.setSecretKey("密钥");
wxPayConfigStorage.setNotifyUrl("异步回调地址");
wxPayConfigStorage.setReturnUrl("同步回调地址");
wxPayConfigStorage.setSignType("签名方式");
wxPayConfigStorage.setInputCharset("utf-8");
//是否为测试账号,沙箱环境 此处暂未实现
wxPayConfigStorage.setTest(true);
//支付服务
WxPayService service = new WxPayService(wxPayConfigStorage);
//支付订单基础信息
PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", ""));
/*-----------扫码付-------------------*/
payOrder.setTransactionType(WxTransactionType.NATIVE);
//获取扫码付的二维码
BufferedImage image = service.genQrPay(payOrder);
/*-----------/扫码付-------------------*/
/*-----------APP-------------------*/
payOrder.setTransactionType(WxTransactionType.APP);
//获取APP支付所需的信息组,直接给app端就可使用
Map appOrderInfo = service.orderInfo(payOrder);
/*-----------/APP-------------------*/
/*----------- WAP 网页支付-------------------*/
payOrder.setTransactionType(WxTransactionType.MWEB); // 网页支付
//获取支付所需的信息
Map directOrderInfo = service.orderInfo(payOrder);
//获取表单提交对应的字符串,将其序列化到页面即可,
String directHtml = service.buildRequest(directOrderInfo, MethodType.POST);
/*-----------/ WAP 网页支付-------------------*/
/*-----------条码付 刷卡付-------------------*/
payOrder.setTransactionType(WxTransactionType.MICROPAY);//条码付
payOrder.setAuthCode("条码信息");
// 支付结果
Map params = service.microPay(payOrder);
/*-----------/条码付 刷卡付-------------------*/
/*-----------回调处理-------------------*/
// HttpServletRequest request
// params = service.getParameter2Map(request.getParameterMap(), request.getInputStream());
if (service.verify(params)){
System.out.println("支付成功");
return;
}
System.out.println("支付失败");
/*-----------回调处理-------------------*/
HttpConfigStorage httpConfigStorage = new HttpConfigStorage();
//ssl 退款证书相关
httpConfigStorage.setKeystore("D:/work/pay/src/main/resources/certificates/1220429901_apiclient_cert.p12");
httpConfigStorage.setStorePassword("默认商户号");
//设置ssl证书对应的存储方式,这里默认为文件地址
httpConfigStorage.setCertStoreType(CertStoreType.PATH);
service.setRequestTemplateConfigStorage(httpConfigStorage);
RedpackOrder redpackOrder = new RedpackOrder();
redpackOrder.setSendName("测试");
//faymanwang- opid
redpackOrder.setReOpenid("om3rxjhD1rhGrP6oLydMgLcN5n10");
//红包流水
redpackOrder.setMchBillno("red202005181");
redpackOrder.setTotalAmount(new BigDecimal(1.5));
redpackOrder.setSceneId("PRODUCT_1");
//现金红包,小程序默认为1 裂变默认为3
redpackOrder.setTotalNum(4);
redpackOrder.setWishing("请勿领取");
redpackOrder.setActName("请勿领取测试红包");
redpackOrder.setRemark("测试支付-by fayman");
//设置发红包方式
redpackOrder.setTransferType(WxSendredpackType.SENDGROUPREDPACK);
Map<String, Object> sendredpack = service.sendredpack(redpackOrder);
System.out.println(sendredpack);
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

全能第三方支付对接Java开发工具包.优雅的轻量级支付模块集成支付对接支付整合(微信,支付宝,银联,友店,富友,跨境支付paypal,payoneer(P卡派安盈)易极付)app,扫码,网页支付刷卡付条码付刷脸付转账红包服务商模式,微信分账,合并支付、支持多种支付类型多支付账户,支付与业务完全剥离,简单几行代码即可实现支付
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/lowcode-open/pay-java-parent.git
git@gitee.com:lowcode-open/pay-java-parent.git
lowcode-open
pay-java-parent
pay-java-parent
develop
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /