<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          alipay_wapphp的支付寶手機(jī)網(wǎng)關(guān)支付組件

          聯(lián)合創(chuàng)作 · 2023-09-25 08:01

          目的

          • 支付寶的demo很搓

          • 項(xiàng)目需要接入很多支付,磋上加搓,不是特別好管理

          本類庫的目標(biāo)

          • 完成跟支付寶手機(jī)網(wǎng)關(guān)支付對(duì)接的功能

          • 便于后面擴(kuò)展(利用各種Handler),可測(cè)試

          如何使用本類庫?

          1. 預(yù)先加載配置

          • 目前提供文件的方式加載配置

          use HuNanZai\Component\Pay\Package\Alipay_wap\Api as AlipayApi;
          use HuNanZai\Component\Pay\Package\Alipay_wap\Handler\PhpFileConfigHandler as ConfigHandler;
          
          $config_handler = new ConfigHandler(__DIR__.'/config.php');
          $alipay_api = new AlipayApi($config_handler->getConfig());

          config.php

          <?php
          return array(
              'partner'   => 'xxxxxxxxxxxxxxxx',
              'seller_id' => 'xxxxxxxxxxxxxxxx',
              'private_key_path'  => __DIR__.'/resource/rsa_private_key.pem',
              'public_key_path'   => __DIR__.'/resource/rsa_public_key.pem',
              'cacert'            => __DIR__.'resource/cacert.pem',
          );

          調(diào)用對(duì)應(yīng)的api即可

          • 支付

          use HuNanZai\Component\Pay\Package\Alipay_wap\Handler\ArrayPayParamHandler as PayParamHandler;
          
          $pay_param_handler  = new PayParamHandler(array(
              'out_trade_no'  => date('YmdHis),
              'subject'       => '',
              'total_fee'     => '0.01',
              //可空
              'notify_url'    => '',
              'return_url'    => '',
          ));
          $alipay_api->pay($pay_param_handler->getParam());
          • 支付同步返回驗(yàn)證

          ...略過上面的類似步驟
          $callback_param_handler   = new CallbackParamHander($_GET);
          $res = $alipay_api->verifyCallback($callback_param_handler->getParam());
          • 支付異步通知驗(yàn)證

          $notify_param_handler   = new NotifyParamHandler($_POST);
          $res    = $alipay_api->verifyNotify($notify_param_handler->getParam());
          • 查詢訂單

          $param_handler = new SearchRequestParamHandler(array(
              'trade_no'     => '',
              'out_trade_no' => '',
          ));
          $result = $alipay_api->search($param_handler->getParam());
          • 退款

          $refund_param_handler   = new RefundParamHandler(array(
              'refund_date'   => date('Y-m-d H:i:s'),
              'batch_no'      => date('YmdHis'),
              'batch_num'     => 1,
              'detail_data'   => 'xxxx^0.01^測(cè)試退款',
          ));
          
          $result = $alipay_api->refund($refund_param_handler->getParam());
          瀏覽 26
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  日韩成人影片 | 国产精品嫩草AV城中村 | 久久久91人妻无蜜桃码 | 久久久成人免费 | 午夜久久电影 |