Php Alipay interface program source code (full version with instance)

Source: Internet
Author: User
The code is as follows: Copy code

*/
// Alipay_config.php configuration program
$ Interfaceurl = "https://www.alipay.com/payto :";
$ Sitename = "website name ";
$ Weburl = "http: // website ";
$ O_fee = "0.00"; // Ping postage
$ E_fee = "0.00"; // express delivery fee
$ Selleremail = ""; // Alipay account
$ Payalikey = ""; // security verification code
$ Imgurl = "pay.gif"; // Click the image source
$ Imgtitle = "buy with Alipay"; // button image description
?>
<? Php
/*************************************** ******************************
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,
'Subobject' => $ s2,
'Body' => $ s3,
'Order _ no' => $ s4,
'Price' => $ s5,
'URL' => $ s6,
'Type' => $ s7,
'Number' => $ s8,
'Transport '=> $ s9,
'Ordinary _ Records' => $ s10,
'Express _ callback' => $ s11,
'Readonly' => $ s12,
'Bucket _ msg '=> $ s13,
'Seller '=> $ s14,
'Buyer '=> $ s15,
'Bucket _ name' => $ s16,
'Bucket _ address' => $ s17,
'Bucket _ zipcode' => $ s18,
'Buyer _ Tel' => $ s19,
'Bucket _ 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 page

<?
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 = '000000 ';
$ Subject = "Order No.:". $ aliorder;
$ Body = 'item Introduction ';
$ Order_no = $ aliorder;
$ Price = $ alimoney;
$ Url = 'www .111cn.net '; // your url
$ Type = '1 ';
$ Number = '1 ';
$ Transport = $ alimailtype;
$ Ordinary_1_= '0. 00 ';
$ Express_timeout = '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 = '000000 ';

$ Geturl = new alipay;
$ Link = $ geturl-> geturl
 (
$ Cmd, $ subject, $ body, $ order_no, $ price, $ url, $ type, $ number, $ transport,
$ Ordinary_msg, $ express_fee, $ readonly, $ buyer_msg, $ seller, $ buyer,
$ Buyer_name, $ buyer_address, $ buyer_zipcode, $ buyer_tel, $ buyer_mobile, $ partner,
$ Interfaceurl, $ payalikey
);
?>
<Html>
<Head>
<Title> simple Alipay payment for php </title>
<Link href = "admin_style.css tutorial" 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> simple Alipay payment 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%"> order number: </td>
<Td width = "86%"> <? Echo $ aliorder;?> </Td> </tr>
<Tr class = tdbg>
<Td width = "14%"> Recipient: </td>
<Td width = "86%"> <? Echo $ aliname;?> </Td> </tr>
<Tr class = tdbg>
<Td width = "14%"> payment amount: </td>
<Td width = "86%"> <B> <? Echo $ alimoney;?> </B> </td> </tr>
<Tr class = tdbg>
<Td width = "14%"> shipping address: </td>
<Td width = "86%"> <? Echo $ aliaddress;?> </Td> </tr>
<Tr class = tdbg>
<Td> logistics method: </td>
<Td> <? Echo $ alimailtype;?> (1. Ping Mail 2. Express 3. Virtual items) </td> </tr>
<Tr class = tdbg>
<Td> Contact number: </td>
<Td> <? Echo $ aliphone;?> </Td> </tr>
<Tr class = tdbg>
<Td> Zip code: </td>
<Td> <? Echo $ alizipcode;?> </Td> </tr>
<Tr class = tdbg>
<Td> mobile phone number: </td>
<Td> <? Echo $ alimob;?> </Td> </tr>
<Tr class = tdbg>
<Td> Customer Message: </td>
<Td> <? Echo $ alibody;?> </Td> </tr>
<Tr class = tdbg>
<Td> </td>
<Td> <input type = "button" name = "submit21" onclick = "webpage effect: history. go (-1) "value =" return to modify order "> & nbsp; <a href = "<? Php echo $ link?> "Target =" _ blank "> "Alt =" <? Php echo $ imgtitle?> "Border =" 0 "align = 'absmiddle' border = '0'/> </a> </td> </tr> </tbody> </table> </ td> </tr> </tbody> </table>
 
</Body>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.