国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

java微信公眾號(hào)JSAPI支付以及所遇到的坑

這篇具有很好參考價(jià)值的文章主要介紹了java微信公眾號(hào)JSAPI支付以及所遇到的坑。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

上周做了個(gè)支付寶微信掃碼支付,今天總結(jié)一下。微信相比支付寶要麻煩許多

由于涉及到代理商,沒辦法,讓我寫個(gè)詳細(xì)的申請(qǐng)流程,懵逼啊。

筆記地址?http://note.youdao.com/noteshare?id=269ddffb1f95e69eafb281d054f9ff25&sub=82AACBC2E6814133938D407BD3FF4737

先梳理下流程,對(duì)應(yīng)的文檔

微信統(tǒng)一下單?H5頁面調(diào)起微信支付?官方j(luò)avademo

要實(shí)現(xiàn)微信支付需要四個(gè)參數(shù)(需要企業(yè)認(rèn)證,就不說了)

商戶平臺(tái)? 商戶號(hào)ID,也就是商戶號(hào)。  KEY,也就是API秘鑰。?公眾平臺(tái)? AppID? AppSecret

梳理完之后,開始操作吧

第一步:參數(shù)準(zhǔn)備和環(huán)境配置

上面的四大參數(shù)只有商戶key相對(duì)比較麻煩

  商戶平臺(tái)

  公眾平臺(tái)

?

四大參數(shù)準(zhǔn)備齊以及環(huán)境配置好開始第二步了。

?

第二步:開發(fā)流程

參考開發(fā)流程

?

必須的參數(shù)有

?appid APPID (已有)??mch_id 商戶ID (已有)?nonce_str 隨機(jī)字符串?sign 簽名?body 所支付的名稱?out_trade_no 咱們自己所提供的訂單號(hào),需要唯一?total_fee 支付金額spbill_create_ip IP地址?notify_url 回調(diào)地址?trade_type 支付類型?openid 支付人的微信公眾號(hào)對(duì)應(yīng)的唯一標(biāo)識(shí)

?

官方就是官方,看著就是費(fèi)勁,大白話聽著多爽

陳海洋:

  需要codeid,文檔地址?https://qydev.weixin.qq.com/wiki/index.php?title=OAuth%E9%AA%8C%E8%AF%81%E6%8E%A5%E5%8F%A3?。?  根據(jù)codeid來獲取openid?  根據(jù)openid來獲取prepare_id?  進(jìn)行下單操作。js調(diào)起微信支付

操作1,用戶授權(quán)獲取code

https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect

注意點(diǎn) redirect_url需要經(jīng)過encodeURI編碼。

可以使用 js內(nèi)置的函數(shù)encodeURIComponent('http://www.baidu.com')來進(jìn)行編碼操作

我第一反應(yīng)在想,為什么需要進(jìn)行url編碼,因?yàn)檫@個(gè)redirect_uri是作為參數(shù)來傳遞的。

之后就會(huì)重定向到你設(shè)置的url上面,并且攜帶code參數(shù),我的后臺(tái)是這么接收的

ok,code獲取完畢

操作2,get請(qǐng)求接口對(duì)返回的string進(jìn)行json解析獲取到openid

操作3,post請(qǐng)求發(fā)送xml數(shù)據(jù)返回xml數(shù)據(jù),通過官方下載的工具類實(shí)現(xiàn)xml轉(zhuǎn)map獲取預(yù)支付id

操作4,封裝jsapi需要的

?

在微信瀏覽器里面打開H5網(wǎng)頁中執(zhí)行JS調(diào)起支付。接口輸入輸出數(shù)據(jù)格式為JSON。

ok,到此結(jié)束,微信支付成功調(diào)起。

?

需要注意的地方。

微信回調(diào)到時(shí)候會(huì)攜帶xml數(shù)據(jù),這個(gè)時(shí)候并不能用參數(shù)接收,而應(yīng)該是使用流來接收。

?

貼出完整代碼,記錄下

后臺(tái)java代碼

?

?

/**
 * 
 */
package com.wxpay.config;

import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URI;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.AlipayTradeWapPayRequest;
import com.alipay.api.response.AlipayTradeWapPayResponse;
import com.alipay.config.AlipayConfig;
import com.jeecms.cms.entity.main.CmsSite;
import com.jeecms.cms.ext.aworder.entiry.CmsAWOrder;
import com.jeecms.cms.ext.aworder.service.CmsAWOrderService;
import com.jeecms.cms.ext.crm.entity.CmsCrm;
import com.jeecms.cms.ext.crm.service.CmsCrmMng;
import com.jeecms.cms.web.CmsUtils;
import com.jeecms.cms.web.FrontUtils;
import com.wxpay.util.WXPayUtil;

/**
 * @author chy
 *
 * 2019年1月15日-下午7:35:06
 */
@Controller
@RequestMapping("wxpay")
public class WxPayController {// 公眾號(hào)id
    final static String APPID = "***ed9716263ff78b6";
    // 公眾號(hào)秘鑰
    final static String SECRET = "***2226ea83d7ef6eb799bd8b631ace0";
    // 商戶號(hào)
    final static String MATCH_ID = "***0674102"; //商戶號(hào)(財(cái)務(wù))
    // 商戶key
    final static String PATERNER_KEY = "***W3E4R5T6Y7U8I9O0P1Q2W3E4R5T6Y";//商戶key(財(cái)務(wù))
    
    // 微信通知的URL
    final static String W_NOTIFY_URL = "www.xinghengedu.com/notifyUrl.htm";
    // 支付寶return的URL
    final static String A_RETURN_URL = "www.xinghengedu.com/res/success.html";
    // 支付寶通知的URL
    final static String A_NOTIFY_URL = "www.xinghengedu.com/anotifyUrl.htm";
    
    // 獲取openID的URL(微信)
    final static String GETOPENID_URL = "https://api.weixin.qq.com/sns/oauth2/access_token";
    // 獲取預(yù)付款I(lǐng)D的URL(微信)
    final static String UNIFIEDORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
    
    final static String DESC = "星恒訂單描述";
    
    final static String ZFB = "支付寶";
    final static String WX = "微信";
    
    @Autowired
    private CmsAWOrderService orderService;
    
    @Autowired
    private CmsCrmMng cmsCrmService;
    

    /**
     * 微信
     * @author chy
     * 2019年1月17日-下午2:14:31
     * @param code            微信必須的code碼,需要用code碼換取openid,之后需要openid來換取prepay_id。
     * @param totalFee        商品價(jià)格
     * @param username        代理商用戶名
     * @return
     * @throws Exception 
     */
    @RequestMapping("order.htm")
    public String order(HttpServletRequest request,String code,String totalFee,String cmsId ,ModelMap retMap) throws Exception{
        System.out.println("***WxPayController.order()");
        //先校驗(yàn)金額,由于是double類型,校驗(yàn)相對(duì)復(fù)雜,涉及到小數(shù)點(diǎn)。
        String[] split = StringUtils.split(cmsId,",");
        Double verify = 0d;
        for (String string : split) {
            CmsCrm crm = cmsCrmService.findById(Integer.parseInt(string));
            verify += crm.getYifu();
        }
        // 判斷需要都轉(zhuǎn)化為分來進(jìn)行判斷
        if((int)(verify*100) != (int)(Double.parseDouble(totalFee)*100)){
            retMap.addAttribute("chymsg", "金額錯(cuò)誤");
            return "/res/wxpay/codeDemo.html";
        }
        String orderNo = getOrderNo("W");// 生成訂單id
        String getOpenIdparam= "appid="+APPID+"&secret="+SECRET+"&code="+code+"&grant_type=authorization_code";
        String getOpenIdUrl = GETOPENID_URL+"?"+getOpenIdparam;
        System.out.println("***getOpenId:"+getOpenIdUrl);
        RestTemplate rest = new RestTemplate();
        rest.getMessageConverters().add(0, new StringHttpMessageConverter(Charset.forName("UTF-8")));
        try {
            String resString = rest.getForObject(new URI(getOpenIdUrl), String.class);
            JSONObject opidJsonObject = JSONObject.parseObject(resString);
            System.out.println("***opidJsonObject:"+opidJsonObject);
            String openid = opidJsonObject.get("openid").toString();//獲取到了openid
            Map<String, String> paramMap = new HashMap<String, String>();
            paramMap.put("appid", APPID);            //公眾賬號(hào)ID
            paramMap.put("mch_id", MATCH_ID);             //商戶號(hào)
            paramMap.put("nonce_str", WXPayUtil.generateNonceStr());        //隨機(jī)字符串
            paramMap.put("body", DESC);            //商品描述
            paramMap.put("out_trade_no", orderNo);    //商戶訂單號(hào)
            paramMap.put("total_fee", (int)(Double.parseDouble(totalFee)*100) +"");        //標(biāo)價(jià)金額
            paramMap.put("spbill_create_ip", getIpAddress(request));//終端IP
            paramMap.put("notify_url", W_NOTIFY_URL);        //通知地址
            paramMap.put("trade_type", "JSAPI");    //交易類型
            paramMap.put("openid", openid);
            String sign = WXPayUtil.generateSignature(paramMap, PATERNER_KEY);
            paramMap.put("sign", sign);
            String mapToXml = WXPayUtil.mapToXml(paramMap);
            String postForObject = rest.postForObject(new URI(UNIFIEDORDER_URL), mapToXml, String.class);
            System.out.println("***postForObject:"+postForObject);
            String prepayId = "";//預(yù)支付id
            if (postForObject.indexOf("SUCCESS") != -1) {  
                Map<String, String> map = WXPayUtil.xmlToMap(postForObject);  
                prepayId = (String) map.get("prepay_id");  
            }
            Map<String, String> payMap = new HashMap<String, String>();
            payMap.put("appId", APPID);  
            payMap.put("timeStamp", WXPayUtil.getCurrentTimestamp()+"");  
            payMap.put("nonceStr", WXPayUtil.generateNonceStr());  
            payMap.put("signType", "MD5");  
            payMap.put("package", "prepay_id=" + prepayId);  
            String paySign = WXPayUtil.generateSignature(payMap, PATERNER_KEY);  
            payMap.put("paySign", paySign);
            payMap.put("pack", "prepay_id=" + prepayId);
            retMap.addAttribute("data", payMap);
            
            //進(jìn)行微信生成訂單操作
            // 對(duì)中間表插入數(shù)據(jù),如果傳入多個(gè)crmid,那就是多對(duì)一。否則就是一對(duì)一,多對(duì)多目前沒有這種情況。
            for (String string : split) {
                CmsCrm crm = cmsCrmService.findById(Integer.parseInt(string));
                orderService.insertCmsIdAndOrderId(crm.getId(),orderNo);
                System.out.println("中間表數(shù)據(jù)插入完畢。");
            }
            // 對(duì)訂單表插入數(shù)據(jù)
            CmsAWOrder order = new CmsAWOrder();
            order.setOrderNo(orderNo);
            order.setRelateId(cmsId);
            order.setPrice(Double.parseDouble(totalFee));
            order.setTotal(Double.parseDouble(totalFee)); // 由于傳過來的是分,需要轉(zhuǎn)化為元
            order.setStatus(1);
            order.setProduct(DESC);
            order.setCreateTime(new Date());
            order.setSource(WX);
            orderService.save(order);
            System.out.println("***微信創(chuàng)建訂單成功");
        } catch (Exception e) {
            retMap.put("code", "500");
            retMap.put("msg", e.getStackTrace());
            e.printStackTrace();
        } 
        return "/res/wxpay/codeDemo.html";
    }
    
    
    /**
     * 支付寶,測(cè)試可以使用支付寶做測(cè)試,畢竟比較簡(jiǎn)單。
     * @author chy
     * 2019年1月17日-下午2:14:15
     * @param totalFee    商品價(jià)格
     * @param username    代理商用戶名
     * @return
     * @throws AlipayApiException
     */
    @RequestMapping("aorder.htm")
    public String order(HttpServletRequest request,HttpServletResponse httpResponse,Model model,String totalFee,String cmsId) throws AlipayApiException{
        CmsSite site = CmsUtils.getSite(request);
        System.out.println("---WxPayController.order()");
        String[] split = StringUtils.split(cmsId,",");
        Double verify = 0d;
        for (String string : split) {
            CmsCrm crm = cmsCrmService.findById(Integer.parseInt(string));
            verify += crm.getYifu();
        }
        // 判斷需要都轉(zhuǎn)化為分來進(jìn)行判斷
        if((int)(verify*100) != (int)(Double.parseDouble(totalFee)*100)){
            model.addAttribute("chymsg", "金額錯(cuò)誤");
            return FrontUtils.getTplPath(request, site.getSolutionPath(), "common", "tpl.alipayapi");
        }
        
        System.out.println("***zfbtotalFee:"+totalFee);
        AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id,AlipayConfig.merchant_private_key, "json", "UTF-8", AlipayConfig.alipay_public_key,AlipayConfig.sign_type);
        AlipayTradeWapPayRequest alipayRequest = new AlipayTradeWapPayRequest();//創(chuàng)建API對(duì)應(yīng)的request
        alipayRequest.setReturnUrl(A_RETURN_URL);
        alipayRequest.setNotifyUrl(A_NOTIFY_URL);
        String out_trade_no = getOrderNo("A");
        alipayRequest.setBizContent("{" +
                "\"out_trade_no\":\""+out_trade_no+"\"," +
                "\"total_amount\":"+totalFee+"," +
                "\"product_code\":\"QUICK_WAP_WAY\","+
                "\"hb_fq_num\":\"3\","+
                "\"hb_fq_seller_percent\":\"0\","+
                "\"subject\":\""+DESC+"\"" +
                "}");
        AlipayTradeWapPayResponse response = alipayClient.pageExecute(alipayRequest);
        model.addAttribute("results", response.getBody());
        System.out.println("results"+response.getBody());
        //進(jìn)行支付寶生成訂單操作
        // 對(duì)中間表插入數(shù)據(jù),如果傳入多個(gè)crmid,那就是多對(duì)一。否則就是一對(duì)一,多對(duì)多目前沒有這種情況。
        for (String string : split) {
            CmsCrm crm = cmsCrmService.findById(Integer.parseInt(string));
            orderService.insertCmsIdAndOrderId(crm.getId(),out_trade_no);
            System.out.println("中間表數(shù)據(jù)插入完畢。");
        }
        // 對(duì)訂單表插入數(shù)據(jù)
        CmsAWOrder order = new CmsAWOrder();
        order.setOrderNo(out_trade_no);
        order.setRelateId(cmsId);
        order.setPrice(Double.parseDouble(totalFee));
        order.setTotal(Double.parseDouble(totalFee)); // 由于傳過來的是分,需要轉(zhuǎn)化為元
        order.setStatus(1);
        order.setProduct(DESC);
        order.setCreateTime(new Date());
        order.setSource(ZFB);
        orderService.save(order);
        System.out.println("***支付寶創(chuàng)建訂單成功");
        return FrontUtils.getTplPath(request, site.getSolutionPath(), "common", "tpl.alipayapi");
    }
    
    
    // 業(yè)務(wù)操作
    public void operation(String oderNo,String zfType){
        CmsAWOrder order = orderService.findByProperty("orderNo", oderNo);
        // 由于會(huì)重復(fù)通知(自己沒有處理好),所以直接判斷訂單狀態(tài)如果修改的話不進(jìn)行操作。
        if(!new Integer(2).equals(order.getStatus())){
            order.setStatus(2);//設(shè)置為支付成功
            order.setPayTime(new Date());
            List<Integer> cmsId = orderService.findMiddleByOrderId(oderNo);
            System.out.println(cmsId);
            for (Integer string : cmsId) {
                CmsCrm cmsCrm = cmsCrmService.findById(string);
                System.out.println("ali_cmsId:"+string);
                System.out.println("cmsCrm:"+cmsCrm);
                if("尾款".equals(cmsCrm.getPayMessage()) || cmsCrm.getYingfu().equals(cmsCrm.getYifu())){
                    cmsCrm.setPaystatus("全部到帳");
                    if(isNumber(cmsCrm.getAddress())){
                        CmsCrm cmsCrm2 = cmsCrmService.findById(Integer.parseInt(cmsCrm.getAddress()));
                        cmsCrm2.setPaystatus("全部到帳");
                        cmsCrm2.setCwjingbanren("自動(dòng)對(duì)賬_"+zfType);
                        cmsCrm2.setDuizhangtime(new Date());
                        cmsCrmService.save(cmsCrm2);
                    }
//                    }else if(cmsCrm.getYingfu().equals(cmsCrm.getYifu())){
//                        cmsCrm.setPaystatus("全部到帳");
                }else{
                    cmsCrm.setPaystatus("預(yù)付款已到帳");
                }
                cmsCrm.setCwjingbanren("自動(dòng)對(duì)賬_"+zfType);
                cmsCrm.setDuizhangtime(new Date());
                cmsCrmService.save(cmsCrm);//開課
                cmsCrmService.kaike(cmsCrm);//保存
            }
            orderService.update(order);
            System.out.println(zfType+"支付通知結(jié)束");
        }
    }
    

    
    /**
     * 微信異步回調(diào)通知
     * @param request
     * @param response
     * @return
     */
    @ResponseBody
    @RequestMapping("notifyUrl.htm")
    public Map<String, Object> notifyUrl(HttpServletRequest request,HttpServletResponse response){
        System.out.println("**WxPayController.notifyUrl()");
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("code", 200);
        InputStream is = null;
        try {
            is = request.getInputStream();//獲取請(qǐng)求的流信息(這里是微信發(fā)的xml格式所有只能使用流來讀)
            String xml = WXPayUtil.inputStream2String(is, "UTF-8");
            System.out.println("***xml:"+xml);
            Map<String, String> notifyMap = WXPayUtil.xmlToMap(xml);//將微信發(fā)的xml轉(zhuǎn)map
            System.out.println("***notifyMap:"+notifyMap);
            if(notifyMap.get("return_code").equals("SUCCESS")){  
                if(notifyMap.get("result_code").equals("SUCCESS")){  
                    String ordersSn = notifyMap.get("out_trade_no");//商戶訂單號(hào) 
                    String amountpaid = notifyMap.get("total_fee");//實(shí)際支付的訂單金額:單位 分
                    BigDecimal amountPay = (new BigDecimal(amountpaid).divide(new BigDecimal("100"))).setScale(2);//將分轉(zhuǎn)換成元-實(shí)際支付金額:元
                    System.out.println("***notifyUrl.htm data:"+ordersSn+"---"+amountPay);
                    
                    // 進(jìn)行業(yè)務(wù)邏輯操作
                    operation(ordersSn, WX);
                }  
            }
            //告訴微信服務(wù)器收到信息了,不要在調(diào)用回調(diào)action了========這里很重要回復(fù)微信服務(wù)器信息用流發(fā)送一個(gè)xml即可
            response.getWriter().write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");  
            is.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return retMap;
    }
    
    
    
    @ResponseBody
    @RequestMapping("anotifyUrl.htm")
    public Map<String, Object> anotifyUrl(HttpServletRequest request){
        System.out.println("***WxPayController.anotifyUrl()");
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("code", 200);
        //進(jìn)行驗(yàn)證操作
        Map<String, String> params = new HashMap<String, String>();
        Map requestParams = request.getParameterMap();
        System.out.println("***requestParams:"+requestParams);
        for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
            String name = (String) iter.next();
            System.out.println("___________name:"+name);
            String[] values = (String[]) requestParams.get(name);
            String valueStr = "";
            for (int i = 0; i < values.length; i++)
                valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
            params.put(name, valueStr);
        }
        String trade_status = request.getParameter("trade_status");
        boolean signVerified;
        try {
            signVerified = AlipaySignature.rsaCheckV1(params, AlipayConfig.alipay_public_key, AlipayConfig.charset, AlipayConfig.sign_type);
            if(signVerified){//驗(yàn)證成功
                System.out.println("***支付寶驗(yàn)證成功");
                if (trade_status.equals("TRADE_FINISHED") || trade_status.equals("TRADE_SUCCESS")) {
                    System.out.println("***判斷成功");
                    
                    // 進(jìn)行業(yè)務(wù)邏輯操作
                    String out_trade_no = request.getParameter("out_trade_no");
                    operation(out_trade_no, ZFB);
                }
            } else {
                System.out.println("***驗(yàn)證錯(cuò)誤");
            }
        } catch (AlipayApiException e) {
            e.printStackTrace();
        }
        return retMap;
    }
    
    
    
    // 獲取訂單id 規(guī)則:當(dāng)前日期_uuid(17位,總共32位) 支付寶64位。
    public static String getOrderNo(String type){
        return DateFormatUtils.format(new Date(), "yyyyMMddHHmmss")+"_"+type+"_"+WXPayUtil.generateNonceStr().substring(0, 15);
    }
    
    // 獲取請(qǐng)求主機(jī)IP地址,如果通過代理進(jìn)來,則透過防火墻獲取真實(shí)IP地址  
    public final static String getIpAddress(HttpServletRequest request) throws IOException {
        String ip = request.getHeader("X-Forwarded-For");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                ip = request.getHeader("Proxy-Client-IP");
            }
            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                ip = request.getHeader("WL-Proxy-Client-IP");
            }
            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                ip = request.getHeader("HTTP_CLIENT_IP");
            }
            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                ip = request.getHeader("HTTP_X_FORWARDED_FOR");
            }
            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                ip = request.getRemoteAddr();
            }
        } else if (ip.length() > 15) {
            String[] ips = ip.split(",");
            for (int index = 0; index < ips.length; index++) {
                String strIp = (String) ips[index];
                if (!("unknown".equalsIgnoreCase(strIp))) {
                    ip = strIp;
                    break;
                }
            }
        }
        return ip;
    }

    public boolean isNumber(String string){
        String str = String.valueOf(string);
        String regex = "^[1-9]\\d*$";
        return str.matches(regex);
    }

}

?

?

?

?

前端html代碼(兩個(gè)頁面,集成了支付寶支付,微信怕因?yàn)閏ode失效問題,解決方式重新添加了一個(gè)html)

cmsDemo.html文章來源地址http://www.zghlxwxcb.cn/news/detail-711200.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>支付</title>
    <link rel="stylesheet"  integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<style>
body{background-color:#efeff4;}
.main{padding:15px;height:100vh;}
.mobile-box{padding:30px;background-color:#fff;}
.mobile-top h2{font-size:18px;color:#000;}
.mobile-content h3 img{margin-right:5px;}
.mobile-content h3{font-size:14px;color:#b******2;}
.input-num{border-bottom: 1px solid #dcdcdc;margin-bottom: 5vh;padding-top: 5vh;}
.input-num .tit{font-size:16px;color:#999;}
.input-num .pay{position:relative;line-height: 50px;margin:10px 0;}
.input-num .pay input{padding-left: 30px;line-height: 50px;border:none;outline:none;}
.input-num .pay span.jinbi{font-weight:bold;color:#000;font-size:24px;position: absolute;left: 0;top: 0;}
.pay-click a.nopay{cursor: pointer;background-color: #a3dea3;color: #fff;width: 100%;display: block;border-radius: 5px;line-height: 50px;font-size: 20px;}
.pay-click a.pay{background-color:#1aac19;}
input[type=number] {-moz-appearance:textfield;}  
input[type=number]::-webkit-inner-spin-button,  
input[type=number]::-webkit-outer-spin-button {-webkit-appearance: none;  margin: 0;}
@media(min-width:720px){
.mobile-box{width:720px;margin:0 auto;}
}
</style>
</head>
<body>
<div class="main">
    <div class="mobile-box">
        <div class="mobile-top ">
            <div class="back">
                <i class="fa fa-angle-left fa-2x"></i>
            </div>
    
            <h2 class="top-center color21">北京星恒教育科技有限公司</h2>
    
            <div class="back"></div>
        </div>
        <div class="mobile-content">
            <h3 class="color21 font">
                <img src="http://img1.52mamahome.com/hotel/homes.png" class="mr10" alt="">北京星恒教育科技有限公司</h3>
            <div class="input-num">
                <div class="tit">金額</div>
                <div class="pay">
                    <span class="jinbi">¥</span>
                    <input type="number" class="w-100" id="totalFee" readonly="readonly">
                </div>
            </div>
            <p class="text-center pay pay-click" id="goPay" onclick="pay()
                

到了這里,關(guān)于java微信公眾號(hào)JSAPI支付以及所遇到的坑的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • java對(duì)接微信支付:JSAPI支付成功之“微信回調(diào)”

    承接上一篇微信支付,現(xiàn)在簡(jiǎn)單說一下 微信支付回調(diào) 目錄 一、支付回調(diào) 二、微信回調(diào)地址問題 1.本地/上線測(cè)試 2.控制器調(diào)用接口(代碼) 總結(jié) 當(dāng)用戶支付成功之后,支付平臺(tái)會(huì)向我們指定的服務(wù)器接口發(fā)送請(qǐng)求傳遞訂單支付狀態(tài)數(shù)據(jù) 如果你是再本地進(jìn)行測(cè)試,那就需要使用

    2024年02月12日
    瀏覽(31)
  • uniapp兼容微信小程序和支付寶小程序遇到的坑

    uniapp兼容微信小程序和支付寶小程序遇到的坑

    改為v-if。 App端和H5端支持 v-html ,微信小程序會(huì)被轉(zhuǎn)為 rich-text,其他端不支持 v-html。 解決方法:去插件市場(chǎng)找一個(gè)支持跨端的富文本組件。 兼容微信小程序和支付寶小程序? pages.json: 給支付寶的導(dǎo)航欄設(shè)置 透明 agent頁面: 支付寶加上 my.setNavigationBar 設(shè)置標(biāo)題文字即可,

    2024年02月15日
    瀏覽(24)
  • 【微信支付】springboot-java接入微信支付-JSAPI支付/查單/退款/發(fā)送紅包(三)---退款

    【微信支付】springboot-java接入微信支付-JSAPI支付/查單/退款/發(fā)送紅包(三)---退款

    微信支付開發(fā)文檔:https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/create.html 退款與查單的請(qǐng)求頭類似,但是查單是GET請(qǐng)求,所以在構(gòu)造簽名的時(shí)候相對(duì)簡(jiǎn)單些,但是退款請(qǐng)求中有請(qǐng)求參數(shù),在構(gòu)造簽名時(shí),需要將請(qǐng)求體添加到請(qǐng)求頭參數(shù)中。 1、構(gòu)造請(qǐng)求參數(shù) 查看微信支付開

    2024年01月19日
    瀏覽(34)
  • 【微信支付】springboot-java接入微信支付-JSAPI支付/查單/退款/發(fā)送紅包(二)---查單

    【微信支付】springboot-java接入微信支付-JSAPI支付/查單/退款/發(fā)送紅包(二)---查單

    文章地址:https://blog.csdn.net/ssdadasd15623/article/details/134684556 查詢訂單分為微信訂單號(hào)查詢以及商戶訂單號(hào)查詢,這里使用商戶訂單號(hào),也就是自己的系統(tǒng)的訂單號(hào) https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/query-by-out-trade-no.html 在請(qǐng)求接口時(shí),注意??:請(qǐng)求參數(shù)內(nèi)的Authori

    2024年02月03日
    瀏覽(29)
  • java微信小程序支付-回調(diào)(Jsapi-APIv3)

    ? ? ? ? 準(zhǔn)備: ?接入前準(zhǔn)備-小程序支付 | 微信支付商戶平臺(tái)文檔中心 準(zhǔn)備好了就可以獲得( 第二點(diǎn)里需要的參數(shù) ): ????????參數(shù)1?商戶號(hào) merchantId:xxxxxx(全是數(shù)字) ????????參數(shù)2?商戶APIV3密鑰 apiV3key:xxxxxxx(32位字母數(shù)字大小寫串,開發(fā)自己準(zhǔn)備的) ????????參

    2024年02月08日
    瀏覽(35)
  • 【微信小程序】Java實(shí)現(xiàn)微信支付(小程序支付JSAPI-V3)java-sdk工具包

    【微信小程序】Java實(shí)現(xiàn)微信支付(小程序支付JSAPI-V3)java-sdk工具包

    ? ? ? 對(duì)于一個(gè)沒有寫過支付的小白,打開微信支付官方文檔時(shí)徹底懵逼 ,因?yàn)?微信支付文檔太過詳細(xì), 導(dǎo)致我無從下手,所以寫此文章,幫助第一次寫支付的小伙伴梳理一下。 一、流程分為三個(gè)接口:(這是前言,先看一遍,保持印象,方便理解代碼) 1、第一個(gè)接口:

    2024年02月03日
    瀏覽(30)
  • 【微信小程序】Java實(shí)現(xiàn)微信支付(小程序支付JSAPI-V3)java-sdk工具包(包含支付出現(xiàn)的多次回調(diào)的問題解析,接口冪等性)

    【微信小程序】Java實(shí)現(xiàn)微信支付(小程序支付JSAPI-V3)java-sdk工具包(包含支付出現(xiàn)的多次回調(diào)的問題解析,接口冪等性)

    ? ? ? 對(duì)于一個(gè)沒有寫過支付的小白,打開微信支付官方文檔時(shí)徹底懵逼 ,因?yàn)?微信支付文檔太過詳細(xì), 導(dǎo)致我無從下手,所以寫此文章,幫助第一次寫支付的小伙伴梳理一下。 一、流程分為三個(gè)接口:(這是前言,先看一遍,保持印象,方便理解代碼) 1、第一個(gè)接口:

    2024年01月16日
    瀏覽(30)
  • 微信的 h5 支付和 jsapi 支付

    微信的 h5 支付和 jsapi 支付

    申請(qǐng)地址: https://pay.weixin.qq.com/ 如果你還沒有微信商戶號(hào),請(qǐng)點(diǎn)擊上面的鏈接進(jìn)行申請(qǐng),如果已經(jīng)有了,可以跳過這一步 首先點(diǎn)擊 賬戶中心 ? API安全 ? 申請(qǐng)API證書 申請(qǐng)?jiān)敿?xì)步驟: https://kf.qq.com/faq/161222NneAJf161222U7fARv.html 首先點(diǎn)擊 賬戶中心 ? API安全 ? 設(shè)置APIv3密鑰 ?

    2024年02月13日
    瀏覽(16)
  • 〔支付接入〕微信的 h5 支付和 jsapi 支付

    〔支付接入〕微信的 h5 支付和 jsapi 支付

    申請(qǐng)地址: https://pay.weixin.qq.com/ 如果你還沒有微信商戶號(hào),請(qǐng)點(diǎn)擊上面的鏈接進(jìn)行申請(qǐng),如果已經(jīng)有了,可以跳過這一步 首先點(diǎn)擊 賬戶中心 ? API安全 ? 申請(qǐng)API證書 申請(qǐng)?jiān)敿?xì)步驟: https://kf.qq.com/faq/161222NneAJf161222U7fARv.html 首先點(diǎn)擊 賬戶中心 ? API安全 ? 設(shè)置APIv3密鑰 ?

    2024年02月13日
    瀏覽(54)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包