@Override
public NutMap postPay(String url, String key, Map<String, Object> params) {
params.remove("sign");
String sign = WxPaySign.createSign(key, params);
params.put("sign", sign);
Request req = Request.create(url, METHOD.POST);
System.out.println(Xmls.mapToXml(params));
req.setData(Xmls.mapToXml(params));
Response resp = Sender.create(req).send();
if (!resp.isOK())
throw new IllegalStateException("postPay, resp code=" + resp.getStatus());
return Xmls.xmlToMap(resp.getContent("UTF-8"));
}
<xml>
<nonce_str>gyb0J_kyHnmVQfyIpTHG52</nonce_str>
<time_expire>20190912091010</time_expire>
<time_start>20190911011010</time_start>
<openid>on3VH54Wqomepy7HxDJS02rsUn8k</openid>
<sign>CE18E4CAC8AC4FAF09593C64225507A0</sign>
<fee_type>CNY</fee_type>
<mch_id>1555402601</mch_id>
<body>小精灵孕妇学校VIP开通!</body>
<notify_url>https://24736g26e1.zicp.vip/bmpt/wxpatient/wxpay</notify_url>
<spbill_create_ip>111.121.12.90</spbill_create_ip>
<device_info>WEB</device_info>
<out_trade_no>test0001</out_trade_no>
<goods_tag>test01</goods_tag>
<appid>wx6417e8cac9cea6bd</appid>
<total_fee>1</total_fee>
<trade_type>JSAPI</trade_type>
<detail>{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"01","wxpay_goods_id":"1001","goods_name":"vip充值","quantity":1,"price":1}]}</detail>
<attach>test</attach>
<sign_type>MD5</sign_type>
</xml>