cgm / zf2-tip-me
接受小费/捐赠的Stripe ZF2模块
dev-master
2016-01-17 16:19 UTC
Requires
- php: >=5.3.3
- stripe/stripe-php: dev-master
- zendframework/zendframework: 2.*
- zf-commons/zfc-base: dev-master
This package is not auto-updated.
Last update: 2024-09-25 12:19:56 UTC
README
版本 1.0.0 / 由Christopher Martin创建 / BSD-3-Clause 许可协议
简介
使用 Zend Framework 2 和一个 免费Stripe账户,在您的网站上直接接受捐赠。
特性
- 支付成功后可以发送通知电子邮件。
- 测试模式切换,带有各种测试场景的测试信用卡列表。
- 易于定制。捐赠项目可配置。提供事件钩子。
- 失败的交易将被记录。
- 由于Stripe,您的服务器不会发送或存储任何PCI数据。
Stripe目前仅在美国和加拿大可用。
当Stripe在您的国家/地区 可用 时,您会收到通知。
安装
Composer / Packagist 安装
将 "minimum-stability": "dev"
添加到您的 composer.json 文件中,然后运行
# From project's base directory... % composer.phar require cgm/zf2-tip-me Please provide a version constraint for the cgm/config-admin requirement: dev-master
启用 ZF2TipMe 模块
编辑您的 application.config.php
并启用 ZfcBase
和 ZF2TipMe
模块
return array( 'modules' => array( // ... 'ZfcBase', 'ZF2TipMe', ), // ... );
创建目录和符号链接
默认情况下,此模块配置为将日志文件写入 ./data/log
和 ./data/mail
。当您选择不使用邮件服务器时,将使用邮件日志。
# From project's base directory... % cd data % mkdir log mail % chmod 777 log mail # Or set the appropriate group permissions to be writable by the webserver
有一个包含CSS和JavaScript文件的资源文件夹。您可以将它们链接到 ./public/tip-me-assets
,或可能使用资源管理模块
# From the project's base dir... % cd public % ln -s ../vendor/cgm/zf2-tip-me/public tip-me-assets
编辑配置
从模块配置目录复制 .global 和 .local dist 文件
# From project's base directory... % cd config/autoload % cp ../../vendor/cgm/zf2-tip-me/config/zf2tipme.global.php.dist ./zf2tipme.global.php % cp ../../vendor/cgm/zf2-tip-me/config/zf2tipme.local.php.dist ./zf2tipme.local.php
编辑 zf2tipme.global.php
文件以符合需求
<?php return array( 'zf2tipme' => array( 'error_log' => './data/log/tipme.log', 'recipient_name' => '{{{RECIPIENT}}}', // Your name 'admin_email' => '{{{admin@email.address}}}', // Displayed for refunds, and used for mail notifications 'statement_descriptor' => '{{{STATEMENT_DESCRIPTOR}}}', // Stripe account setting 'tip_options' => array( // Customize away... 'coffee' => array( 'title' => 'Cup of Starbucks coffee (12 oz)', 'amount' => 2.50, 'img_src' => 'http://placehold.it/200x150', ), 'redbull' => array( 'title' => 'Red Bull (20 oz, sugar free)', 'amount' => 4.48, 'img_src' => 'http://placehold.it/200x150', ), 'music' => array( 'title' => 'MP3 music (album)', 'amount' => 9.99, 'img_src' => 'http://placehold.it/200x150', ), ), 'mail_transport_options' => array( // Used with default 'zf2tipme_mailtransport' factory in Module.php 'path' => './data/mail/', ), ), );
使用您的Stripe API密钥编辑 zf2tipme.local.php
文件
<?php $testMode = true; return array( 'zf2tipme' => array( 'test_mode' => $testMode, 'stripe_secret_key' => ($testMode) ? '{{{TEST_SECRET_KEY_HERE}}}' : '{{{LIVE_SECRET_KEY_HERE}}}', 'stripe_publish_key' => ($testMode) ? '{{{TEST_PUBLISHABLE_KEY_HERE}}}' : '{{{LIVE_PUBLISHABLE_KEY_HERE}}}', ), );
验证其是否正常工作
将浏览器指向 /tip-me
并使用 "填充测试数据" 下拉列表进行测试信用卡。
喜欢这个模块吗?
给我一杯咖啡 ☕ ;)