public class WechatPayCore extends Object implements WechatPayApi
close_order, micro_mch_add, micro_mch_qry, pay_micropay, pay_openidquery, pay_orderquery, pay_refund, pay_reverse, pay_unifiedorder| 构造器和说明 |
|---|
WechatPayCore() |
| 限定符和类型 | 方法和说明 |
|---|---|
static CloseOrderResponse |
closeOrder(CloseOrderRequest request,
String apiKey)
微信订单关闭,商户订单支付失败需要生成新单号重新发起支付,要对原订单号调用关单,避免重复支付;系统下单后,用户支付超时,系统退出不再受理,避免用户继续,请调用关单接口.
|
static WechatPayResponse |
microPay(WechatPayRequest request,
String apiKey)
微信刷卡支付,商户使用扫描枪扫用户微信支付码,消费者为被扫码对象,此方式与扫码支付扫码方式相反.
|
static OpenidQueryResponse |
openidQuery(OpenidQueryRequest request,
String apiKey)
根据用户支付码查询用户在该账户的openid.
|
static OrderQueryResponse |
orderQuery(OrderQueryRequest request,
String apiKey)
微信订单查询,除核心参数外(appid,mch_id等为核心参数)业务参数 transaction_id ,out_trade_no 二选一即可
需要调用查询接口的情况 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知; 调用支付接口后,返回系统错误或未知交易状态情况; 调用刷卡支付API,返回USERPAYING的状态; 调用关单或撤销接口API之前,需确认支付状态; |
static MicroMchResponse |
postMicroMch(MicroMchRequest request,
String apiKey,
String p12FilePath)
申请小微收款识别码
|
static MicroMchResponse |
queryMicroMch(MicroMchRequest request,
String apiKey,
String p12FilePath)
查询小微收款人信息
|
static WechatRefundResponse |
refund(WechatRefundRequest request,
String apiKey,
String p12FilePath)
微信退款,必须指定p12文件路径,否则无法完成退款动作,目前已知退款和撤销接口需要提供p12文件
使用该接口注意事项 交易时间超过一年的订单无法提交退款; 微信支付退款支持单笔交易分多次退款,多次退款需要提交原支付订单的商户订单号和设置不同的退款单号。 |
static WechatReverseResponse |
reverse(WechatReverseRequest request,
String apiKey,
String p12FilePath)
微信撤销订单
使用情境 支付交易返回失败或支付系统超时,调用该接口撤销交易。 |
static UnifiedOrderResponse |
unifiedOrder(UnifiedOrderRequest request,
String apiKey)
微信统一下单,同时支援扫码支付统一下单 和 微信公众号统一下单
|
public static UnifiedOrderResponse unifiedOrder(UnifiedOrderRequest request, String apiKey) throws Exception
request - 统一下单参数对象 UnifiedOrderRequestapiKey - 微信API秘钥UnifiedOrderResponseException - the exceptionpublic static WechatRefundResponse refund(WechatRefundRequest request, String apiKey, String p12FilePath) throws Exception
request - 退款参数对象 WechatRefundRequestapiKey - 微信API秘钥p12FilePath - 微信p12文件路径WechatRefundResponseException - the exceptionpublic static OrderQueryResponse orderQuery(OrderQueryRequest request, String apiKey) throws Exception
需要调用查询接口的情况
request - 查询参数对象 OrderQueryRequestapiKey - API秘钥OrderQueryResponseException - the exceptionpublic static WechatReverseResponse reverse(WechatReverseRequest request, String apiKey, String p12FilePath) throws Exception
支付交易返回失败或支付系统超时,调用该接口撤销交易。如果此订单用户支付失败,微信支付系统会将此订单关闭;如果用户支付成功,微信支付系统会将此订单资金退还给用户。
注意7天以内的交易单可调用撤销,其他正常支付的单如需实现相同功能请调用申请退款API。提交支付交易后调用【查询订单API】, 没有明确的支付结果再调用【撤销订单API】
request - 撤销参数对象 WechatReverseRequestapiKey - API秘钥p12FilePath - p12文件路径WechatReverseResponseException - the exceptionpublic static CloseOrderResponse closeOrder(CloseOrderRequest request, String apiKey) throws Exception
request - 参数对象 CloseOrderRequestapiKey - 微信API秘钥CloseOrderResponseException - the exceptionpublic static WechatPayResponse microPay(WechatPayRequest request, String apiKey) throws Exception
request - 支付参数对象 WechatPayRequestapiKey - 微信API秘钥WechatPayResponseException - the exceptionpublic static OpenidQueryResponse openidQuery(OpenidQueryRequest request, String apiKey) throws Exception
request - data 支付参数对象 OpenidQueryRequestapiKey - 微信API秘钥OpenidQueryResponseException - the exceptionpublic static MicroMchResponse postMicroMch(MicroMchRequest request, String apiKey, String p12FilePath) throws Exception
request - the requestapiKey - the api keyp12FilePath - the p 12 file pathException - the exceptionpublic static MicroMchResponse queryMicroMch(MicroMchRequest request, String apiKey, String p12FilePath) throws Exception
request - the requestapiKey - the api keyp12FilePath - the p 12 file pathException - the exceptionCopyright © 2018. All rights reserved.