Skip to content

微信扫码支付

borball edited this page Dec 29, 2016 · 1 revision

扫码支付

统一下单

UnifiedOrderRequest unifiedOrderRequest = new UnifiedOrderRequest();
unifiedOrderRequest.setBody("牛奶 小号");
unifiedOrderRequest.setDetail("小号牛奶 鲜奶");
unifiedOrderRequest.setTradeNumber("1292063901201605160012300016");
unifiedOrderRequest.setTotalFee(100);
unifiedOrderRequest.setBillCreatedIp("192.168.1.103");
unifiedOrderRequest.setNotifyUrl("http://gzriver.com/order/pay/notify");
unifiedOrderRequest.setProductId("product-id");
unifiedOrderRequest.setTradeType("NATIVE");

UnifiedOrderResponse response = Payments.defaultOrders().unifiedOrder(unifiedOrderRequest);

//或者
UnifiedOrderResponse response = Payments.with(paySetting).unifiedOrder(unifiedOrderRequest);

查询订单

OrderQueryRequest orderQueryRequest = new OrderQueryRequest();
orderQueryRequest.setTradeNumber("1292063901201605160012300015");

OrderQueryResponse response = Payments.defaultOrders().query(orderQueryRequest);

//或者
OrderQueryResponse response = Payments.with(paySetting).query(orderQueryRequest);

关闭订单

BaseResponse response = Payments.defaultOrders().close("1292063901201605160012300015");

//或者
BaseResponse response = Payments.with(paySetting).close("1292063901201605160012300015");

申请退款

查询退款

下载对账单

//下载所有账单
String response = Payments.defaultOrders().downloadAllBill(new Date());
//或者
String response = Payments.with(paySetting).downloadAllBill(new Date());

//下载退款账单
String response = Payments.defaultOrders().downloadRefundBill(new Date());
//或者
String response = Payments.with(paySetting).downloadRefundBill(new Date());

//下载成功支付账单
String response = Payments.defaultOrders().downloadSuccessBill(new Date());
//或者
String response = Payments.with(paySetting).downloadSuccessBill(new Date());

支付结果通知