예제 #1
0
파일: pay.php 프로젝트: HuNanZai/alipay_wap
<?php

include_once __DIR__ . '/bootstrap.php';
use HuNanZai\Component\Pay\Package\Alipay_wap\Api as AlipayApi;
use HuNanZai\Component\Pay\Package\Alipay_wap\Handler\PhpFileConfigHandler as ConfigHandler;
use HuNanZai\Component\Pay\Package\Alipay_wap\Handler\ArrayPayParamHandler as PayParamHandler;
$config_handler = new ConfigHandler(__DIR__ . '/config.php');
$config = $config_handler->getConfig();
$pay_param_handler = new PayParamHandler(array('out_trade_no' => date('YmdHis'), 'subject' => '测试订单', 'total_fee' => '0.01', 'notify_url' => URL_ROOT . 'notify.php', 'return_url' => URL_ROOT . 'callback.php'));
$alipay_api = new AlipayApi($config);
try {
    $result = $alipay_api->pay($pay_param_handler->getParam());
} catch (Exception $e) {
    var_dump($e);
}
var_dump($result);