2017 © Pedro Peláez
 

yii2-extension alipay

Yii2 Alipay

image

juju/alipay

Yii2 Alipay

  • Monday, August 15, 2016
  • by juju
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

生成支付宝

配置项

params.php中添加
'alipayPartner' => '208841100000',
'alipaySellerEmail' => '123123@sdf.com',
'alipayKey' => 'kq1lqfa599ifsdfsdfsdf4845p2sknjzh',

安装

composer require "juju/alipay:1.0"

"juju/alipay": "~1.0.0"

控制器顶部

use use \juju\alipay\AlipayConfig;
use \juju\alipay\AlipaySubmit;

控制器调用(生成支付)

$alipayConfig = (new AlipayConfig())->getAlipayConfig();
$alipaySubmit = new AlipaySubmit($alipayConfig);

//服务器异步通知页面路径
$notify_url = Yii::$app->urlManager->createAbsoluteUrl(['pay/alipay/notify']);
$return_url = Yii::$app->urlManager->createAbsoluteUrl(['pay/alipay/return']);
$show_url   = Yii::$app->urlManager->createAbsoluteUrl(['goods/id/111']);
//需http://格式的完整路径,不允许加?id=123这类自定义参数

$out_trade_no = time();
$subject = '测试支付宝';
$body = '支付描述';
$total_fee = 0.01;     

$parameter = array(
    "service"           => "create_direct_pay_by_user",
    "partner"           => trim($alipayConfig['partner']),
    "payment_type"      => 1,
    "notify_url"        => $notify_url,
    "return_url"        => $return_url,
    "seller_email"      => trim($alipayConfig['seller_email']),
    "out_trade_no"      => $out_trade_no,
    "subject"           => $subject,
    "total_fee"         => $total_fee,
    "body"              => $body,
    "show_url"          => $show_url,
    "anti_phishing_key" => '',
    "exter_invoke_ip"   => Yii::$app->request->userIP,
    "_input_charset"    => trim(strtolower($alipayConfig['input_charset']))
);

$html_text = $alipaySubmit->buildRequestForm($parameter,"post", "确认");
echo $html_text;
exit();

验证支付

控制器顶部

未完成
$alipayConfig = (new AlipayConfig())->getAlipayConfig();
$notify = new AlipayNotify($alipayConfig);
if ($notify->verifyNotify()) {
    return "success";
}else{
    return "false";
}

The Versions

15/08 2016

dev-master

9999999-dev

Yii2 Alipay

  Sources   Download

MIT

The Requires

 

by Avatar juju

15/08 2016

1.0.1

1.0.1.0

Yii2 Alipay

  Sources   Download

MIT

The Requires

 

by Avatar juju

15/08 2016

1.001

1.001.0.0

Yii2 Alipay

  Sources   Download

MIT

The Requires

 

by Avatar juju

15/08 2016

1.0.0

1.0.0.0

Yii2 Alipay

  Sources   Download

MIT

The Requires

 

by Avatar juju

15/08 2016

0.0.1

0.0.1.0

Yii2 Ip to Location

  Sources   Download

MIT

The Requires

 

by Avatar juju