PAYJS 扫码支付接口 JAVA DEMO
public static void main(String[] args) { | |
String host = "https://payjs.cn"; | |
String path = "/api/native"; | |
String method = "POST"; | |
Map<String, String> headers = new HashMap<String, String>(); | |
Map<String, String> querys = new HashMap<String, String>(); | |
Map<String, String> bodys = new HashMap<String, String>(); | |
bodys.put("mchid", "********"); | |
bodys.put("total_fee", "********"); | |
bodys.put("out_trade_no", "********"); | |
bodys.put("notify_url", "********"); | |
bodys.put("sign", "********"); | |
try { | |
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys); | |
//System.out.println(response.toString());如不输出json, 请打开这行代码,打印调试头部状态码。 | |
//状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误 | |
//获取response的body | |
System.out.println(EntityUtils.toString(response.getEntity())); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
// HttpUtils 待完善 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment