現(xiàn)在支付寶商戶對于商家接入支付寶即時到賬接口管理比較嚴格,一般都是需要支付寶企業(yè)賬戶才能申請開通即時到賬接口的。這對于大部分個人商家來說,無疑不利于快速回籠資金。
本接口通過一個變通的方式,利用支付寶系統(tǒng)中的轉賬付款功能,來跟自己的商城實現(xiàn)對接,讓客戶在下單后直接跳轉到支付寶的轉賬付款頁面,通過轉賬付款的方式來給自己的支付寶賬號付款。
客戶在轉賬付款界面無需自已填寫訂單相關信息,程序自動填寫。如:收款賬號、付款金額、付款備注等信息??蛻粼诰W站下單后只管支付就行了。
<?php /** * ECSHOP 支付寶轉賬付款功能,配合我們的支付通軟件,可實現(xiàn)全自動訂單付款狀態(tài)更新、會員自動充值功能! 現(xiàn)在支付寶商戶對于商家接入支付寶即時到賬接口管理比較嚴格,一般都是需要企業(yè)賬戶才能申請開通即時到賬接口的。這對于大部分個人商家來說,無疑不利于快速回籠資金。本接口通過一個變通的方式,利用支付寶系統(tǒng)中的轉賬付款功能,來跟自己的商城實現(xiàn)對接,讓客戶在下單后直接跳轉到這個支付寶的轉賬付款頁面,然后輸入自己的賬號密碼,就可以給自己的賬號付款了。配合我們提供的【支付通】軟件,可以實現(xiàn)24小時自動更新網站訂單狀態(tài),自動為會員充值等功能。請進入我們的官方網站下載軟件并使用吧! * ==================================================================================================== * 版權所有 2010-2015 支付通,并保留所有權利。 * ==================================================================================================== */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/alipayeasypay.php'; 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]['code'] = basename(__FILE__, '.php'); /* 描述對應的語言項 */ $modules[$i]['desc'] = 'alipayeasypay_desc'; /* 是否支持貨到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在線支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'yiditushe(老曹)'; /* 網址 */ $modules[$i]['website'] = 'http://easypay.myshopex.com/'; /* 版本號 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => '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 = '<p style="text-align:center;" ><form id="__allpayForm" accept-charset="gbk" method="post" onsubmit="document.charset=\'gbk\';" target="_blank" action="https://shenghuo.alipay.com/send/payment/fill.htm">'; foreach ($parameter as $keys => $value) { $button .="<input type='hidden' name='$keys' value='$value' />"; } $button .= '<input type="submit" id="__paymentButton" value="' . $GLOBALS['_LANG']['pay_button'] . '" />'; $button .= '</form></p>'; 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'];//交易狀態(tài) $order_sn_logid = str_replace("付款-", "", $desc); $key = $payment['alipayeasypay_key']; //驗證簽名 if(strtoupper(md5("$tradeno|$desc|$time|$username|$userid|$amount|$status|$key")) == $sig){ //這里做訂單業(yè)務,在下面寫您的代碼即可 //檢查付款金額和支付單的金額是否一致,不一致的話,報錯處理 /* 檢查支付的金額是否相符 */ list($order_sn, $log_id) = explode("|", $order_sn_logid); if (!check_money($log_id, $money)){ echo "支付金額不一致";exit; return false; } /* 改變訂單狀態(tài) */ order_paid($log_id, 2); echo "ok";exit; return true; }else{ echo "驗證簽名失敗";exit; return false; } } } ?>
相關文章:
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

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

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

Hot Article
How to fix KB5060533 fails to install in Windows 10?
4 weeks ago
By DDD
Dune: Awakening - Where To Get Insulated Fabric
4 weeks ago
By Jack chen
Gmail Login: How to Sign Up, Sign In, or Sign Out of Gmail - MiniTool
1 months ago
By Jack chen
How to fix KB5060999 fails to install in Windows 11?
3 weeks ago
By DDD
Guild Guide In Tainted Grail: The Fall Of Avalon
4 weeks ago
By Jack chen

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
