- 用户先用后付功能的实现?
用户先用后付款是不是得商户先邮件申请开通微信支付分,这个是商户申请还是服务商申请,还有就是收付通的app支付接口能不能使用先用后付功能,麻烦帮忙解答一下,谢谢
03-28 - 使用SDK上传图片一直报错?
这是我写的方法 public FileUploadResponse uploadFile( String uploadPath, String fileName, MultipartFile file) throws IOException { FileInputStream ins1 = null; try { File file1 = new File("C:\\Users\\Administrator\\Pictures\\logo111.jpg"); file.transferTo(file1); ins1 = new FileInputStream(file1); String sha256 = DigestUtils.sha256Hex(ins1); JSONObject requestData = new JSONObject(); requestData.put("filename",file1.getName()); requestData.put("sha256",sha256); String meta = JSONObject.toJSONString(requestData); FileUploadService fileService = new FileUploadService.Builder().config(config).build(); FileUploadResponse fileUploadResponse = fileService.uploadImage(file1.getPath(), meta,file1.getPath() ); return fileUploadResponse; }catch (Exception e){ e.printStackTrace(); return null; }finally { IOUtils.closeQuietly(ins1); } } 一直返回url字符串无效 java.lang.IllegalArgumentException: The urlString passed in when building httpRequest is invalid:C:\Users\Administrator\Pictures\logo111.jpg at com.wechat.pay.java.core.http.HttpRequest$Builder.url(HttpRequest.java:120) at com.wechat.pay.java.service.file.FileUploadService.uploadFile(FileUploadService.java:142) at com.wechat.pay.java.service.file.FileUploadService.uploadImage(FileUploadService.java:111) 求问大佬这是怎么回事
03-15 - 文件上传接口400?
特约商户进件需要使用上传图片API,我用上传图片的API上传返回400,麻烦帮忙看一下 这是写的方法: URI uri = new URI("https://api.mch.weixin.qq.com/v3/merchant/media/upload"); try (FileInputStream ins1 = (FileInputStream) file.getInputStream()) { String sha256 = DigestUtils.sha256Hex(ins1); try (InputStream ins2 = file.getInputStream()) { HttpPost request = new WechatPayUploadHttpPost.Builder(uri) .withImage(file.getOriginalFilename(), sha256, ins2) .build(); // 加载商户私钥(privateKey:私钥字符串) PrivateKey merchantPrivateKey = PemUtil .loadPrivateKey(new ByteArrayInputStream(getPrivateKey().getBytes("utf-8"))); // 加载平台证书(mchId:商户号,mchSerialNo:商户证书序列号,apiV3Key:V3密钥) AutoUpdateCertificatesVerifier verifier = new AutoUpdateCertificatesVerifier( new WechatPay2Credentials(merchantId, new PrivateKeySigner(merchantSerialNumber, merchantPrivateKey)),apiV3Key.getBytes("utf-8")); // 初始化httpClient CloseableHttpClient httpClient = WechatPayHttpClientBuilder.create() .withMerchant(merchantId, merchantSerialNumber, merchantPrivateKey) .withValidator(new WechatPay2Validator(verifier)).build(); String wechatpaySerial = verifier.getValidCertificate().getSerialNumber().toString(16); JSONObject requestData = new JSONObject(); requestData.put("filename",file.getOriginalFilename()); requestData.put("sha256",sha256); StringEntity entity = new StringEntity(JSONObject.toJSONString(requestData),"utf-8"); String token = getToken("POST","/v3/merchant/media/upload",JSONObject.toJSONString(requestData)); entity.setContentType("application/json"); request.setEntity(entity); request.setHeader("Authorization","WECHATPAY2-SHA256-RSA2048\n"+token); // request.setHeader("Accept","application/json"); request.setHeader("Content-Type","multipart/form-data"); request.setHeader("Wechatpay-Serial", wechatpaySerial); CloseableHttpResponse response = httpClient.execute(request); try { int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == 200) { //处理成功 System.out.println("success,return body = " + EntityUtils.toString(response.getEntity())); return AjaxResult.success("上传成功",EntityUtils.toString(response.getEntity())); } else if (statusCode == 204) { //处理成功,无返回Body System.out.println("success"); return AjaxResult.success("上传成功"); } else { String returnBody = EntityUtils.toString(response.getEntity()); System.out.println("failed,resp code = " + statusCode+ ",return body = " + returnBody); return AjaxResult.error("上传失败",JSONObject.parseObject(returnBody).getString("message")); // throw new IOException("request failed"); } }catch (Exception e){ e.printStackTrace(); throw new IOException("request failed"); } finally { response.close(); } } } 这是返回的报错信息: status code[400] request headers[[Accept: application/json; charset=UTF-8, Authorization: WECHATPAY2-SHA256-RSA2048 mchid="XXXXXXXX",nonce_str="gsdfgsfwretwer",timestamp="1710405669",serial_no="XXXXXXXXXXXXXXXXXXXXXXX",signature="Uj33Uwduo/7bbG1vgmcvtr/429eBX8gmpEjGkYyN1ax6C46XUaBvaXhXXXXXXXXXXXXXXXXXXXXXXX4CW9KVz82P0gaAxbaePVhc/AGylgrqiMOqcUPWJ6Sos+bvAUA1sbwzWseSmPGwJ3vBaUbL7bjnyRYVAGwT2iTbdL712lmKD7zK5D0SN/qQGKo3m4BVpd8ArnP3z/fbGO8FjtrY+l1povSpVlXdNQK2L0Pv7bNFWoXXbZojTTCRvVhIL7fisHnLCws44M0pl3LYqhi5sQej36f1LFyxrHRCihX/xnHzKDplEXAV5+/n7NJZMnfAtqZZRKrPEg==", Content-Type: multipart/form-data, Wechatpay-Serial: XXXXXXXXXXXXXXXXXXXXXXXXXXXX, Authorization: WECHATPAY2-SHA256-RSA2048 mchid="111111111",nonce_str="QaHV2w2cqAGAchJNOEQlu8CLwh8JfD1k",timestamp="1710405669",serial_no="XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",signature="taDsR+TQEnv40SnGGmIw6Y6Uc3oNdOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXhUShPyFgUJ9SCBvCa3N0BY5fGVt9H1ctPRNNDKzoovpyAfiTjrr0FSyEr9wpGroV7iKJ09mwMgblgBvdxqLXV4qsUS7ME0QaKplT8HtpEMRwLNKJ8S2DCtwkUEE03tjKHJMae7+ZgaIMYsrq20EErJi/mHPCJNczfjLJIrjtdYVUw6gUcmwA9VsjLrYD5wpqIv4/QD0GnjiltO/qYBkhrMjf8JL5LE25LRR0JmQfMTT6Q==", Content-Length: 99, Host: api.mch.weixin.qq.com, Connection: Keep-Alive, User-Agent: WechatPay-Apache-HttpClient/0.4.9 (Windows 10/10.0) Java/1.8.0_371, Accept-Encoding: gzip,deflate]] failed,resp code = 400,return body = <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <center><h1>400 Bad Request</h1></center> <hr><center>nginx</center> </body> </html>
03-14 - 敏感信息加解密问题
我用的https://wechatpay-api.gitbook.io/wechatpay-api-v3/qian-ming-zhi-nan-1/min-gan-xin-xi-jia-mi提供的java加密示例,通过微信支付SDK的CertificateService的downloadCertificate()方法获取到微信支付平台证书作为参数进行加密,然后用商户API私钥文件里的私钥进行解密,解密失败,报错:javax.crypto.BadPaddingException: 解密失败,请问这是什么原因呢
03-13 - 微信支付服务商怎么代没有营业执照的个人商户收款
微信支付服务商怎么代没有营业执照的个人商户收款,特约商户需要填写营业执照这些,太繁琐,能不能直接对接个人用户,就像抖音小店一样,只添加个银行卡就可以开店、收款。请问有没有解决办法,公司开一个商户收款然后个人用户提现时转账到个人用户的银行卡可不可以
03-12