public function androidEnctype() {
$orderId = I('post.order_id');
$payMoney = I('post.payMoney');
$name = I('post.name');
$redid = urlencode('redid='.I('post.redid')); //urlencode一下
// $orderId = '2222234rffvvfghb';
// $payMoney = '0.01';
// $name = '鹅和鸭';
require_once 'Alipay/aop/AopClient.php';
require_once 'Alipay/aop/request/AlipayTradeAppPayRequest.php';
$aop = new \Alipay\aop\AopClient();
$aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
$aop->appId = "2017056";
$aop->rsaPrivateKey = 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCJA/cfwxtcMNbF0GP82UTI96uq21a8gzPDy9SsezpGpH0+c7seJPPJPULSKhCQlGEUgYxL/pLCNw9Fba4pSvN08g2u3HcHBd0w6TH9VjVE7ZSOkh7B5oolcXBhQ3RhrnE1CDJsDmbgUQkPlw1pf4Oh7gwdIGsHc7fbQbFmQ09rPqDEmhzPqasGJw02KXEcu8otOwE6jDntdw+htwNA1yh2mp9e2rCjk9s4lnOpOubmFMaRxH3mBzqXMMTlohtDy0ktffpdc+6YdlU+gahgqYREdprlLtEBRWRoCvMCNUb5MYcp98K0rawwXMfBzjmcvnGEGbHrb5FxlLGpwQKBgC6IgqIUjd9mAk4E6RFX/bo4MFY3Ai5oLYYBAG4k85MY5f43BTl6K1JsJ6AsmaqfG4W9kmX/gMZswqHk+TJhAgaf9TvtpNzadxOIqyzIK2h6gBTs45zIlHISqK6gd+6LqHYZVJ+ZbSCwH6M3Isqjuc1LGIt+9bTfL2VZqtW+8DbxAoGAczpT3cN3k2MmuHxVYB/CzB7wpRT71OFlxvhZhDLcHjkY9GN3qH16aQ3DlCio21Wi/M0gnP3bS0tNwf0zNw1nh0BcmL/gHnQlh5vNwbAisaeg+V0QWFlnNzu04Ue/hjiMOaBjmhIe4ACt9RpPE7rMk2Wo5KuO2rWI7OGQ/gYb4T4=';
$aop->format = "json";
$aop->charset = "UTF-8";
$aop->signType = "RSA2";
$aop->alipayrsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjKBkbh/HDTt3+RhQy/4AQ2fLeabaxBvXav5hn4uIlwlmIXOhDL1n2/cG/2Hrg/JwyOu9pzJOIafSsL+cSUHfCBR+DWwGgY25WHieBRrYKwci1jeJ4TBqFrrWjAjvapRGoAAY5q7E5GkIce/wsFXtj3P+gTB+jOuluKIj5nlF0VcmPFPXAAQEY8PWPoXyaj78iOJAaDL4eCl4/JWohgstZW6gYqln4suLo3A9oAE8aoYPge7mTxPGqRASPwIDAQAB';
//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
$request = new \Alipay\aop\request\AlipayTradeAppPayRequest();
//SDK已经封装掉了公共参数,这里只需要传入业务参数
$bizcontent =
"{\"body\":\"" . $name . "\","
. "\"subject\": \"" . $name . "\","
. "\"out_trade_no\": \"" . $orderId . "\","
. "\"timeout_express\": \"30m\","
. "\"total_amount\": \"" . $payMoney . "\","
. "\"passback_params\": \"" . $redid . "\","
. "\"product_code\":\"QUICK_MSECURITY_PAY\""
. "}";
$request->setNotifyUrl("https://www.coucouchina.com/Api/PayRsa/demoNotify_url");
$request->setBizContent($bizcontent);
//这里和普通的接口调用不同,使用的是sdkExecute
$response = $aop->sdkExecute($request);
// $aaa = $aop->rsaSign($request, 'RSA2');
//htmlspecialchars是为了输出到页面时防止被浏览器将关键参数html转义,实际打印到日志以及http传输不会有这个问题
// echo htmlspecialchars($response);//就是orderString 可以直接给客户端请求,无需再做处理。
$return_info['orderString'] = $response;
//
$this->ajaxReturn($return_info);
}
支付宝支付
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 支付宝简介文档 (适用于ydm-java接口与后台,如有误入,但愿也能给您带来帮助) 此文档写于2017年3月,只...
- 最近做系统,需要实现在线支付功能,毫不犹豫,选择的是支付宝的接口支付功能。这里我用的是即时到帐的接口,具体实现的步...
- 所有的接口支持沙盒环境的测试 1、前言 前面几篇文件详细介绍了 支付宝提现、扫码支付、条码支付、Wap支付、App...