给支付宝接口增加收货地址等参数,跳转到支付页不需再次填写地址 ...

适用范围:适用于中介担保支付(2.7版本)

官方的支付宝接口里没有挂地址,收货人,邮编等参数,从而到了支付页面还要填写一遍地址,收货人,比较的麻烦

增加地址,收货人参数后就不再重复劳动了。

修改以下地方:

1.flow.php

找到

[代码]php代码:

$order['log_id'] = insert_pay_log($new_order_id, $order['order_amount'], PAY_ORDER);

在其后加入:

[代码]php代码:

$order['buyer_region'] = get_buyer_region($new_order_id);

在flow.php文件底部加入如下函数:

[代码]php代码:

function get_buyer_region($order_id){        $sql = "SELECt concat(IFNULL(c.region_name, ''),IFNULL(p.region_name, ''), " .                    " IFNULL(t.region_name, ''), IFNULL(d.region_name, '')) AS region " .                "FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS c ON o.country = c.region_id " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS p ON o.province = p.region_id " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS t ON o.city = t.region_id " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS d ON o.district = d.region_id " .                "WHERe o.order_id = '$order_id'";    return $GLOBALS['db']->getOne($sql);}

2.includesmodulespaymentalipy.php

找到

[代码]php代码:

'seller_email'      => $payment['alipay_account'],

在其后增加如下配置:

[代码]php代码:

'receive_name'         => $order['consignee'],'receive_address'    => $order['buyer_region'].$order['address'],'receive_zip'    => $order['zipcode'],

ps:地址是urldecode过的

官方原版的支付宝地址如下:

https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8&agent=C4335319945672464113&logistics_fee=0&logistics_payment=BUYER_PAY&logistics_type=EXPRESS¬ify_url=http://127.0.0.1/Ecshop/respond.php?code=alipay&out_trade_no=200911105213010&partner=2088002692045431&payment_type=1&price=16.00&quantity=1&return_url=http://127.0.0.1/ecshop/[email protected]&service=trade_create_by_buyer&subject=2009111052130&sign=8894ebd13e248d043f90a6e0c41b6a68&sign_type=MD5

支付宝的地址就变成如下:

https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8&agent=C4335319945672464113&logistics_fee=0&logistics_payment=BUYER_PAY&logistics_type=EXPRESS¬ify_url=http://127.0.0.1/ecshop/respond.php?code=alipay&out_trade_no=200911105213010&partner=2088002692045431&payment_type=1&price=16.00&quantity=1&receive_address=中国广东深圳南山区竹子林1050号&receive_name=侯琳琳&receive_zip=8126743&return_url=http://127.0.0.1/ecshop/[email protected]&service=trade_create_by_buyer&subject=2009111052130&sign=8894ebd13e248d043f90a6e0c41b6a68&sign_type=MD5



一次赞助,终身免费~
欢迎来咨询哦 欢迎来咨询哦