wehnhew / laravel4-payments by wehnhew

Larave payment gateway adapter.
86
13
2
Package Data
Maintainer Username: wehnhew
Maintainer Contact: chenhanwen@163.com (wehnhew)
Package Create Date: 2013-11-25
Package Last Update: 2013-12-02
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:18:55
Package Statistics
Total Downloads: 86
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 13
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Payments for Laravel 4

Laravel 4 的支付网关.

Latest Stable Version Total Downloads

安装

只要在你的 composer.json 文件require中加入下面内容,就能获得最新版.

"wehnhew/payments": "dev-master"

然后需要运行 "composer update" 来更新你的项目

安装完后,在 app/config/app.php 文件中找到 providers 键,

'providers' => array(

    'Wehnhew\Payments\PaymentServiceProvider'

)

找到 aliases 键,

'aliases' => array(

    'Payment' => 'Wehnhew\Payments\Facades\Payment'

)

以网银接口为例

网银配置

$config = array(
	'account'=>'1001',//商户账号
	'key'=>'test', //商户密钥
	'reurl'=>'http://www.domain/payments/respond' //支付返回地址
);

生成支付表单

$adapter = Payment::create('chinabank',$config);
$payFrom = $pay->setOrderid('0001') //订单ID
			->setProduct(['price'=>100.01]) //商品价钱
			->setCustomer(['name'=>'文文','mobile'=>1380000000]) //购买人名称,手机
			->render(); //生成表单
var_dump($payFrom);

支付返回处理

$data = Input::all();
$result = Payment::create('chinabank',$config)
			->receive($data);
var_dump($result);
if($return['status'] > 0)
{
	//success
}
else
{
	//fail
}

联系我

有问题,请发送到 chenhanwen@163.com