微信扫码支付示例
注:演示简单的微信二维码扫码支付(获取支付二维码链接,查询订单,关闭订单)
import java.util.HashMap; import java.util.Map; public class TestAPP { public static void main( String[] args ) { //unifiedOrder(); queryOrder(); //closeOrder(); System.out.println("ok"); } public static void unifiedOrder() { String outNo = "O20210225000000111111"; try { HashMap map = new HashMap(); map.put("body", "订单备注"); map.put("out_trade_no", outNo); map.put("total_fee", "1"); map.put("spbill_create_ip","192.168.1.1"); map.put("notify_url", "https://www.com/scanPayBack"); map.put("trade_type", "NATIVE"); System.out.println(genService().unifiedOrder(map)); } catch (Exception e) { e.printStackTrace(); } } public static String queryOrder() { try { HashMap map = new HashMap(); map.put("out_trade_no", "O20210225000000111111"); System.out.println(genService().orderQuery(map)); } catch (Exception e) { e.printStackTrace(); } return null; } public static String closeOrder() { try { HashMap map = new HashMap(); map.put("out_trade_no", "O20210225000000111111"); System.out.println(genService().closeOrder(map)); } catch (Exception e) { e.printStackTrace(); } return null; } }
源码,请联系QQ:1952300797