asugai / cake-php-payment-manager
CakePHP 基于stripe.com的支付管理器
Requires
- composer/installers: ~1.0
- stripe/stripe-php: >=1.8.3
This package is not auto-updated.
Last update: 2018-12-27 11:53:03 UTC
README
CakePHP 基于stripe.com的支付管理器
背景
CakePHP 使用 stripe.com 的简单信用卡和银行账户收发数据抽象层
要求
- PHP >= 5.3
- CakePHP 2.x
- 了解 stripe.com API 基础知识
安装
[手动]
- 下载此文件: http://github.com/asugai/CakePHP-Payment-Manager/zipball/master
- 解压缩下载的文件。
- 将生成的文件夹复制到 app/Plugin
- 将您刚刚复制的文件夹重命名为 PaymentManager
[GIT 子模块]
在您的应用目录中输入
git submodule add git://github.com/asugai/CakePHP-Payment-Manager.git Plugin/PaymentManager
git submodule update --init
[GIT Clone]
在您的应用目录中输入
git clone git://github.com/asugai/CakePHP-Payment-Manager.git Plugin/PaymentManager
启用插件
在您的 app/Config/bootstrap.php 文件中启用插件
CakePlugin::load('PaymentManager');
如果您已经使用 CakePlugin::loadAll();,则此步骤不是必需的。
用法
设置 PaymentManager
如果您在 /app/Config/bootstrap.php 中使用 composer,则设置 autoloader
// Load composer autoload.
require APP . '/Vendor/autoload.php';
// Remove and re-prepend CakePHP's autoloader as composer thinks it is the most important.
// See https://github.com/composer/composer/commit/c80cb76b9b5082ecc3e5b53b1050f76bb27b127b
spl_autoload_unregister(array('App', 'load'));
spl_autoload_register(array('App', 'load'), true, true);
// Load the bootstrap file to load Payment Model
CakePlugin::loadAll([
'PaymentManager' => [
'bootstrap' => true
]
]);
编辑 /app/Config/bootstrap.php 文件,并添加 Stripe.test 和 Stripe.live 密钥
Configure::write('Stripe.test.secret', '');
Configure::write('Stripe.test.public', '');
Configure::write('Stripe.live.secret', '');
Configure::write('Stripe.live.public', '');
if (class_exists('EnvironmentUtility') && EnvironmentUtility::is('production')) {
Configure::write('Stripe.keys', Configure::read('Stripe.live'));
} else {
Configure::write('Stripe.keys', Configure::read('Stripe.test'));
}
待办事项
- 添加命名空间
- 注释!
- 设置更多错误检查
- 添加单元测试!
致谢
此 README 的基本布局借鉴自 https://github.com/dkullmann/CakePHP-Elastic-Search-DataSource
许可
版权所有 (c) 2013 Andre Sugai
特此授予任何获得本软件及其相关文档文件(“软件”)副本的任何人,免费使用软件的权利,不受任何限制,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权利,并允许向软件提供者提供软件的人这样做,前提是遵守以下条件
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
本软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任承担责任,无论此类责任基于合同、侵权或其他原因,是否因软件或其使用或其他方式而产生。