业务系统开发文档>支付接口开发
quot;out_trade_no":"1660030044500783722161","client":{"id":62,"username":"wyh","company":"智简魔方","address":"少时诵诗书所所所所所所所所所所所所所所所所","country":"中国","phone_code":86,"phone":"12345678910","email":""},"product":["魔方云)"],"global":{"website_name":"智简魔方","website_url":"https:\\test.test.com"},"finance":{"id":1728,"total":"500.00","tmp_order_id":"1660030044500783722161","tmp_order_id2":"166003004463630999","tmp_order_id3":"5075991847"}}参数说明:out_trade_no:临时订单号;client.id:客户ID;client.username:客户姓名;client.company:公司;client.address:地址;client.country:国家;client.phone_code国家区号;client.phone:电话;client.email:邮件;product:商品数组;global.website_name网站名称;global.website_url:网站地址;finance.id:订单号;finance.total:订单金额;finance.tmp_order_id规则1的临时订单号;finance.tmp_order_id2规则2的临时订单号;finance.tmp_order_id3规则3的临时订单号;⑦入口方法(发起支付)返回html即可,系统会将html渲染至支付输出页面; 3、确定是否需要后台配置文件,如果需要,在支付接口根目录下加上config.php,示例:return [ 'module_name' => [ # 在后台插件配置表单中的键名(统一规范:小写+下划线),会是config[module_name] 'title' => '名称', # 表单的label标题 'type' => 'text', # 表单的类型:text文本,password密码,checkbox复选框,select下拉,radio单选,textarea文本区域,tip提示 'value' => '支付宝当面付', # 表单的默认值 'tip' => 'friendly name', # 表单的帮助提示 'size' => 200, # 输入框长度(当type类型为text,password,textarea,tip时,可传入此键) ], 'app_id' => [ 'title' => 'appID', 'type' => 'text', 'value' => '', 'tip' => '', 'size' => 200, ], 'merchant_private_key' => [ 'title' => '商户私钥', 'type' => 'text', 'value' => '', 'tip' => '', 'size' => 200, ], 'alipay_public_key' => [ 'title' => '支付宝公钥', 'type' => 'text', 'value' => '', 'tip' => '', 'size' => 200, ], # 此配置作为范例 'mode' => [ 'title' => '模式', 'type' => 'radio', 'options' => [ # 当type类型为checkbox,select,radio时,需要有此键,作为选项 'debug' => '调试', 'online' => '上线', ], 'value' => 'online', 'tip' => '请选择模式', 'attribute' => 'disabled', # 属性,加入此键:disabeld表示禁止编辑,只能看; ],]; 4、需要外部访问,在根目录下创建controller目录,添加控制器,处理异步或同步回调;①创建自定义控制器,如controller/IndexController.php;②自定义异步回调方法,如notifyHandle(),则异步回调地址为:网站地址/gateway/ali_pay_dmf/index/notifyHandle;③在②的方法中处理支付回调逻辑,进行订单等的验证;④支付成功调系统订单处理方法order_pay_handle($param),传入数组参数:$param = [ ‘tmp_order_id’ => 123456, // 临时订单ID ‘amount’ => 1.00, // 支付金额 ‘trans_id’ => 22483701327490139472, // 交易流水ID ‘currency’ => ‘CNY’, // 货币代码 ‘paid_time’ => ‘2022-08-09 15:52:19’, // 时间,注意必须是此标准格式 ‘gateway’ => ‘AliPayDmf’, // 支付接口标识]; 5、到后台支付接口管理界面刷新就会看到新添加的支付接口,安装、配置即可使用。 四、示例参考支付宝当面付ali_pay_dmf