支付参考API

萧安怡
2023-12-01

支付工具类


说明:

支付工具类目前封装了微信支付与支付宝支付,支持的支付方式如下:

微信支付:扫码支付,刷卡支付,公众号支付,H5支付,APP支付;

支付宝支付:手机网站支付,电脑网站支付,当面付,APP支付;


使用:

1.将pay-core作为模块导入项目中或引入pay-core-1.0-SNAPSHOT.jar;

2.调用PayApi.java中的pay方法实现支付功能;

3.pay方法请求参数为json格式的字符串,返回类型为PayResponse,不同的支付方式对应的请求参数不同,具体见字段详细说明


请求参数:

字段名变量名必填类型说明
支付渠道payChannelString详见数据字典
支付方式payModeString详见数据字典
支付渠道分配的账号IDappidString 
支付渠道分配的商户号mch_idString微信支付必填
平台设置的密钥keykeyString微信支付必填
应用私钥privateKeyString支付宝支付必填
支付宝公钥publicKeyString支付宝支付必填
用户标识openidStringpayMode="wxpay"时必填
终端IPspbill_create_ipString微信支付必填
支付后返回的urlreturn_urlString支付宝支付时使用
通知地址notify_urlString异步通知地址
支付授权码auth_codeString"micropay","tradepay"时必填
商品ID或者订单号product_idStringpayMode="scancode1"时必填
商户订单号out_trade_noString 
商品描述bodyString 
订单金额total_feeString单位(元),保留两位小数点
附加数据attachString携带的自定义数据
场景信息scene_infoStringpayMode="h5pay"时必填

响应参数:

字段名变量名必填类型说明
返回状态码codeStringSUCCESS/FAIL
返回信息msgString 
返回的数据dataMap<String,String>详见示例

支付渠道数据字典

说明
wx微信支付
zfb支付宝支付

支付方式数据字典

说明
scancode1微信:扫码支付模式一
scancode2微信:扫码支付模式二
micropay微信:刷卡支付
webpay微信:公众号支付
h5pay微信:H5支付
apppay微信:APP支付
wappay支付宝:手机网站支付
pcpay支付宝:电脑网站支付
tradepay支付宝:刷卡支付-条码支付
tradeprepay支付宝:刷卡支付-扫码支付
apppay支付宝:APP支付

示例:

  • 微信:扫码支付模式一

  • 请求:
{"appid":"wxb6b0b52529d32c62","key":"5ds4iv2xgrskjbzibs04ezrr0batqcsf","mch_id":"1320261701","payChannel":"WX","payMode":"scancode1","product_id":"1"}
  • 响应:得到返回的qrCodeUrl后,再通过图形码工具生成二维码
{"code":"SUCCESS","data":{"qrCodeUrl":"weixin://wxpay/bizpayurl?pr=VKdZAGY"}}
    /**
	 * Zxing图形码生成工具
	 *
	 * @param contents
	 *            内容
	 * @param barcodeFormat
	 *            BarcodeFormat对象
	 * @param format
	 *            图片格式,可选[png,jpg,bmp]
	 * @param width
	 *            宽
	 * @param height
	 *            高
	 * @param margin
	 *            边框间距px
	 * @param saveImgFilePath
	 *            存储图片的完整位置,包含文件名
	 * @return {boolean}
	 */
	public static boolean encode(String contents, BarcodeFormat barcodeFormat, Integer margin,
			ErrorCorrectionLevel errorLevel, String format, int width, int height, String saveImgFilePath) {
		Boolean bool = false;
		BufferedImage bufImg;
		Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
		// 指定纠错等级
		hints.put(EncodeHintType.ERROR_CORRECTION, errorLevel);
		hints.put(EncodeHintType.MARGIN, margin);
		hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
		try {
			// contents = new String(contents.getBytes("UTF-8"), "ISO-8859-1");
			BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, barcodeFormat, width, height, hints);
			MatrixToImageConfig config = new MatrixToImageConfig(0xFF000001, 0xFFFFFFFF);
			bufImg = MatrixToImageWriter.toBufferedImage(bitMatrix, config);
			bool = writeToFile(bufImg, format, saveImgFilePath);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bool;
	}
	
	public static void main(String[] args){
	    String requestJson = "{\"appid\":\"wxb6b0b52529d32c62\",\"key\":\"5ds4iv2xgrskjbzibs04ezrr0batqcsf\",\"mch_id\":\"1320261701\",\"payChannel\":\"WX\",\"payMode\":\"scancode1\",\"product_id\":\"1\"}";
	    PayResponse response = PayApi.pay(requestJson);
	    if(response.getCode().equalsIgnoreCase("SUCCESS")){
	        Map<String,String> result = response.getData();
    	    String qrCodeUrl = result.get("code_url");
    		String name = "code.png";
    		String codeUrl = "项目路径"++File.separator+name;
    		Boolean encode = encode(qrCodeUrl, BarcodeFormat.QR_CODE, 3, ErrorCorrectionLevel.H, "png", 200, 200,codeUrl);
    		if (encode) {
    			//生成成功,在页面上展示codeUrl
    		}else{
    		    //生成二维码图片失败
    		}
	    }else{
	        //错误处理
	    }
	}
  • 微信:扫码支付模式二

  • 请求:
{"appid":"wxb6b0b52529d32c62","attach":"支付测试Attach","body":"支付测试Body","key":"5ds4iv2xgrskjbzibs04ezrr0batqcsf","mch_id":"1320261701","notify_url":"api.mch.weixin.qq.com/wxpay/pay_notify","out_trade_no":"1506496240311","payChannel":"WX","payMode":"scancode2","spbill_create_ip":"127.0.0.1","total_fee":"1"}
  • 响应:得到返回的data中的code_url,然后同扫码支付模式一同样方式生成二维码处理
{"code":"SUCCESS","data":{"nonce_str":"gmOM15GsIWjMLS5E","code_url":"weixin://wxpay/bizpayurl?pr=uKvwTlh","appid":"wxb6b0b52529d32c62","sign":"DB740EFB255A7D1D058098E9492BF062","trade_type":"NATIVE","return_msg":"OK","result_code":"SUCCESS","mch_id":"1320261701","return_code":"SUCCESS","prepay_id":"wx2017092715093254458f24780562552806"}}
  • 微信:刷卡支付

  • 请求:
{"appid":"wxb6b0b52529d32c62","attach":"支付测试Attach","auth_code":"134716569327017541","body":"支付测试Body","key":"5ds4iv2xgrskjbzibs04ezrr0batqcsf","mch_id":"1320261701","notify_url":"api.mch.weixin.qq.com/wxpay/pay_notify","out_trade_no":"1506496974098","payChannel":"WX","payMode":"micropay","spbill_create_ip":"127.0.0.1","total_fee":"1"}
  • 响应:
{"code":"SUCCESS","data":{"transaction_id":"4200000017201709274569828637","nonce_str":"l0LtzhTa15ChvSeQ","trade_state":"SUCCESS","bank_type":"CFT","openid":"omz4buJo0RzxxoJke6bc_Pgo_6dU","sign":"60994BE7C78D4E2CCCA85440F06B5581","return_msg":"OK","fee_type":"CNY","mch_id":"1320261701","cash_fee":"1","out_trade_no":"1506501238054","appid":"wxb6b0b52529d32c62","total_fee":"1","trade_type":"MICROPAY","result_code":"SUCCESS","attach":"支付测试Attach","time_end":"20170927163409","is_subscribe":"Y","return_code":"SUCCESS"},"msg":"微信支付成功"}
  • 微信:公众号支付

  • 请求:
{"appid":"wxb6b0b52529d32c62","attach":"支付测试Attach","body":"支付测试Body","key":"5ds4iv2xgrskjbzibs04ezrr0batqcsf","mch_id":"1320261701","notify_url":"api.mch.weixin.qq.com/wxpay/pay_notify","openid":"omz4buJo0RzxxoJke6bc_Pgo_6dU","out_trade_no":"1506501551192","payChannel":"WX","payMode":"webpay","spbill_create_ip":"127.0.0.1","total_fee":"1"}
  • 响应:生成JSAPI页面调用的支付参数,由页面调起微信公众号支付
{"msg":null,"code":"SUCCESS","data":{"nonce_str":"ZtQ8ySJwUFcMI5lW","appid":"wxb6b0b52529d32c62","sign":"8D97E5857CCC3CFE24406D67873CEC38","trade_type":"JSAPI","return_msg":"OK","result_code":"SUCCESS","mch_id":"1320261701","return_code":"SUCCESS","prepay_id":"wx201709271638502372205aef0709139838"}}
  • 微信:H5支付(待测试)

  • 请求:
{"appid":"wxb6b0b52529d32c62","attach":"支付测试Attach","body":"支付测试Body","key":"5ds4iv2xgrskjbzibs04ezrr0batqcsf","mch_id":"1320261701","notify_url":"api.mch.weixin.qq.com/wxpay/pay_notify","out_trade_no":"1506502607708","payChannel":"WX","payMode":"h5pay","scene_info":"com.anssy.pay.weixin.entity.H5ScencInfo$H5@a06f20","spbill_create_ip":"127.0.0.1","total_fee":"1"}
  • 响应:响应参数中会返回mweb_url,直接在浏览器中访问该地址进行支付操作。

  • 微信:APP支付(待测试)

  • 请求:

{"appid":"wxb6b0b52529d32c62","attach":"支付测试Attach","body":"支付测试Body","key":"5ds4iv2xgrskjbzibs04ezrr0batqcsf","mch_id":"1320261701","notify_url":"api.mch.weixin.qq.com/wxpay/pay_notify","out_trade_no":"1506502783874","payChannel":"WX","payMode":"apppay","spbill_create_ip":"127.0.0.1","total_fee":"1"}
  • 响应:响应参数中会返回签名后的数据sign,APP端拿到该参数调起微信支付。
  • 支付宝:手机网站支付

  • 请求:
{"appid":"2015120800939352","attach":"backparams","body":"支付测试Subject","notify_url":"xxx/alipay/notify_url","out_trade_no":"092717204815065","payChannel":"ZFB","payMode":"wappay","privateKey":"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC66wk/uAjV0vpxLY2hTxTjFT+0Huwqf4fZc8ahG4ZySeNdQb4xIfvMUh78as9FY1HqMF8UgmvaFd5mv/sIQ0cD0g7M4OFHRrJML0RrmEu/A/W2QZ3ZhN6zThhp4oD18BeVDf1dUyiv5bqDckbntIfDWH7ICJiCvAUcLBwyY0xQ5njUp/yhv1tFbEN6Iawr+MHUJcaT6S+FcGbXLcD8ovx3juvqyRQwf7n5xRbdX5DjzFEtNd8V62LpQscv+VN57zxE2Dmn+Lbw3FVeJW70zEstn7PyRNvxdCPrUK2Ml4LlOKLWYl23qHbD1nsDynD3qf41j7A9QZSuzxXRN9fEZlkHAgMBAAECggEBALU2B9FuaaJi18nBj/1C3c0JXKkTEYJiASIfzAGE3eMPHw3aHrkjaSm8s62jHy72CwQvwP3xMv5LFUIn/QcVslNR4mdd3Qls0I5rhLmK/GRDQoNfOdkXp4/Ntn1wyfWkvjgTR/6iEF/3J8snjvYzXytTMBZdvv1/qrSVTwDKo8IJBEbLEcodI3nhyuK7wO8jhldVd3OztEc1KdGnCopDvKcsy/nPl0Mok93SKHhF01QjemakmKlfXBf989iiahNMLSo2Sru9XBCXuJVdcQThdQ66o/8SIaWOjfKQDTrh8qvxu+DzHOz2jjVCObWkktBhaO5W3gV4MPAyhL1qmjPix4ECgYEA7+oJEnsIgGqljSIONVoZmyVkkfPW6IwEeY2rpazJcY1r5PjmPErbvwmnWZM5CIVqC+YYvttnCWftF1eOZhIsTb0xHKKV59pun8IwC0Tw4ikXDLu8IxuBbdDGzNA2sH/GlQdjKohBcvBZhit19uvCUzRmmLY/h9Ue8uxGQaRb97sCgYEAx3Nb1YAzB1+OzMKtp8VpWNvmFfdhN7dN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AQAB","return_url":"xxx/alipay/return_url","total_fee":"0.01"}
  • 响应:请求成功后,会返回支付页面,将完整的表单html输出到页面
{"msg":null,"code":"SUCCESS","data":{"form":"<form name=\"punchout_form\" method=\"post\" action=\"https://openapi.alipay.com/gateway.do?charset=UTF-8&method=alipay.trade.wap.pay&sign=W25B1zhxR2k4N%2B2fpFdKy0rOGlAc90235FoXju7crr5URJOPjJ6EzFvfoSGyLNPt5lVkRuYATCW4vzDeiTvWoINJP4yxP%2BfEvY7i7GhjeRJ3zPfrI%2B57E8zmIwbMt44JD46Srt%2F8S8py7BXZ620cjSzO7k%2Baet0FWUWdSw%2BFsFC6glwk5pPDoYqnNn3apa6ztCrnTKUqmSF4MIrgPB0ik7sGtSpHQJhY0ItXfeYbpWwaPpSoZoLClAHVbGZ2DHA2wt3BcyavgHEm6smXy11bydptMVCMSPenOgtECPr5SXvHL5KlSHml8NBF%2F02t6bbS54tpDnJd58aYzTyqrH3dwA%3D%3D&return_url=xxx%2Falipay%2Freturn_url&notify_url=xxx%2Falipay%2Fnotify_url&version=1.0&app_id=2015120800939352&sign_type=RSA2&timestamp=2017-09-27+17%3A20%3A48&alipay_sdk=alipay-sdk-java-dynamicVersionNo&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{ &quot;out_trade_no&quot;:&quot;092717204815065&quot;, &quot;total_amount&quot;:&quot;0.01&quot;, &quot;subject&quot;:&quot;支付测试Subject&quot;, &quot;passback_params&quot;:&quot;backparams&quot;, &quot;product_code&quot;:&quot;QUICK_WAP_PAY&quot; }\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>"}}
  • 将返回的支付页面输出
            //调用支付接口
			String requestJson = JSONObject.toJSONString(request);
			PayResponse response = PayApi.pay(requestJson);
			log.info("responseJson>"+JsonKit.toJson(response));
			if(response.getCode().equalsIgnoreCase("SUCCESS")){
				Map<String,String> data = response.getData();
				HttpServletResponse res = getResponse();
				res.setContentType("text/html;charset=UTF-8");
				res.getWriter().write(data.get("form"));// 直接将完整的表单html输出到页面
				res.getWriter().flush();
			}else{
				//输出错误信息
			}
  • 支付宝:电脑网站支付

  • 请求:
{"appid":"2015120800939352","attach":"backparams","body":"支付测试Subject","notify_url":"xxx/alipay/notify_url","out_trade_no":"092717265915065","payChannel":"ZFB","payMode":"pcpay","privateKey":"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC66wk/uAjV0vpxLY2hTxTjFT+0Huwqf4fZc8ahG4ZySeNdQb4xIfvMUh78as9FY1HqMF8UgmvaFd5mv/sIQ0cD0g7M4OFHRrJML0RrmEu/A/W2QZ3ZhN6zThhp4oD18BeVDf1dUyiv5bqDckbntIfDWH7ICJiCvAUcLBwyY0xQ5njUp/yhv1tFbEN6Iawr+MHUJcaT6S+FcGbXLcD8ovx3juvqyRQwf7n5xRbdX5DjzFEtNd8V62LpQscv+VN57zxE2Dmn+Lbw3FVeJW70zEstn7PyRNvxdCPrUK2Ml4LlOKLWYl23qHbD1nsDynD3qf41j7A9QZSuzxXRN9fEZlkHAgMBAAECggEBALU2B9FuaaJi18nBj/1C3c0JXKkTEYJiASIfzAGE3eMPHw3aHrkjaSm8s62jHy72CwQvwP3xMv5LFUIn/QcVslNR4mdd3Qls0I5rhLmK/GRDQoNfOdkXp4/Ntn1wyfWkvjgTR/6iEF/3J8snjvYzXytTMBZdvv1/qrSVTwDKo8IJBEbLEcodI3nhyuK7wO8jhldVd3OztEc1KdGnCopDvKcsy/nPl0Mok93SKHhF01QjemakmKlfXBf989iiahNMLSo2Sru9XBCXuJVdcQThdQ66o/8SIaWOjfKQDTrh8qvxu+DzHOz2jjVCObWkktBhaO5W3gV4MPAyhL1qmjPix4ECgYEA7+oJEnsIgGqljSIONVoZmyVkkfPW6IwEeY2rpazJcY1r5PjmPErbvwmnWZM5CIVqC+YYvttnCWftF1eOZhIsTb0xHKKV59pun8IwC0Tw4ikXDLu8IxuBbdDGzNA2sH/GlQdjK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u9MxLLZ+z8kTb8XQj61CtjJeC5Tii1mJdt6h2w9Z7A8pw96n+NY+wPUGUrs8V0TfXxGZZBwIDAQAB","return_url":"xxx/alipay/return_url","total_fee":"0.01"}
  • 响应:同手机网站支付一样处理
{"msg":null,"code":"SUCCESS","data":{"form":"<form name=\"punchout_form\" method=\"post\" action=\"https://openapi.alipay.com/gateway.do?charset=UTF-8&method=alipay.trade.page.pay&sign=F2OzNpRR717PD8s6H9I8Td%2BMsZXjmSug8pYt2kOpztD7EU4JHTAM2YzqsU%2FXB6tCUX2hpKuBs3DqCFmqHU%2BsaKupWBAGuX3jf6ie5%2B1EUmz5i2Y%2BqgBe04fPhDBylXFvYVIkeFPsDfzLS6xndjxM8GcnfuFQDscwrBR6ZapJc%2BOnBgXRBaDJ46uCti9dsUIRRe1WpeDuvQMaw869v%2FScbcYpxH3PaiBFAMmqYoE%2BdptY7jYFkA2wcQeeJ%2Fsf9VOcU9H%2BeE4UcjxvnMG8Wr2mSvuQCg1Are3SGwsPmqcVwJnTugZEGU%2BOYsx86%2FPydZFNxZItnRXYlzQbOCBvlZ1JQg%3D%3D&return_url=xxx%2Falipay%2Freturn_url&notify_url=xxx%2Falipay%2Fnotify_url&version=1.0&app_id=2015120800939352&sign_type=RSA2&timestamp=2017-09-27+17%3A26%3A59&alipay_sdk=alipay-sdk-java-dynamicVersionNo&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{    &quot;out_trade_no&quot;:&quot;092717265915065&quot;,    &quot;total_amount&quot;:&quot;0.01&quot;,    &quot;subject&quot;:&quot;支付测试Subject&quot;,    &quot;passback_params&quot;:&quot;backparams&quot;,    &quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;  }\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>"}}
  • 支付宝:刷卡支付-条码支付

  • 请求:
{"appid":"2015120800939352","body":"支付测试Subject","notify_url":"xxx/alipay/notify_url","out_trade_no":"092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Ck+lANhJDzJ8JhfYDLKad98dhyZRNCaTHkUGuN35z52Qj+B8mcSUCgYB2h/9hdQ3XPFl8qBWzAEfkYg4VGg7Up9DSKU9jtEF2a7Oh1eMSaL223dMjq1wjPJ8PL+iL6yQ1/nWh8a01+saOxelMx3seqMm8/pj0CGSmqDxuGxaxlbZVhi+iI0DR5N885AB3lAgZ/GuOoUxP6V0B9MK3slsjBgWbaWawqb6SXwKBgFMyCmd3T1HPCVjeB+PIk9Xt+/7Drri37Hp9wuIPb+BcAR8U4CG461xmoIMQZGbzpPG9EVlY1gHD7yY7bLYhkdSr+3fjvW6X5yOZUlnGcTOINmlfN1LTIs6HlH3wOMmVOtS6rhVD9jUE1zXI5EBabPwN0PUFSa96PsyRV/Oiwr1FAoGAZ4Z4aVBxtNUYyXGR6SyGNbEgu+GXcSZwqN4255fL+ZQOJj9CW8QDxYUlGWUVNvQdLNMqfKVOOWOsn2Pdi8gaxRw1/NbZ2ncJccZI2eufqTYGyHQeK3YtOw5942kFWdybWrIQnOAZyLNtAYQhNaMutA5CNHmwbna8+x3EvuTHGQA=","publicKey":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuusJP7gI1dL6cS2NoU8U4xU/tB7sKn+H2XPGoRuGcknjXUG+MSH7zFIe/GrPRWNR6jBfFIJr2hXeZr/7CENHA9IOzODhR0ayTC9Ea5hLvwP1tkGd2YTes04YaeKA9fAXlQ39XVMor+W6g3JG57SHw1h+yAiYgrwFHCwcMmNMUOZ41Kf8ob9bRWxDeiGsK/jB1CXGk+kvhXBm1y3A/KL8d47r6skUMH+5+cUW3V+Q48xRLTXfFeti6ULHL/lTee88RNg5p/i28NxVXiVu9MxLLZ+z8kTb8XQj61CtjJeC5Tii1mJdt6h2w9Z7A8pw96n+NY+wPUGUrs8V0TfXxGZZBwIDAQAB","return_url":"xxx/alipay/return_url","total_fee":"0.01"}
  • 响应:

  • 支付宝:刷卡支付-扫码支付

  • 请求:

{"appid":"2015120800939352","body":"支付测试Subject","notify_url":"xxx/alipay/notify_url","out_trade_no":"092719342515065","payChannel":"ZFB","payMode":"tradeprepay","privateKey":"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC66wk/uAjV0vpxLY2hTxTjFT+0Huwqf4fZc8ahG4ZySeNdQb4xIfvMUh78as9FY1HqMF8UgmvaFd5mv/sIQ0cD0g7M4OFHRrJML0RrmEu/A/W2QZ3ZhN6zThhp4oD18BeVDf1dUyiv5bqDckbntIfDWH7ICJiCvAUcLBwyY0xQ5njUp/yhv1tFbEN6Iawr+MHUJcaT6S+FcGbXLcD8ovx3juvqyRQwf7n5xRbdX5DjzFEtNd8V62LpQscv+VN57zxE2Dmn+Lbw3FVeJW70zEstn7PyRNvxdCPrUK2Ml4LlOKLWYl23qHbD1nsDynD3qf41j7A9QZSuzxXRN9fEZlkHAgMBAAECggEBALU2B9FuaaJi18nBj/1C3c0JXKkTEYJiASIfzAGE3eMPHw3aHrkjaSm8s62jHy72CwQvwP3xMv5LFUIn/QcVslNR4mdd3Qls0I5rhLmK/GRDQoNfOdkXp4/Ntn1wyfWkvjgTR/6iEF/3J8snjvYzXytTMBZdvv1/qrSVTwDKo8IJBEbLEcodI3nhyuK7wO8jhldVd3OztEc1KdGnCopDvKcsy/nPl0Mok93SKHhF01QjemakmKlfXBf989iiahNMLSo2Sru9XBCXuJVdcQThdQ66o/8SIaWOjfKQDTrh8qvxu+DzHOz2jjVCObWkktBhaO5W3gV4MPAyhL1qmjPix4ECgYEA7+oJEnsIgGqljSIONVoZmyVkkfPW6IwEeY2rpazJcY1r5PjmPErbvwmnWZM5CIVqC+YYvttnCWftF1eOZhIsTb0xHKKV59pun8IwC0Tw4ikXDLu8IxuBbdDGzNA2sH/GlQdjKohBcvBZhit19uvCUzRmmLY/h9Ue8uxGQaRb97sCgYEAx3Nb1YAzB1+OzMKtp8VpWNvmFfdhN7dN8ge/frciK2T5PVQm+yZNTsjETDx9hFThNnlWgTIameD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响应:

  • 支付宝:APP支付

  • 请求:

{"appid":"2015120800939352","body":"支付测试Subject","notify_url":"xxx/alipay/notify_url","out_trade_no":"092719420415065","payChannel":"ZFB","payMode":"apppay","privateKey":"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC66wk/uAjV0vpxLY2hTxTjFT+0Huwqf4fZc8ahG4ZySeNdQb4xIfvMUh78as9FY1HqMF8UgmvaFd5mv/sIQ0cD0g7M4OFHRrJML0RrmEu/A/W2QZ3ZhN6zThhp4oD18BeVDf1dUyiv5bqDckbntIfDWH7ICJiCvAUcLBwyY0xQ5njUp/yhv1tFbEN6Iawr+MHUJcaT6S+FcGbXLcD8ovx3juvqyRQwf7n5xRbdX5DjzFEtNd8V62LpQscv+VN57zxE2Dmn+Lbw3FVeJW70zEstn7PyRNvxdCPrUK2Ml4LlOKLWYl23qHbD1nsDynD3qf41j7A9QZSuzxXRN9fEZlkHAgMBAAECggEBALU2B9FuaaJi18nBj/1C3c0JXKkTEYJiASIfzAGE3eMPHw3aHrkjaSm8s62jHy72CwQvwP3xMv5LFUIn/QcVslNR4mdd3Qls0I5rhLmK/GRDQoNfOdkXp4/Ntn1wyfWkvjgTR/6iEF/3J8snjvYzXytTMBZdvv1/qrSVTwDKo8IJBEbLEcodI3nhyuK7wO8jhldVd3OztEc1KdGnCopDvKcsy/nPl0Mok93SKHhF01QjemakmKlfXBf989iiahNMLSo2Sru9XBCXuJVdcQThdQ66o/8SIaWOjfKQDTrh8qvxu+DzHOz2jjVCObWkktBhaO5W3gV4MPAyhL1qmjPix4ECgYEA7+oJEnsIgGqljSIONVoZmyVkkfPW6IwEeY2rpazJcY1r5PjmPErbvwmnWZM5CIVqC+YYvttnCWftF1eOZhIsTb0xHKKV59pun8IwC0Tw4ikXDLu8IxuBbdDGzNA2sH/GlQdjKohBcvBZhit19uvCUzRmmLY/h9Ue8uxGQaRb97sCgYEAx3Nb1YAzB1+OzMKtp8VpWNvmFfdhN7dN8ge/fr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return_url":"xxx/alipay/return_url","total_fee":"1"}
  • 响应:获取返回数据中的body,由APP唤起支付宝支付
{"msg":null,"code":"SUCCESS","data":{"body":"alipay_sdk=alipay-sdk-java-dynamicVersionNo&app_id=2015120800939352&biz_content=%7B%22out_trade_no%22%3A%22%22%2Brequest.getOut_trade_no%28%29%2B%22%22%2C%22total_amount%22%3A%221%22%2C%22subject%22%3A%22%E6%94%AF%E4%BB%98%E6%B5%8B%E8%AF%95Subject%22%2C%22passback_params%22%3A%22null%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&charset=UTF-8&format=json&method=alipay.trade.app.pay&notify_url=xxx%2Falipay%2Fnotify_url&return_url=xxx%2Falipay%2Freturn_url&sign=caPWDBzKAmdgH7Pb8pxWFnsn6%2FoV0vZROD%2BP2Db6yhzCYyIZblr4OjQizYgfnR3jD69Qm6GYPciaXSrKmuHw4n%2BCIjtCXWfIHJM5nuaIt%2Bn6ZhRGv3GLNNfhvQwJ0Mb11C7M62dwtbp%2FnQYLsnSU%2BAjn0%2FmDvDj11cIdb8SCIZiHIVS7ZIm5dosUyyyFBJ57a7NuSpR4Jv2nrMFw0lEINWGe%2BDIA0%2FQoGK1YvEIf9d0YgIuG6VL41b3Mi3ddCwD1IIewAjL%2Bqwy9YlTwm0n5Yb4u3DsLHJcSX0%2Bo%2BPlmQWQM9Liu4q91LFXIoSyEfMMvw2A9kkF4GJ5Lam5RJ1P5rQ%3D%3D&sign_type=RSA2&timestamp=2017-09-27+19%3A42%3A04&version=1.0"}}
 类似资料: