接口名称:红包页面支付接口
英文名称:alipay.fund.coupon.order.page.pay
产品首页:[url]https://openclub.alipay.com/read.php?tid=12180&fid=72[/url]
下一步:[url]https://openclub.alipay.com/read.php?tid=13609&fid=72[/url]
一、注意事项
1、适用于用户在商户PC网页进行红包的发放,付款时会链接到支付宝PC登录页面进行登录和后续的支付,在支付成功后跳转回商户页面。
2、红包页面支付接口调用方法必须是pageExecute()。
二、参数说明
1、out_order_no:商户的授权资金订单号,可用于后续打款接口,保持唯一性;
2、out_request_no:商户本次资金操作的请求流水号,同一商户每次不同的资金操作请求,商户请求流水号不要重复;
注:out_order_no不相同的情况下,out_request_no参数值相同可调用成功,建议记录out_order_no参数为准。
3、pay_timeout:最晚付款时间,逾期关闭。取值范围:1m~7d;
三、接口请求示例
JAVA版请求示例
public static void main(String[] args) throws AlipayApiException { //在SDK调用前需要进行初始化 AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, AlipayConfig.format, AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type); AlipayFundCouponOrderPagePayRequest request = new AlipayFundCouponOrderPagePayRequest(); AlipayFundCouponOrderPagePayModel model = new AlipayFundCouponOrderPagePayModel(); //商户的授权资金订单号 (后面可用此参数用于打款接口) model.setOutOrderNo("2017122716463222"); //商户本次资金操作的请求流水号 model.setOutRequestNo("201712271645328"); //业务订单的简单描述,如商品名称等 model.setOrderTitle("红包页面支付接口发送红包"); //支付金额 model.setAmount("0.03"); request.setBizModel(model); request.setNotifyUrl("http://完整的异步地址"); //接口调用方法必须是pageExecute() //get方式生成请求链接 AlipayFundCouponOrderPagePayResponse response = alipayClient.pageExecute(request,"get"); //post方式生成form表单 // AlipayFundCouponOrderPagePayResponse response = alipayClient.pageExecute(request); if(response.isSuccess()){ System.out.println("调用成功"); } else { System.out.println("调用失败"); } System.out.println(response.getBody()); }
get方式获取返回链接:
[url]https://openapi.alipay.com/gateway.do?alipay_sdk=alipay-sdk-java-3.1.0&app_id=2014100900013222&biz_content=%7B%22amount%22%3A%220.03%22%2C%22order_title%22%3A%22%E7%BA%A2%E5%8C%85%E9%A1%B5%E9%9D%A2%E6%94%AF%E4%BB%98%E6%8E%A5%E5%8F%A3%E5%8F%91%E9%80%81%E7%BA%A2%E5%8C%85%22%2C%22out_order_no%22%3A%222017122716463224%22%2C%22out_request_no%22%3A%22201712271645328%22%7D&charset=utf-8&format=json&method=alipay.fund.coupon.order.page.pay¬ify_url=http%3A%2F%2F%E5%AE%8C%E6%95%B4%E7%9A%84%E5%BC%82%E6%AD%A5%E5%9C%B0%E5%9D%80&sign=Rgr0n4Cxdq3Qczaw946o4D%2FQhYOGytEN3u7cAVTQJWkaS%2FuwSgT%2BB0RttUZm4m%2F5W3Iw1na2Rrl%2FcQv5PbCBhrZwf9D8G5v9MeNQb5OvkO%2BXO2kr5s22uDt5isBZMQSc1mnvAzW0W19w3Pf8%2BhPf%2B6wkDTnA8CknB7%2BwGU76ETMMpkLoX4TMH2euPBFBS8pM3RAg00s4hwS07daPF9gZOHg2hyWBDTB2%2Fja4DILyM4WR0MP8acwIOyn7rQVhUJTYFoNXFP2tGFyvFyfqiMLXB3cuVMb6sj5q%2B7OJ48NCsbYyptjQ6M17xvAMANwOvR1u%2F97%2B3mM2tww%2FkDeKVeRq8A%3D%3D&sign_type=RSA2×tamp=2018-10-11+19%3A05%3A17&version=1.0[/url]
post方式获取返回链接:
<form name="punchout_form" method="post" action="https://openapi.alipay.com/gateway.do?charset=utf-8&method=alipay.fund.coupon.order.page.pay&sign=Rgr0n4Cxdq3Qczaw946o4D%2FQhYOGytEN3u7cAVTQJWkaS%2FuwSgT%2BB0RttUZm4m%2F5W3Iw1na2Rrl%2FcQv5PbCBhrZwf9D8G5v9MeNQb5OvkO%2BXO2kr5s22uDt5isBZMQSc1mnvAzW0W19w3Pf8%2BhPf%2B6wkDTnA8CknB7%2BwGU76ETMMpkLoX4TMH2euPBFBS8pM3RAg00s4hwS07daPF9gZOHg2hyWBDTB2%2Fja4DILyM4WR0MP8acwIOyn7rQVhUJTYFoNXFP2tGFyvFyfqiMLXB3cuVMb6sj5q%2B7OJ48NCsbYyptjQ6M17xvAMANwOvR1u%2F97%2B3mM2tww%2FkDeKVeRq8A%3D%3D¬ify_url=http%3A%2F%2F%E5%AE%8C%E6%95%B4%E7%9A%84%E5%BC%82%E6%AD%A5%E5%9C%B0%E5%9D%80&version=1.0&app_id=2014100900013222&sign_type=RSA2×tamp=2018-10-11+19%3A05%3A17&alipay_sdk=alipay-sdk-java-3.1.0&format=json"> <input type="hidden" name="biz_content" value="{"amount":"0.03","order_title":"红包页面支付接口发送红包","out_order_no":"2017122716463224","out_request_no":"201712271645328"}"> <input type="submit" value="立即支付" style="display:none" > </form> <script>document.forms[0].submit();</script>
PHP版请求示例
<?php require_once 'AopSdk.php'; $aop = new AopClient (); $aop->appId = '填写您的appid'; $aop->rsaPrivateKey = '填写您的私钥'; $aop->alipayrsaPublicKey='填写您的支付宝公钥'; $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do'; $aop->apiVersion = '1.0'; $aop->signType = 'RSA2'; $aop->postCharset='utf-8'; $aop->format='json'; $date=date("YmdHis"); $arr=range(1000,9999); shuffle($arr); $request = new AlipayFundCouponOrderPagePayRequest (); $request->setBizContent("{" . ""out_order_no":"2017122716463222"," . ""out_request_no":"201712271645328"," . ""order_title":"红包页面支付接口发送红包"," . // ""pay_timeout":"1h"," . ""amount":0.03" . " }"); // $request->setNotifyUrl('请填写您的异步通知地址'); //get方式 $result = $aop->pageExecute($request,"get"); //post方式 // $result= $aop->pageExecute($request); // echo $result; print_r(htmlspecialchars($result)); ?>
get方式获取返回链接:
[url]https://openapi.alipay.com/gateway.do?alipay_sdk=alipay-sdk-php-20180705&app_id=2014100900013222&biz_content=%7B%22out_order_no%22%3A%222017122716463222%22%2C%22out_request_no%22%3A%22201712271645328%22%2C%22order_title%22%3A%22%E7%BA%A2%E5%8C%85%E9%A1%B5%E9%9D%A2%E6%94%AF%E4%BB%98%E6%8E%A5%E5%8F%A3%E5%8F%91%E9%80%81%E7%BA%A2%E5%8C%85%22%2C%22amount%22%3A0.03++%7D&charset=utf-8&format=json&method=alipay.fund.coupon.order.page.pay&sign=SE2jw8Cpt0O1GhLGAoJjPg7P91F8JsYvps3wBBCaV77%2B5VimrErVSmGPIbzwz8HCtWOF7XTGeazaRwmsnmPGiezw7zh2LgmvI0nCd6op8FpP%2BLnBbiwHlJMjDpVM7437zbIe3oRG%2Byex9kWbpAhGT1vodJWl22NHpd%2BKV27XkNnlFZTGltmoBDC2tt3zOv68Q4vfeZ2FEkcBmcCb%2FsmcyHTprr3McXmxx4%2FtkBJjO670qZVhg56hUSqWMGttVq7yrM0neutaWCB1y%2FxMVaPx5jwYnsSN5ZZ5PpH8GBql7%2B6Y6niCu%2BfEfh7yQxrIbq%2FN0oyaxm3z0NPuJNBdjrf%2FVA%3D%3D&sign_type=RSA2×tamp=2019-03-06+07%3A37%3A52&version=1.0[/url]
post方式获取返回链接:
<form id='alipaysubmit' name='alipaysubmit' action='https://openapi.alipay.com/gateway.do?charset=utf-8' method='POST'><input type='hidden' name='biz_content' value='{"out_order_no":"2017122716463222","out_request_no":"201712271645328","order_title":"红包页面支付接口发送红包","amount":0.03 }'/><input type='hidden' name='app_id' value='2014100900013222'/><input type='hidden' name='version' value='1.0'/><input type='hidden' name='format' value='json'/><input type='hidden' name='sign_type' value='RSA2'/><input type='hidden' name='method' value='alipay.fund.coupon.order.page.pay'/><input type='hidden' name='timestamp' value='2019-03-06 07:58:16'/><input type='hidden' name='alipay_sdk' value='alipay-sdk-php-20180705'/><input type='hidden' name='charset' value='utf-8'/><input type='hidden' name='sign' value='clAk4HqDRy8NMKi3V+KiAJf/TPGj6JlN9QtFmMBVyrR+fajXPs0rjfHwrO9jmNEJ+FeTr7a6enb2S/ZyHhXF3SF0IWlJaKjAe9AUzxL9wF9zHkgxY0pE6ECXY/eeXOeOK0VvFvk72hXpNTifAjXHhIPQtfLkZsdOeR2PPA6YbNjFDA9KVn4Wh4P4GFdKMhafajA0kAdMMnqSfC9DbwANtg5HkIWYXILEjwV2cu/F7dPxIosKt1bF0mxRD+8WK46D/WfuQEAW8Uc9MTg9rndcCsBANjYkha6IfXx2ZlJEuLHQrBq8W0WdAUnHvz6Tw0PurU9CjSyGGf0ZS5UiE1ABIQ=='/>form><script>document.forms['alipaysubmit'].submit();script>
.NET版本请求示例
IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false); AlipayFundCouponOrderPagePayRequest request = new AlipayFundCouponOrderPagePayRequest(); request.BizContent="{" + ""out_order_no":"2017122716463222"," + ""out_request_no":"201712271645328"," + ""order_title":"红包页面支付接口发送红包"," + // ""pay_timeout":"1h"," + ""amount":0.03" + " }"; //get方式生成请求链接 AlipayFundCouponOrderPagePayResponse response = client.pageExecute(request,"","GET"); //post方式生成form表单 // AlipayFundCouponOrderPagePayResponse response = client.pageExecute(request); Response.Write(response.Body);
get方式获取返回链接: