Home>Article>Backend Development> PHP Alipay interface example tutorial
With the gradual development of technology, mobile payment has now become popular. So how to do the php Alipay interface? Let me share with you an example of the php Alipay interface. Use the API to make third-party payments. Put Alipay on your own website. The code is as follows:
alipay_config.php The configuration program is as follows:
The code is as follows:
## The #alipay.php code is as follows://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; } } ?>The pay.php page is as follows:
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版
The above is the detailed content of PHP Alipay interface example tutorial. For more information, please follow other related articles on the PHP Chinese website!