1、微信开放平台接口说明:
2、代码示例
/** * 创建发票卡券模板 * * @param token * @return */ @PostMapping("createCard") public String createCard(String token) { return wechatOpenService.createCard(token); }
String resp = null; try { String url = String.format("https://api.weixin.qq.com/card/invoice/platform/createcard?access_token=%s", token); CreatecardReq createcardReq = new CreatecardReq(); InvoiceInfo invoiceInfo = new InvoiceInfo(); BaseInfo baseInfo = new BaseInfo(); baseInfo.setLogo_url("http://mmbiz.qpic.cn/mmbiz_png/BOXjKBxvujico8c5X60mF8AoS23rtZTmTE4zo1vuAUF9DBTAkyZdCuxPEice18nUyYbMvXlqRYWfX1JmicAIxZt8w/0"); baseInfo.setTitle("测试收款方"); baseInfo.setCustom_url_name("自定义入口"); baseInfo.setCustom_url(""); baseInfo.setCustom_url_sub_title(""); baseInfo.setPromotion_url_name(""); baseInfo.setPromotion_url(""); baseInfo.setPromotion_url_sub_title(""); invoiceInfo.setBase_info(baseInfo); invoiceInfo.setType("增值税普通电子发票"); invoiceInfo.setPayee("payee-测试收款方"); createcardReq.setInvoice_info(invoiceInfo); resp = HttpRequestUtil.post(url, JSON.toJSONString(createcardReq)); } catch (IOException e) { throw new RuntimeException(e); } return resp;
3、使用postman测试