💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
创建代收订单接口调用示例(JAVA): ~~~ Map<String, Object> map = new HashMap<>(); map.put("mchNo", paymentChannelSplit.getMerchantId());//商户ID map.put("appId", paymentChannelSplit.getMerchantPwd());//appId map.put("mchOrderNo",paymentCollect.getMsgId()); map.put("amount",paymentCollect.getAmount()); map.put("currency",paymentCollect.getChannelCurrency()); map.put("email","default@gmail.com"); map.put("subject","bills of "+paymentCollect.getUserName()); map.put("userName",paymentCollect.getUserName()); map.put("returnUrl",applicationProperites.getOopayCallbackUrl()); map.put("body","bills of "+paymentCollect.getUserName()); map.put("phone",paymentCollect.getPhone()); map.put("sign",OopaySignUtil.getSign(map,paymentChannelSplit.getPrivateKey())); logger.info("[oopay]支付创建订单,请求参数,busiCode=[{}],request_body=[{}]",paymentCollect.getBusiCode(),JSONUtil.toJsonStr(map)); OopayPaymentResponse response = oopayApi.oopayReq(OopayPaymentResponse.class,map,"/api/pay/unifiedOrder"); logger.info("[oopay]支付创建订单,响应结果,busiCode=[{}],response_body=[{}]",paymentCollect.getBusiCode(),JSONUtil.toJsonStr(response)); if(null!=response){ if(response.getCode() == 2000){ OopayPaymentData data = response.getData(); PaymentCollectExtJson extJson = new PaymentCollectExtJson(); extJson.setChannelPaymentLink(data.getPayData()); extJson.setEmail(phonePayRequest.getEmail()); paymentCollect.setExtendJson(JSONUtil.toJsonStr(extJson)); paymentCollect.setChannelOrderId(data.getPayOrderId()); }else{ paymentCollect.setStatus(FAIL.value); paymentCollect.setBizRespCode(response.getCode().toString()); paymentCollect.setBizRespMsg(response.getMsg()); } } ~~~ ~~~ public <T> T oopayReq(Class<T> clazz, Map<String, Object> params, String endpoint) throws IOException { String url = applicationProperites.getOopayUrl() + endpoint; HttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost(url); // 构造消息头 post.setHeader("Content-type", "application/json; charset=utf-8"); // 构建消息实体 StringEntity entity = new StringEntity(JSONUtil.toJsonStr(params), Charset.forName("UTF-8")); entity.setContentEncoding("UTF-8"); // 发送Json格式的数据请求 entity.setContentType("application/json"); post.setEntity(entity); HttpResponse response = httpClient.execute(post); org.apache.http.HttpEntity responseEntity = response.getEntity(); String result = EntityUtils.toString(responseEntity,"UTF-8").trim(); logger.info("Oopay response data:{}",result); return JSONUtil.toBean(result, clazz); } ~~~