Analysis of php Alipay interface usage, php Alipay usage_PHP tutorial

WBOY
Release: 2016-07-13 10:10:16
Original
1082 people have browsed it

php Alipay interface usage analysis, php Alipay usage

The example in this article describes the usage of php Alipay interface. Share it with everyone for your reference. The specific analysis is as follows:

Alipay is the leader among popular website support platforms now. Now we will tell you how to use Alipay API for third-party payment and put Alipay on your own website. The code is as follows:

alipay_config.php configuration program is as follows:

Copy code The code is as follows:
*/
//alipay_config.php configuration program
$interfaceurl = "https://www.alipay.com/payto:";
$sitename = "Website name";
$weburl = "http://website address";
$o_fee = "0.00"; //Flat postage
$e_fee = "0.00"; //Express fee
$selleremail = "";//Alipay account
$payalikey = "";//Security verification code
$imgurl = "pay.gif"; //Button image source
$imgtitle = "Purchase using Alipay"; //Button image description
?>

alipay.php code is as follows:
Copy code The code is as follows:
/*********************************************************************
 filename: alipay.php
 author:  dboyzhang
 version:  ver 2.0.0 beta1
 contact_me: wangwang:dboyzhang
*********************************************************************/

//alipay.php code
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;

}
}
?>


The pay.php page is as follows:
Copy code The code is as follows:
<?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';//你的网址
$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
 );
?>


简易支付宝付款php版



 

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

     
简易支付宝付款php版

     
       
       
         
         
       
         
         
       
         
         
       
         
         
       
         
         
       
         
         
       
         
         
       
         
         
       
         
         
       
         
         
订单号码:
收 货 人:
付款金额:
收货地址:
物流方式: (1.平邮 2.快递 3.虚拟物品)
联系电话:
邮政编码:
手机号码:
客户留言:
       <?php echo $imgtitle?>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/937084.htmlTechArticleAnalysis of php Alipay interface usage, php Alipay usage This article describes the usage of php Alipay interface with examples. Share it with everyone for your reference. The specific analysis is as follows: Popular websites now support...
Related labels:
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