PHP支付宝支付的代码分享(TP3.2框架)(一)

支付宝的支付,首先要在支付宝首页注册企业账号:https://memberprod.alipay.com/account/reg/enterpriseIndex.htm
用公司的邮箱注册支付宝的企业账户

支付宝企业账户注册

注册完之后,进入账户,点击产品中心,点击“电脑网站支付”,签署好协议。
产品中心-电脑网站支付

点进支付宝的蚂蚁金服开放平台
开发者中心-网页&移动应用

创建支付接入的应用
创建支付接入的应用

新建应用

编辑应用的图标,提交审核

添加功能-签约电脑网站支付

签约成功后,去文档中心,查看文档,和下载demo,下载地址:https://docs.open.alipay.com/270/106291/
我这里用的tp3.2的框架,把下载来的demo放到了
支付宝的demo位置

/**支付宝要引入的文件**/
    require_once './library/ThinkPHP/Library/Vendor/Alipay/pagepay/service/AlipayTradeService.php';
    require_once './library/ThinkPHP/Library/Vendor/Alipay/pagepay/buildermodel/AlipayTradePagePayContentBuilder.php';
    require_once './library/ThinkPHP/Library/Vendor/Alipay/pagepay/buildermodel/AlipayTradeQueryContentBuilder.php';
    /**支付宝要引入的文件**/

//支付宝的配置文件
        public function alipay_config(){
            
            $config = array (   
                //应用ID,您的APPID。
                'app_id' => "app_id",

                //商户私钥
                'merchant_private_key' => "",
                //异步通知地址
                'notify_url' => "http://www.zhifushang.com/zfbdemo/notify_url.php",
                
                //同步跳转
                'return_url' => "http://www.zhifushang.com/index.php/Home/Pay/return_url",

                //编码格式
                'charset' => "UTF-8",

                //签名方式
                'sign_type'=>"RSA2",

                //支付宝网关
                'gatewayUrl' => "https://openapi.alipay.com/gateway.do",

                //支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
                'alipay_public_key' =>""
            );
            return $config;
            
        }

你可能感兴趣的:(PHP支付宝支付的代码分享(TP3.2框架)(一))