php对接支付接口api教程,php支付宝支付接口开发

发布时间:2023-01-05

本文目录一览:

  1. 如何用PHP实现微信支付,求教。新手!说明详细点
  2. php怎么调用支付接口
  3. php,支付宝接口怎样用
  4. PHP如何调用支付接口
  5. PHP调用微信支付接口?
  6. php支付宝接口

如何用PHP实现微信支付,求教。新手!说明详细点

以PHP语言为例,对微信支付的开发流程进行一下说明:

  1. 获取订单信息。
  2. 根据订单信息和支付相关的账号生成sign,并且生成支付参数。
  3. 将支付参数信息POST到微信服务器,获取返回信息。
  4. 根据返回信息生成相应的支付代码(微信内部)或是支付二维码(非微信内),完成支付。

php怎么调用支付接口

由于各公司的支付接口虽说理论的架构相似,但是运用的技术还是不同的。不能混用的。。 一般大型的网店系统的接口部分的代码也都是根据CASE语句判断后,函数跳转到相应的公司的支付接口部分。把接口分开放置在不同的文件夹下面,之后判断调用。 例如:网银的接口一个文件夹、财付通的一个文件夹、支付宝的一个文件夹。

php,支付宝接口怎样用

php支付宝接口用法,具体分析如下: 现在流行的网站支持平台,支付宝当仁不让的老大了,现在我们就来告诉你如何使用支付宝API来做第三方支付,把支付宝放到自己网站来,代码如下:

alipay_config.php 配置程序

<?php
*/
// alipay_config.php 配置程序
$interfaceurl = ":";
$sitename = "网站名称";
$weburl = "http://网站网址";
$o_fee = "0.00"; // 平邮费
$e_fee = "0.00"; // 快递费
$selleremail = ""; // 支付宝账号
$payalikey = ""; // 安全校验码
$imgurl = "pay.gif"; // 按钮图片源
$imgtitle = "使用支付宝购买"; // 按钮图片说明
?>

alipay.php 代码

<?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 页面

<?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 = ''; // 你的网址
$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 页面代码

<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%"><?php echo $aliorder; ?></td>
                            </tr>
                            <tr class="tdbg">
                                <td width="14%">收 货 人:</td>
                                <td width="86%"><?php echo $aliname; ?></td>
                            </tr>
                            <tr class="tdbg">
                                <td width="14%">付款金额:</td>
                                <td width="86%"><b><?php echo $alimoney; ?></b></td>
                            </tr>
                            <tr class="tdbg">
                                <td width="14%">收货地址:</td>
                                <td width="86%"><?php echo $aliaddress; ?></td>
                            </tr>
                            <tr class="tdbg">
                                <td>物流方式:</td>
                                <td><?php echo $alimailtype; ?>(1.平邮 2.快递 3.虚拟物品)</td>
                            </tr>
                            <tr class="tdbg">
                                <td>联系电话:</td>
                                <td><?php echo $aliphone; ?></td>
                            </tr>
                            <tr class="tdbg">
                                <td>邮政编码:</td>
                                <td><?php echo $alizipcode; ?></td>
                            </tr>
                            <tr class="tdbg">
                                <td>手机号码:</td>
                                <td><?php echo $alimob; ?></td>
                            </tr>
                            <tr class="tdbg">
                                <td>客户留言:</td>
                                <td><?php echo $alibody; ?></td>
                            </tr>
                            <tr class="tdbg">
                                <td></td>
                                <td><input type="button" name="submit21" onclick="history.go(-1)" value="返回修改订单"> <a href="<?php echo $link ?>" target="_blank"><img src="<?php echo $imgurl ?>" alt="<?php echo $imgtitle ?>" border="0" align="absmiddle"></a></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
</body>
</html>

PHP如何调用支付接口

支付接口都要配合第三方支付系统来做,比如微信、支付宝、连连支付等第三方支付。具体的对接方式在第三方支付系统官方网站上都会有接口文档或者demo示例,你可以根据文档或者demo来开发自己的接口。

PHP调用微信支付接口?

不一定,看你业务需要。这些步骤只是描述微信系统会发出和接收什么数据,商户需要发送和会接收到什么数据,用户需要执行什么操作。回调的URL是用来接收数据的,至于发送并没有要求。

php支付宝接口

登录支付宝,然后有个商户版的,进入申请双功能接口, 然后下载下来的接口包文件有很多语言的源码 我们选择PHP版的UTF-8 里面包括一些文件:

  • images 文件里是支付宝相关的一些标志的图片;
  • lib 文件很重要,是整个接口的核心类文件;
  • alipay.config.php 是相关参数的配置文件;
  • alipayapi.php 是支付宝接口入口文件;
  • notify_url.php 是服务器异步通知页面文件;
  • return_url.php 是页面跳转同步通知文件; 按照开发文档开发即可。
<?php
// 这里有一些教程  希望能帮到你
//  
?>

望采纳