1.提交各种申请
2.通过后进入支付宝开放平台 --> 管理中心 -->创建应用 --> 填写相关信息 提交等待审核通过(1,2天)
3.下载集成包(https://doc.open.alipay.com/doc2/detail.htm?treeId=54&articleId=104509&docType=1)(标的是iOS&Android版资源,,实际里面包含服务器的集成包)
4. 根据提示生成密钥
6.代码集成
function get_paystr($order_sn,$amount){ require_once './alipay/lib/alipay_core.function.php'; require_once './alipay/lib/alipay_rsa.function.php'; $private_key_path = './alipay/key/pkcs.pem'; //自己的私钥 $params = array(); $params['service'] = 'mobile.securitypay.pay'; $params['partner'] = '2088221232679592'; //PID $params['notify_url'] = 'http://xxx.com/alipay/notify_url.php'; //回调地址 $params['_input_charset'] = 'utf-8'; $params['out_trade_no'] = $order_sn; //自己的订单号 $params['subject'] = '支付商品费用'; $params['seller_id'] = '1234565@qq.com'; //支付宝登录账号
$params['body'] = ''; $params['total_fee'] = $amount; //总支付金额
$params['payment_type'] = '1'; $params['it_b_pay'] = '30m'; $params['show_url'] = 'm.alipay.com'; $para_filter = paraFilter($params); //对待签名参数数组排序 $para_sort = argSort($para_filter); //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 $prestr = createLinkstring($para_sort); $sign = rsaSign($prestr,$private_key_path); $params['sign'] = urlencode($sign); $params['sign_type'] = 'RSA'; $a = createLinkstring($params); return base64_encode($a); //此处把参数传给客户端即可
}