導航:首頁 > 編程語言 > chinapayphp介面

chinapayphp介面

發布時間:2023-10-08 14:59:39

❶ 銀聯介面有沒有php技術的

有Php版本的啊,地址如下,你自己下載吧。。。

http://www.chinapay.me/support.html

❷ 親,php銀聯在線支付,沒做過,請求幫助

支付介面現在有第三方的支付介面也有銀行的支付介面。這里就來介紹php版本銀聯支付介面開發的方法。

銀聯支付,首先要注意二重要的部分:

PHP運行環境是5.4.18以上

開了擴展openssl

開發手冊上面的列子只做參考,因為基本都是錯的。你可以試著去官網下一個demo。。。注意現在銀聯開發,沒有測試密鑰提供,只能在正式環境開發

下面是我用ThinkPHP編寫的一個支付類

/**
*銀聯支付v0.1
*@auther:Summer<[email protected]>;
*@date:20151202
***/
{
//在類初始化方法中,引入相關類庫
publicfunction_initialize(){
header("Content-type:text/html;charset=utf-8");
vendor('Netpay.util.common',"",".php");//導入加密核心文件夾
vendor('Netpay.util.SecssUtil',"",".class.php");//導入加密核心文件夾
vendor('Netpay.util.Settings_INI',"",".php");//導入加密核心文件夾
vendor('Netpay.util.Settings',"",".php");//導入加密核心文件夾
$this->securityPropFile=$_SERVER['DOCUMENT_ROOT']."/ThinkPHP/Extend/Vendor/Netpay/config/security.properties";//誰知道這是啥,反正他們要我加的
$this->b2cPaySend=__APP__."/Index/NetPay/b2cPaySend";
$this->b2cRefundSend=__APP__."/Index/NetPay/b2cRefundSend";
$this->b2cQuerySend=__APP__."/Index/NetPay/b2cQuerySend";
$this->;MerBgUrl=__APP__."/Index/NetPay/MerBgUrl";
$this->MerPageUrl=__APP__."/Index/NetPay/MerPageUrl";
}
publicfunctionindex()
{
$paramArray=array(
'MerId'=>'商戶號',
'MerOrderNo'=>'0000001944663232',
'OrderAmt'=>'1',
'TranDate'=>'20151219',
'TranTime'=>'171248',
'TranType'=>'0001',
'BusiType'=>'0001',
'Version'=>'20140728',
'CurryNo'=>'CNY',
'AccessType'=>;'0',
'CommodityMsg'=>'測試商品1號',
'MerPageUrl'=>$this->MerBgUrl,
'MerBgUrl'=>$this->MerPageUrl,
'MerResv'=>'MerResv',
);
if(count($paramArray)>0){
$dispatchUrl=$this->b2cPaySend;
$transResvedJson=array();
$cardInfoJson=array();
$sendMap=array();
foreach($paramArrayas$key=>$value){
if(isEmpty($value)){
continue;
}
if(startWith($key,"trans_")){
$key=substr($key,strlen("trans_"));
$transResvedJson[$key]=$value;
}else
if(startWith($key,"card_")){
$key=substr($key,strlen("card_"));
$cardInfoJson[$key]=$value;
}else{
$sendMap[$key]=$value;
}
}
$transResvedStr=null;
$cardResvedStr=null;
if(count($transResvedJson)>0){
$transResvedStr=json_encode($transResvedJson);
}
if(count($cardInfoJson)>0){
$cardResvedStr=json_encode($cardInfoJson);
}
$secssUtil=newSecssUtil();
if(!isEmpty($transResvedStr)){
$transResvedStr=$secssUtil->decryptData($transResvedStr);
$sendMap["TranReserved"]=$transResvedStr;
}
if(!isEmpty($cardResvedStr)){
$cardResvedStr=$secssUtil->decryptData($cardResvedStr);
$sendMap["card_"]=$cardResvedStr;
}
$securityPropFile=$this>securityPropFile;
$secssUtil->init($securityPropFile);
$secssUtil->sign($sendMap);
$sendMap["Signature"]=$secssUtil->getSign();
$_SESSION=$sendMap;
header("Location:".$dispatchUrl);
}
}
publicfunctionb2cPaySend(){
layout(false);
$settings=newSettings_INI();
$settings->oad($this->securityPropFile);
$pay_url="https://payment.chinapay.com/CTITS/service/rest/page/nref/000000000017/0/0/0/0/0";
$html="<formname='payment'action='{$pay_url}'method='POST'target='_blank'>;";
$params="TranReserved;MerId;MerOrderNo;OrderAmt;CurryNo;TranDate;SplitMethod;BusiType;MerPageUrl;MerBgUrl;SplitType;MerSplitMsg;PayTimeOut;MerResv;Version;BankInstNo;CommodityMsg;Signature;AccessType;AcqCode;OrderExpiryTime;TranType;RemoteAddr;Referred;TranTime;TimeStamp;CardTranData";
foreach($_SESSIONas$k=>$v){
if(strstr($params,$k)){
$html.="<inputtype='hidden'name='".$k."'value='".$v."'/>";
}
}
$html.="<nputtype='button'type='hidden'value='提交訂單'>";
$html.="<;/from>";
$this->html=$html;
$this->display();
}
publicfunctionpgReturn(){
if($_POST){
if(count($_POST)>0){
$secssUtil=newSecssUtil();
$securityPropFile=$this>securityPropFile;
$secssUtil->init($securityPropFile);
$text=array();
foreach($_POSTas$key=>$value){
$text[$key]=urldecode($value);
}
if($secssUtil->verify($text)){
//支付成功
$_SESSION["VERIFY_KEY"]="success";
}else{
//支付失敗
$_SESSION["VERIFY_KEY"]="fail";
}
}
}
}
}

銀聯支付應該是算比較簡單的!!

閱讀全文

與chinapayphp介面相關的資料

熱點內容
base64encoderjava 瀏覽:480
linux視頻轉換 瀏覽:692
linux與unixshell編程指南 瀏覽:129
vb6反編譯程序錯誤 瀏覽:117
伺服器弄掛有什麼影響 瀏覽:298
安卓軟體為什麼運行不了 瀏覽:521
什麼安卓手機是四方的 瀏覽:475
雲伺服器廠商租用多少錢 瀏覽:349
平安車貸解壓要多久 瀏覽:412
樂一php程序員待遇 瀏覽:162
ZDM命令無法識別 瀏覽:919
解壓小手工A4紙 瀏覽:981
鋼筋加密區是幾倍 瀏覽:669
編譯程序代碼軟體 瀏覽:806
怎麼恢復加密的東西 瀏覽:987
程序員賣茶 瀏覽:697
後端程序員英文 瀏覽:363
滴滴程序員平均月薪 瀏覽:591
如何使用ftp命令 瀏覽:788
小書亭下載的文件在哪手機文件夾 瀏覽:181