php支付寶接口用法分析
來源:易賢網(wǎng) 閱讀:1304 次 日期:2015-01-06 11:48:40
溫馨提示:易賢網(wǎng)小編為您整理了“php支付寶接口用法分析”,方便廣大網(wǎng)友查閱!

本文實(shí)例講述了php支付寶接口用法。分享給大家供大家參考。具體分析如下:

現(xiàn)在流行的網(wǎng)站支持平臺(tái),支付寶當(dāng)仁不讓的老大了,現(xiàn)在我們就來告訴你如何使用支付寶api來做第三方支付,把支付寶放到自己網(wǎng)站來,代碼如下:

alipay_config.php配置程序如下:

復(fù)制代碼 代碼如下:<?php

*/

//alipay_config.php 配置程序

$interfaceurl = ":";

$sitename = "網(wǎng)站名稱";

$weburl = "http://網(wǎng)站網(wǎng)址";

$o_fee = "0.00"; //平郵費(fèi)

$e_fee = "0.00"; //快遞費(fèi)

$selleremail = "";//支付寶賬號

$payalikey = "";//安全校驗(yàn)碼

$imgurl = "pay.gif"; //按鈕圖片源

$imgtitle = "使用支付寶購買"; //按鈕圖片說明

?>

alipay.php代碼如下:

復(fù)制代碼 代碼如下:<?php

/*********************************************************************

filename: alipay.php

author: dboyzhang

version: ver 2.0.0 beta1

contact_me: wangwang:dboyzhang

*********************************************************************/

//alipay.php代碼

require_once("alipay_config.php");

class alipay

{

function geturl($s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11,$s12,$s13,$s14,$s15,$s16,$s17,$s18,$s19,$s20,$s21,$s22,$s23)

{

$parameter = array(

'cmd' => $s1,

'subject' => $s2,

'body' => $s3,

'order_no' => $s4,

'price' => $s5,

'url' => $s6,

'type' => $s7,

'number' => $s8,

'transport' => $s9,

'ordinary_fee' => $s10,

'express_fee' => $s11,

'readonly' => $s12,

'buyer_msg' => $s13,

'seller' => $s14,

'buyer' => $s15,

'buyer_name' => $s16,

'buyer_address' => $s17,

'buyer_zipcode' => $s18,

'buyer_tel' => $s19,

'buyer_mobile' => $s20,

'partner' => $s21,

);

$url = $s22.$s14."?";

foreach($parameter as $key => $value){

if($value){

$url .= $key."=".urlencode($value)."&";

$acsouce .=$key.$value;

}

}

$url .= 'ac='.md5($acsouce.$s23);

return $url;

}

}

?>

pay.php頁面如下:

復(fù)制代碼 代碼如下:<?php

error_reporting(0);

$aliname=$_POST["aliname"];

$alizipcode=$_POST["alizipcode"];

$aliphone=$_POST["aliphone"];

$aliaddress=$_POST["aliaddress"];

$aliorder=$_POST["aliorder"];

$alimailtype=$_POST["alimailtype"];

$alimoney=$_POST["alimoney"];

$alimob=$_POST["alimob"];

$alibody=$_POST["alibody"];

require_once("alipay_config.php");

require_once("alipay.php");

$cmd = '0001';

$subject = "訂單號:".$aliorder;

$body = '商品介紹';

$order_no = $aliorder;

$price = $alimoney;

$url = 'www.jb51.net';//你的網(wǎng)址

$type = '1';

$number = '1';

$transport = $alimailtype;

$ordinary_fee = '0.00';

$express_fee = '0.00';

$readonly = 'true';

$buyer_msg = $alibody;

$seller = $selleremail;

$buyer = '';

$buyer_name = $aliname;

$buyer_address = $aliaddress;

$buyer_zipcode = $alizipcode;

$buyer_tel = $aliphone;

$buyer_mobile = $alimob;

$partner = '2088002008096997';

$geturl = new alipay;

$link = $geturl->geturl

(

$cmd,$subject,$body,$order_no,$price,$url,$type,$number,$transport,

$ordinary_fee,$express_fee,$readonly,$buyer_msg,$seller,$buyer,

$buyer_name,$buyer_address,$buyer_zipcode,$buyer_tel,$buyer_mobile,$partner,

$interfaceurl,$payalikey

);

?>

<html>

<head>

<title>簡易支付寶付款php版</title>

<link href="admin_style.css教程" rel=stylesheet>

<meta http-equiv=content-type content="text/html; charset=gb2312">

</head>

<body>

<table class=border id=table1 style="font-size: 9pt" height=185 cellspacing=0

cellpadding=0 width=492 align=center border=0>

<tbody>

<tr>

<td class=topbg height=30>

<div align=center><strong>簡易支付寶付款php版</strong></div></td></tr>

<tr>

<td style="border-left: #e4e4e4 1px solid; border-bottom: #e4e4e4 1px solid" colspan=3 height=150>

<table style="font-size: 9pt" height=137 width="100%" align=center bgcolor=#ffffff>

<tbody>

<tr class=tdbg>

<td width="14%">訂單號碼:</td>

<td width="86%"><? echo $aliorder; ?></td></tr>

<tr class=tdbg>

<td width="14%">收 貨 人:</td>

<td width="86%"><? echo $aliname; ?></td></tr>

<tr class=tdbg>

<td width="14%">付款金額:</td>

<td width="86%"><b><? echo $alimoney; ?></b></td></tr>

<tr class=tdbg>

<td width="14%">收貨地址:</td>

<td width="86%"><? echo $aliaddress; ?></td></tr>

<tr class=tdbg>

<td>物流方式:</td>

<td><? echo $alimailtype; ?> (1.平郵 2.快遞 3.虛擬物品)</td></tr>

<tr class=tdbg>

<td>聯(lián)系電話:</td>

<td><? echo $aliphone; ?></td></tr>

<tr class=tdbg>

<td>郵政編碼:</td>

<td><? echo $alizipcode; ?></td></tr>

<tr class=tdbg>

<td>手機(jī)號碼:</td>

<td><? echo $alimob; ?></td></tr>

<tr class=tdbg>

<td>客戶留言:</td>

<td><? echo $alibody; ?></td></tr>

<tr class=tdbg>

<td></td>

<td><input type="button" name="submit21" onclick="網(wǎng)頁特效:history.go(-1)" value="返回修改訂單"> <a href="<?php echo $link?>" target="_blank"><img src="<?php echo $imgurl?>" alt="<?php echo $imgtitle?>" border="0" align='absmiddle' border='0'/></a> </td></tr></tbody></table></td></tr></tbody></table>

</body></html>

希望本文所述對大家的php程序設(shè)計(jì)有所幫助。

更多信息請查看IT技術(shù)專欄

更多信息請查看網(wǎng)頁制作
易賢網(wǎng)手機(jī)網(wǎng)站地址:php支付寶接口用法分析
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國考·省考課程試聽報(bào)名

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)