Home > php教程 > php手册 > body text

电商网站使用支付宝转账付款功能代替支付宝支付接口

PHP中文网
Release: 2017-03-27 15:24:03
Original
2418 people have browsed it

现在支付宝商户对于商家接入支付宝即时到账接口管理比较严格,一般都是需要支付宝企业账户才能申请开通即时到账接口的。这对于大部分个人商家来说,无疑不利于快速回笼资金。
本接口通过一个变通的方式,利用支付宝系统中的转账付款功能,来跟自己的商城实现对接,让客户在下单后直接跳转到支付宝的转账付款页面,通过转账付款的方式来给自己的支付宝账号付款。
客户在转账付款界面无需自已填写订单相关信息,程序自动填写。如:收款账号、付款金额、付款备注等信息。客户在网站下单后只管支付就行了。

 'alipayeasypay_account',           'type' => 'text',   'value' => ''),
        array('name' => 'alipayeasypay_key',               'type' => 'text',   'value' => ''),
        array('name' => 'alipayeasypay_mobile',           'type' => 'text',   'value' => ''),
    );

    return;
}

/**
 * 类
 */
class alipayeasypay
{

    /**
     * 构造函数
     *
     * @access  public
     * @param
     *
     * @return void
     */
    function alipayeasypay()
    {
    }

    function __construct()
    {
        $this->alipayeasypay();
    }

    /**
     * 生成支付代码
     * @param   array   $order      订单信息
     * @param   array   $payment    支付方式信息
     */
    function get_code($order, $payment)
    {
        if (!defined('EC_CHARSET'))
        {
            $charset = 'utf-8';
        }
        else
        {
            $charset = EC_CHARSET;
        }
		
        $parameter = array(
            'optEmail'      => $payment['alipayeasypay_account'],
			'payAmount'      => $order['order_amount'],
        );
		if($order['order_id']){
			$parameter['title']= $order['order_sn']."|".$order['log_id'];
			$parameter['memo']= ("订单号:".$order['order_sn']);
		}else{
			$parameter['title']= $order['log_id']."|".$order['log_id'];
			$parameter['memo']= ("会员充值:".$order['user_name']);
		}		
		if($payment['alipayeasypay_mobile']){
			$parameter['smsNo']= $payment['alipayeasypay_mobile'];
		}
		
		$button = '

'; foreach ($parameter as $keys => $value) { $button .=""; } $button .= ''; $button .= '

'; return $button; } /** * 响应操作 */ function respond() { if (!empty($_POST)) { foreach($_POST as $key => $data) { $_GET[$key] = $data; } } $payment = get_payment($_GET['code']); $sig = $_GET['sig'];//签名 $tradeno = $_GET['tradeNo'];//交易号 $desc = $_GET['desc'];//交易名称(付款说明) $time = $_GET['time'];//付款时间 $username = $_GET['username'];//客户名称 $userid = $_GET['userid'];//客户id $money = $amount = $_GET['amount'];//交易额 $status = $_GET['status'];//交易状态 $order_sn_logid = str_replace("付款-", "", $desc); $key = $payment['alipayeasypay_key']; //验证签名 if(strtoupper(md5("$tradeno|$desc|$time|$username|$userid|$amount|$status|$key")) == $sig){ //这里做订单业务,在下面写您的代码即可 //检查付款金额和支付单的金额是否一致,不一致的话,报错处理 /* 检查支付的金额是否相符 */ list($order_sn, $log_id) = explode("|", $order_sn_logid); if (!check_money($log_id, $money)){ echo "支付金额不一致";exit; return false; } /* 改变订单状态 */ order_paid($log_id, 2); echo "ok";exit; return true; }else{ echo "验证签名失败";exit; return false; } } } ?>
Copy after login

电商网站使用支付宝转账付款功能代替支付宝支付接口

电商网站使用支付宝转账付款功能代替支付宝支付接口

电商网站使用支付宝转账付款功能代替支付宝支付接口

电商网站使用支付宝转账付款功能代替支付宝支付接口

相关文章:

支付宝支付接口 单笔交易查询接口

关于支付宝支付接口,我这边php该提供给ios什么?要怎么写?

关于支付宝支付接口,如何设计自动查询订单状态。

电商网站使用支付宝转账付款功能代替支付宝支付接口

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!