本文整理汇总了PHP中AlipaySubmit::buildRequestHttp方法的典型用法代码示例。如果您正苦于以下问题:PHP AlipaySubmit::buildRequestHttp方法的具体用法?PHP AlipaySubmit::buildRequestHttp怎么用?PHP AlipaySubmit::buildRequestHttp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlipaySubmit
的用法示例。
在下文中一共展示了AlipaySubmit::buildRequestHttp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit
public function submit()
{
//请求业务参数详细
$req_data = '<direct_trade_create_req><notify_url>' . $this->notify_url . '</notify_url><call_back_url>' . $this->call_back_url . '</call_back_url><seller_account_name>' . $this->seller_email . '</seller_account_name><out_trade_no>' . $this->out_trade_no . '</out_trade_no><subject>' . $this->subject . '</subject><total_fee>' . $this->total_fee . '</total_fee></direct_trade_create_req>';
//必填
//构造要请求的参数数组,无需改动
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $this->format, "v" => $this->v, "req_id" => $this->req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
//URLDECODE返回的信息
$html_text = urldecode($html_text);
//解析远程模拟提交后返回的信息
$para_html_text = $alipaySubmit->parseResponse($html_text);
//获取request_token
$request_token = $para_html_text['request_token'];
/**************************根据授权码token调用交易接口alipay.wap.auth.authAndExecute**************************/
//业务详细
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
//必填
//构造要请求的参数数组,无需改动
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $this->format, "v" => $this->v, "req_id" => $this->req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter, 'get', '正在跳转支付页面...');
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付宝即时到账交易接口接口</title>
</head>' . $html_text . '
</body>
</html>';
}
示例2: send
/**
* @brief 开始向接口发送数据
* @param $data array 订单和配送数据
*/
public function send($data)
{
require_once dirname(__FILE__) . "/lib/alipay_submit.class.php";
/* if(isset($data['seller_id']) && $data['seller_id'] > 0 ){
//获取商户的支付配置信息
$sellPay = new IModel("seller_payment");
$sellers = $sellPay->getObj("seller_id = ".$data['seller_id']);
if(empty($sellers)){
return false;
}
} */
$alipay_config = array('partner' => Payment::getConfigParam($data['pay_type'], 'M_PartnerId'), 'key' => Payment::getConfigParam($data['pay_type'], 'M_PartnerKey'), 'sign_type' => strtoupper('MD5'), 'input_charset' => strtolower('utf-8'), 'cacert' => getcwd() . '/cacert.pem', 'transport' => 'http');
//支付宝交易号
$trade_no = $data['trade_no'];
//必填
//物流公司名称
$logistics_name = $data['freight_type'];
//必填
//物流发货单号
$invoice_no = $data['delivery_code'];
//物流运输类型 三个值可选:POST(平邮)、EXPRESS(快递)、EMS(EMS)
$transport_type = 'EXPRESS';
//构造要请求的参数数组,无需改动
$parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($alipay_config['partner']), "trade_no" => $trade_no, "logistics_name" => $logistics_name, "invoice_no" => $invoice_no, "transport_type" => $transport_type, "_input_charset" => trim(strtolower('utf-8')));
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($parameter);
}
示例3: buildForm
public function buildForm($request)
{
//构造要请求的参数数组,无需改动
$req_id = date('Ymdhis');
$req_data = '<direct_trade_create_req><notify_url>' . $this->notify_url . '</notify_url><call_back_url>' . $this->call_back_url . '</call_back_url><seller_account_name>' . $this->seller_email . '</seller_account_name><out_trade_no>' . $request->out_trade_no . '</out_trade_no><subject>' . $request->subject . '</subject><total_fee>' . $request->total_fee . '</total_fee><merchant_url>' . $this->merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($this->partner), "key" => $this->key, 'sec_id' => $this->sign_type, "format" => $this->format, "v" => $this->v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->_input_charset)));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
//URLDECODE返回的信息
$html_text = urldecode($html_text);
//解析远程模拟提交后返回的信息
$para_html_text = $alipaySubmit->parseResponse($html_text);
//获取request_token
$request_token = $para_html_text['request_token'];
/**************************根据授权码token调用交易接口alipay.wap.auth.authAndExecute**************************/
//业务详细
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
//必填
//构造要请求的参数数组,无需改动
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($this->partner), 'sec_id' => $this->sign_type, "format" => $this->format, "v" => $this->v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->_input_charset)));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
return $alipaySubmit->buildRequestForm($parameter, "get", "确认");
}
示例4: send
public function send($trade_no, $logistics_name, $invoice_no)
{
require_once "lib/alipay_submit.class.php";
$alipaySubmit = new AlipaySubmit($this->config);
$parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($this->config['partner']), "trade_no" => $trade_no, "logistics_name" => $logistics_name, "invoice_no" => $invoice_no, "transport_type" => 'EXPRESS', "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
$html_text = $alipaySubmit->buildRequestHttp($parameter);
}
示例5: config
public function config($config = null)
{
$format = "xml";
$req_id = date('Ymdhis');
$merchant_url = "";
$notify_url = $config['NotifyUrl'];
$return_url = $config['ReturnUrl'];
$seller_email = $config['pay_type_data']['user']['val'];
$out_trade_no = $config['code'];
$subject = $config['title'];
$total_fee = $config['money'];
$wapalipay_config_id = trim($config['id']);
$wapalipay_config_key = trim($config['key']);
$wapalipay_config_input_charset = strtolower('utf-8');
$wapalipay_config_sign_type = strtoupper('MD5');
$wapalipay_config_input_charset = strtolower('utf-8');
$wapalipay_config_cacert = dirname(__FILE__) . DIRECTORY_SEPARATOR . "wapalipay" . DIRECTORY_SEPARATOR . "cacert.pem";
$wapalipay_config_private_key_path = '.' . DIRECTORY_SEPARATOR . 'wapalipay' . DIRECTORY_SEPARATOR . 'rsa_private_key.pem';
$wapalipay_config_ali_public_key_path = '.' . DIRECTORY_SEPARATOR . 'wapalipay' . DIRECTORY_SEPARATOR . 'alipay_public_key.pem';
$wapalipay_config_transport = 'http';
$wapalipay_config = array("partner" => $wapalipay_config_id, "key" => $wapalipay_config_key, "private_key_path" => $wapalipay_config_private_key_path, "ali_public_key_path" => $wapalipay_config_ali_public_key_path, "sign_type" => $wapalipay_config_sign_type, "input_charset" => $wapalipay_config_input_charset, "cacert" => $wapalipay_config_cacert, "transport" => $wapalipay_config_transport);
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $return_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($config['id']), "sec_id" => $wapalipay_config_sign_type, "format" => $format, "v" => "2.0", "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => $wapalipay_config_input_charset);
$wapalipaySubmit = new AlipaySubmit($wapalipay_config);
$html_text = $wapalipaySubmit->buildRequestHttp($para_token);
$html_text = urldecode($html_text);
$para_html_text = $wapalipaySubmit->parseResponse($html_text);
$request_token = $para_html_text['request_token'];
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($config['id']), "sec_id" => $wapalipay_config_sign_type, "format" => $format, "v" => "2.0", "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => $wapalipay_config_input_charset);
$wapalipaySubmit = new AlipaySubmit($wapalipay_config);
$this->url = $wapalipaySubmit->buildRequestForm($parameter, 'get', '确认');
}
示例6: pay
public function pay()
{
$orderName = htmlentities($_GET['orderName']);
$orderid = htmlentities($_GET['orderid']);
$from = htmlentities($_GET['from']);
if (!$orderName) {
$orderName = microtime();
}
if (!$orderid) {
$orderid = htmlentities($_GET['single_orderid']);
}
$payHandel = new payHandle($this->token, $from, 'alipay');
$orderInfo = $payHandel->beforePay($orderid);
$price = $orderInfo['price'];
if ($orderInfo['paid']) {
exit('您已经支付过此次订单!');
}
if (!$price) {
exit('必须有价格才能支付');
}
require_once $this->base_path . 'lib/alipay_submit.class.php';
$format = 'xml';
$v = '2.0';
$req_id = date('Ymdhis');
if (($_GET['platform'] || $_GET['pl']) && C('platform_open') && C('platform_alipay_open')) {
$query_string_base = 'token=' . $this->token . '|wecha_id=' . $this->wecha_id . '|from=' . $from . '|pl=1';
$query_string_base_notify = 'token||' . $this->token . '|wecha_id||' . $this->wecha_id . '|from||' . $from . '|pl||1';
}
else {
$query_string_base = 'token=' . $this->token . '|wecha_id=' . $this->wecha_id . '|from=' . $from;
$query_string_base_notify = 'token||' . $this->token . '|wecha_id||' . $this->wecha_id . '|from||' . $from;
}
$notify_url = C('site_url') . '/wxpay/alipaytype_notify_url.php?user_params=' . $query_string_base_notify;
$call_back_url = C('site_url') . '/wxpay/alipaytype_call_back_url.php?user_params=' . $query_string_base;
$merchant_url = C('site_url') . '/wxpay/alipaytype_break.php';
$out_trade_no = $orderid;
$subject = $orderName;
$total_fee = $price;
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . trim($this->alipay_config['seller_email']) . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array('service' => 'alipay.wap.trade.create.direct', 'partner' => trim($this->alipay_config['partner']), 'sec_id' => trim($this->alipay_config['sign_type']), 'format' => $format, 'v' => $v, 'req_id' => $req_id, 'req_data' => $req_data, '_input_charset' => trim(strtolower($this->alipay_config['input_charset'])));
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
$html_text = urldecode($html_text);
$para_html_text = $alipaySubmit->parseResponse($html_text);
$request_token = $para_html_text['request_token'];
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
$parameter = array('service' => 'alipay.wap.auth.authAndExecute', 'partner' => trim($this->alipay_config['partner']), 'sec_id' => trim($this->alipay_config['sign_type']), 'format' => $format, 'v' => $v, 'req_id' => $req_id, 'req_data' => $req_data, '_input_charset' => trim(strtolower($this->alipay_config['input_charset'])));
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter, 'get', '确认');
header('Content-type: text/html; charset=utf-8');
echo $html_text;
}
示例7: send
public function send($post)
{
require_once "lib/alipay_submit.class.php";
$parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($this->alipay_config['partner']), "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])), "trade_no" => $post['trade_no'], "logistics_name" => "无需物流", "invoice_no" => "", "transport_type" => "DIRECT", "create_transport_type" => "DIRECT", "seller_ip" => "");
$this->alipay_config['cacert'] = $this->cacert;
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($parameter);
return $html_text;
}
示例8: buildRequestHttp
public function buildRequestHttp($request)
{
$rs = $request->getParams();
$parameter = array('partner' => $this->partner, '_input_charset' => $this->input_charset);
$parameter = array_merge($parameter, $rs);
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($parameter);
return $html_text;
}
示例9: date
/**
* 生成支付代码
* @param array $order 订单信息
* @param array $payment 支付方式信息
*/
function get_wappay_url($order, $payment)
{
$order_id = $order['order_id'];
$order_desc = $order['order_sn'];
$order_sn = $order['order_sn'];
$amount = $order['order_amount'];
$ecmobile_url = ecmobile_url();
//修正配置文件路径
$this->alipay_config = $this->modify_config_path($this->alipay_config);
$format = "xml";
//返回格式
$v = "2.0";
$req_id = date('Ymdhis');
//请求号
$notify_url = $ecmobile_url . "/payment/alipay/wap/notify_url.php";
//服务器异步通知页面路径
$call_back_url = $ecmobile_url . "/payment/wap_callback.php?code=alipay";
//页面跳转同步通知页面路径
$merchant_url = $ecmobile_url . "/payment/wap_merchant.php?code=alipay";
//操作中断返回地址
$seller_email = 'pay@geek-zoo.com';
//卖家支付宝帐户
$out_trade_no = $order_sn;
//商户订单号
$subject = $order_desc;
//订单名称
$total_fee = $amount;
//付款金额
//请求业务参数详细
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
$html_text = urldecode($html_text);
//解析远程模拟提交后返回的信息
$para_html_text = $alipaySubmit->parseResponse($html_text);
//获取request_token
$request_token = $para_html_text['request_token'];
if ($request_token) {
//业务详细
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
//构造要请求的参数数组,无需改动
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$url = $alipaySubmit->alipay_gateway_new . $alipaySubmit->buildRequestParaToString($parameter);
return $url;
} else {
return false;
}
}
示例10: submit
public function submit($param)
{
$this->format = 'xml';
$this->v = '2.0';
$this->req_id = date('Ymdhis');
$this->notify_url = MOBILE_SITE_URL . '/api/payment/alipay/notify_url.php';
$this->call_back_url = MOBILE_SITE_URL . '/api/payment/alipay/call_back_url.php';
$this->seller_email = $param['alipay_account'];
//v3-b11
$this->out_trade_no = $param['order_sn'] . '-' . $param['order_type'];
$this->subject = $param['order_sn'];
$this->total_fee = $param['order_amount'];
$this->alipay_config = array('partner' => $param['alipay_partner'], 'key' => $param['alipay_key'], 'private_key_path' => 'key/rsa_private_key.pem', 'ali_public_key_path' => 'key/alipay_public_key.pem', 'sign_type' => 'MD5', 'input_charset' => 'utf-8', 'cacert' => getcwd() . '\\cacert.pem', 'transport' => 'http');
//请求业务参数详细
$req_data = '<direct_trade_create_req><notify_url>' . $this->notify_url . '</notify_url><call_back_url>' . $this->call_back_url . '</call_back_url><seller_account_name>' . $this->seller_email . '</seller_account_name><out_trade_no>' . $this->out_trade_no . '</out_trade_no><subject>' . $this->subject . '</subject><total_fee>' . $this->total_fee . '</total_fee></direct_trade_create_req>';
//必填
//构造要请求的参数数组,无需改动
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $this->format, "v" => $this->v, "req_id" => $this->req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
//URLDECODE返回的信息
$html_text = urldecode($html_text);
//解析远程模拟提交后返回的信息
$para_html_text = $alipaySubmit->parseResponse($html_text);
//获取request_token
$request_token = $para_html_text['request_token'];
/**************************根据授权码token调用交易接口alipay.wap.auth.authAndExecute**************************/
//业务详细
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
//必填
//构造要请求的参数数组,无需改动
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $this->format, "v" => $this->v, "req_id" => $this->req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter, 'get', '正在跳转支付页面...');
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付宝即时到账交易接口接口</title>
</head>' . $html_text . '
</body>
</html>';
}
示例11: send
/**
* @brief 开始向接口发送数据
* @param $data array 订单和配送数据
*/
public function send($data)
{
require_once dirname(__FILE__) . "/lib/alipay_submit.class.php";
$alipay_config = array('partner' => $data['partner_id'], 'key' => $data['partner_key'], 'sign_type' => strtoupper('MD5'), 'input_charset' => strtolower('utf-8'), 'cacert' => getcwd() . '/cacert.pem', 'transport' => 'http');
//支付宝交易号
$trade_no = $data['trade_no'];
//必填
//物流公司名称
$logistics_name = $data['freight_type'];
//必填
//物流发货单号
$invoice_no = $data['delivery_code'];
//物流运输类型 三个值可选:POST(平邮)、EXPRESS(快递)、EMS(EMS)
$transport_type = 'EXPRESS';
//构造要请求的参数数组,无需改动
$parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($alipay_config['partner']), "trade_no" => $trade_no, "logistics_name" => $logistics_name, "invoice_no" => $invoice_no, "transport_type" => $transport_type, "_input_charset" => trim(strtolower('utf-8')));
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($parameter);
}
示例12: startAlipay
public function startAlipay()
{
$order_sn = $this->_get('order_sn');
$token = $this->_get('token');
Log::record($token . ':' . $order_sn);
if (empty($order_sn) || empty($token)) {
Log::record('startAlipay: ' . print_r($_GET, true));
Log::save();
$this->error('请输入订单号');
}
$order = M('b2c_order')->where(array('sn' => $order_sn, 'token' => $token, 'status' => 1))->find();
if (!$order) {
$this->error('订单号不正确');
}
$shop = M('b2c_shop')->where(array('token' => $token))->find();
if (!$shop) {
$this->error('商城不存在');
}
$alipay = M('b2c_payment')->where(array('token' => $token, 'pay_code' => 'alipay'))->find();
$alipay_config = array();
if (is_string($alipay['pay_config'])) {
$store = unserialize($alipay['pay_config']);
$alipay_config['pay_account'] = $store['pay_account'];
//合作身份者id,以2088开头的16位纯数字
$alipay_config['partner'] = $store['alipay_pid'];
//安全检验码,以数字和字母组成的32位字符
//如果签名方式设置为“MD5”时,请设置该参数
$alipay_config['key'] = $store['alipay_key'];
//商户的私钥(后缀是.pen)文件相对路径
//如果签名方式设置为“0001”时,请设置该参数
//$alipay_config['private_key_path'] = getcwd()."/Conf/Wap/key/".$shop['token']."_rsa_private_key.pem";
//支付宝公钥(后缀是.pen)文件相对路径
//如果签名方式设置为“0001”时,请设置该参数
//$alipay_config['ali_public_key_path']= getcwd().'/Conf/Wap/key/'.$shop['token'].'_alipay_public_key.pem';
//签名方式 不需修改
$alipay_config['sign_type'] = 'MD5';
//'0001';
//字符编码格式 目前支持 gbk 或 utf-8
$alipay_config['input_charset'] = 'utf-8';
//ca证书路径地址,用于curl中ssl校验
//请保证cacert.pem文件在当前文件夹目录中
$alipay_config['cacert'] = getcwd() . '\\Conf\\Wap\\key\\cacert.pem';
//访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
$alipay_config['transport'] = 'http';
}
Log::record('alipay_config Args:' . print_r($alipay_config, true), Log::INFO);
//返回格式
$format = "xml";
//必填,不需要修改
//返回格式
$v = "2.0";
//必填,不需要修改
//请求号
$req_id = date('Ymdhis') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
//必填,须保证每次请求都是唯一
//**req_data详细信息**
//服务器异步通知页面路径
$notify_url = C('site_url') . '/index.php/alipay/notify';
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$call_back_url = C('site_url') . '/index.php/alipay/return_url';
//需http://格式的完整路径,不允许加?id=123这类自定义参数
//操作中断返回地址
$merchant_url = "http://" . $shop['token'] . ".shop.weixinwz.com/";
//用户付款中途退出返回商户的地址。需http://格式的完整路径,不允许加?id=123这类自定义参数
//卖家支付宝帐户
$seller_email = trim($alipay_config['pay_account']);
//必填
//商户订单号
$out_trade_no = $order['sn'];
//商户网站订单系统中唯一订单号,必填
//订单名称
$subject = '订单' . $order['sn'] . '支付';
//必填
//付款金额
$total_fee = $order['price'];
//必填
//请求业务参数详细
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
//构造要请求的参数数组,无需改动
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
Log::record('para_token Args:' . print_r($para_token, true), Log::INFO);
$trade = M('b2c_trade')->where(array('order_sn' => $order_sn, 'token' => $shop['token']))->find();
if ($trade == null) {
$time = time();
$data = array('subject' => $subject, 'name' => $order['truename'], 'order_sn' => $out_trade_no, 'price' => $total_fee);
$data['create_time'] = $time;
$data['update_time'] = $time;
$data['token'] = $shop['token'];
$ret = M('b2c_trade')->data($data)->add();
} else {
if ($trade['trade_no']) {
$this->error('已支付');
}
}
import("@.ORG.AliWapPay.AlipaySubmit");
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
//URLDECODE返回的信息
//.........这里部分代码省略.........
示例13: array
//支付宝交易号
$trade_no = $_POST['WIDtrade_no'];
//必填
//物流公司名称
$logistics_name = $_POST['WIDlogistics_name'];
//必填
//物流发货单号
$invoice_no = $_POST['WIDinvoice_no'];
//物流运输类型
$transport_type = $_POST['WIDtransport_type'];
//三个值可选:POST(平邮)、EXPRESS(快递)、EMS(EMS)
/************************************************************/
//构造要请求的参数数组,无需改动
$parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($instance->config['partner']), "trade_no" => $trade_no, "logistics_name" => $logistics_name, "invoice_no" => $invoice_no, "transport_type" => $transport_type, "_input_charset" => trim(strtolower($instance->config['input_charset'])));
});
//建立请求
$alipaySubmit = new AlipaySubmit($pay->config);
$html_text = $alipaySubmit->buildRequestHttp($pay->param);
//解析XML
//注意:该功能PHP5环境及以上支持,需开通curl、SSL等PHP配置环境。建议本地调试时使用PHP开发软件
$doc = new DOMDocument();
$doc->loadXML($html_text);
//请在这里加上商户的业务逻辑程序代码
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
//获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
//解析XML
if (!empty($doc->getElementsByTagName("alipay")->item(0)->nodeValue)) {
$alipay = $doc->getElementsByTagName("alipay")->item(0)->nodeValue;
echo $alipay;
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
示例14: array
//必填
//付款金额
$pay_price = $pay['total_fee'];
//商户订单号
$out_trade_no = $pay['out_trade_no'];
$total_fee = $pay['total_fee'];
//必填
//请求业务参数详细
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee></direct_trade_create_req>';
//必填
/************************************************************/
//构造要请求的参数数组,无需改动
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
//URLDECODE返回的信息
$html_text = urldecode($html_text);
//解析远程模拟提交后返回的信息
$para_html_text = $alipaySubmit->parseResponse($html_text);
//获取request_token
$request_token = $para_html_text['request_token'];
/**************************根据授权码token调用交易接口alipay.wap.auth.authAndExecute**************************/
//业务详细
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
//必填
//构造要请求的参数数组,无需改动
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
//print_r($parameter); exit;
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
示例15: orderWapPay
public function orderWapPay($orderGlideId)
{
$orderPayGlideService = utils::getService('orderPayGlide');
$orderGlideInfo = $orderPayGlideService->find($orderGlideId);
$alipay_config = utils::c('aliwappay');
$format = "xml";
$v = "2.0";
$req_id = date('Ymdhis');
$notify_url = utils::c('siteUrl') . '/mobile/order/ali-pay-notify';
$call_back_url = utils::c('siteUrl') . '/mobile/order/ali-pay-back';
$merchant_url = utils::c('siteUrl') . '/mobile/order';
$out_trade_no = $orderGlideInfo['glide_nums'];
$subject = '宅配订单' . $orderGlideInfo['glide_nums'];
$total_fee = $orderGlideInfo['total'];
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . trim($alipay_config['seller_email']) . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
$html_text = urldecode($html_text);
$para_html_text = $alipaySubmit->parseResponse($html_text);
$request_token = $para_html_text['request_token'];
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
$alipaySubmit = new AlipaySubmit($alipay_config);
$htmlText = $alipaySubmit->buildRequestForm($parameter, 'get', '支付宝支付');
return $htmlText;
}