search
Homephp教程php手册电商网站使用支付宝转账付款功能代替支付宝支付接口

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

<?php

/**
 * ECSHOP 支付宝转账付款功能,配合我们的支付通软件,可实现全自动订单付款状态更新、会员自动充值功能!
   现在支付宝商户对于商家接入支付宝即时到账接口管理比较严格,一般都是需要企业账户才能申请开通即时到账接口的。这对于大部分个人商家来说,无疑不利于快速回笼资金。本接口通过一个变通的方式,利用支付宝系统中的转账付款功能,来跟自己的商城实现对接,让客户在下单后直接跳转到这个支付宝的转账付款页面,然后输入自己的账号密码,就可以给自己的账号付款了。配合我们提供的【支付通】软件,可以实现24小时自动更新网站订单状态,自动为会员充值等功能。请进入我们的官方网站下载软件并使用吧!
 * ====================================================================================================
 * 版权所有 2010-2015 支付通,并保留所有权利。
 * ====================================================================================================
 */

if (!defined(&#39;IN_ECS&#39;))
{
    die(&#39;Hacking attempt&#39;);
}

$payment_lang = ROOT_PATH . &#39;languages/&#39; .$GLOBALS[&#39;_CFG&#39;][&#39;lang&#39;]. &#39;/payment/alipayeasypay.php&#39;;

if (file_exists($payment_lang))
{
    global $_LANG;

    include_once($payment_lang);
}

/* 模块的基本信息 */
if (isset($set_modules) && $set_modules == TRUE)
{
    $i = isset($modules) ? count($modules) : 0;

    /* 代码 */
    $modules[$i][&#39;code&#39;]    = basename(__FILE__, &#39;.php&#39;);

    /* 描述对应的语言项 */
    $modules[$i][&#39;desc&#39;]    = &#39;alipayeasypay_desc&#39;;

    /* 是否支持货到付款 */
    $modules[$i][&#39;is_cod&#39;]  = &#39;0&#39;;

    /* 是否支持在线支付 */
    $modules[$i][&#39;is_online&#39;]  = &#39;1&#39;;

    /* 作者 */
    $modules[$i][&#39;author&#39;]  = &#39;yiditushe(老曹)&#39;;

    /* 网址 */
    $modules[$i][&#39;website&#39;] = &#39;http://easypay.myshopex.com/&#39;;

    /* 版本号 */
    $modules[$i][&#39;version&#39;] = &#39;1.0.0&#39;;

    /* 配置信息 */
    $modules[$i][&#39;config&#39;]  = array(
        array(&#39;name&#39; => &#39;alipayeasypay_account&#39;,           &#39;type&#39; => &#39;text&#39;,   &#39;value&#39; => &#39;&#39;),
        array(&#39;name&#39; => &#39;alipayeasypay_key&#39;,               &#39;type&#39; => &#39;text&#39;,   &#39;value&#39; => &#39;&#39;),
        array(&#39;name&#39; => &#39;alipayeasypay_mobile&#39;,           &#39;type&#39; => &#39;text&#39;,   &#39;value&#39; => &#39;&#39;),
    );

    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(&#39;EC_CHARSET&#39;))
        {
            $charset = &#39;utf-8&#39;;
        }
        else
        {
            $charset = EC_CHARSET;
        }
		
        $parameter = array(
            &#39;optEmail&#39;      => $payment[&#39;alipayeasypay_account&#39;],
			&#39;payAmount&#39;      => $order[&#39;order_amount&#39;],
        );
		if($order[&#39;order_id&#39;]){
			$parameter[&#39;title&#39;]= $order[&#39;order_sn&#39;]."|".$order[&#39;log_id&#39;];
			$parameter[&#39;memo&#39;]= ("订单号:".$order[&#39;order_sn&#39;]);
		}else{
			$parameter[&#39;title&#39;]= $order[&#39;log_id&#39;]."|".$order[&#39;log_id&#39;];
			$parameter[&#39;memo&#39;]= ("会员充值:".$order[&#39;user_name&#39;]);
		}		
		if($payment[&#39;alipayeasypay_mobile&#39;]){
			$parameter[&#39;smsNo&#39;]= $payment[&#39;alipayeasypay_mobile&#39;];
		}
		
		$button = &#39;<p style="text-align:center;" ><form id="__allpayForm" accept-charset="gbk" method="post" onsubmit="document.charset=\&#39;gbk\&#39;;" target="_blank" action="https://shenghuo.alipay.com/send/payment/fill.htm">&#39;;
		foreach ($parameter as $keys => $value) {
			$button .="<input type=&#39;hidden&#39; name=&#39;$keys&#39; value=&#39;$value&#39; />";
		}
		$button .= &#39;<input type="submit" id="__paymentButton" value="&#39; . $GLOBALS[&#39;_LANG&#39;][&#39;pay_button&#39;] . &#39;" />&#39;;
		$button .= &#39;</form></p>&#39;;

        return $button;
    }

    /**
     * 响应操作
     */
    function respond()
    {
        if (!empty($_POST))
        {
            foreach($_POST as $key => $data)
            {
                $_GET[$key] = $data;
            }
        }
        $payment  = get_payment($_GET[&#39;code&#39;]);

		$sig = $_GET[&#39;sig&#39;];//签名
		$tradeno = $_GET[&#39;tradeNo&#39;];//交易号
		$desc = $_GET[&#39;desc&#39;];//交易名称(付款说明)
		$time = $_GET[&#39;time&#39;];//付款时间
		$username = $_GET[&#39;username&#39;];//客户名称
		$userid = $_GET[&#39;userid&#39;];//客户id
		$money = $amount = $_GET[&#39;amount&#39;];//交易额
		$status = $_GET[&#39;status&#39;];//交易状态

		$order_sn_logid = str_replace("付款-", "", $desc);
		
		$key = $payment[&#39;alipayeasypay_key&#39;];
		//验证签名
		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;
		}
    }
}

?>

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

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

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

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

相关文章:

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

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

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

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

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function