amish / stripe-test-clock
在 Laravel 中使用 Stripe 测试时钟
v0.1.0
2023-05-05 14:37 UTC
Requires
- illuminate/support: ~9|~10
- stripe/stripe-php: ^7.39
Requires (Dev)
- orchestra/testbench: ~7
- pestphp/pest: ^1.21
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2024-09-05 17:18:20 UTC
README
在 Laravel 中使用 Stripe 测试时钟。
安装
通过 Composer
composer require amish/stripe-test-clock
发布配置
php artisan vendor:publish --tag "stripe-test-clock.config"
运行迁移
php artisan migrate
用法
创建测试时钟
php artisan test-clock:create "Test 1 week trial"
将测试时钟分配给您的客户。
要为测试分配时钟给客户,请使用 StripeTestClock::stripeOptions()
方法。如果存在活动时钟,这将向您的数组添加 'test_clock' 键。如果您的配置中将 'enabled' 设置为 false,或者没有活动时钟,则不会添加该键。
use Amish\StripeTestClock\Facades\StripeTestClock; // using the StripeClient $stripe->customers->create(StripeTestClock::stripeOptions([ 'email' => 'email@example.com', //... ])); // Or using cashier $user->createAsStripeCustomer(StripeTestClock::options());
从那里,您可以从 Stripe 控制台或使用 CLI 与时钟一起工作。
php artisan test-clock:advance -w 1 # advance the current clock by 1 week php artisan test-clock:advance -m 1 -d 4 # advance the current clock by 1 month & 5 days php artisan test-clock:advance "2023-07-19" # advance the clock to a specific date.
如果测试时钟在 Stripe 中被删除或过期,可以使用 artisan test-clock:prune
命令来删除模型。
在本地测试时,我建议使用 stripe CLI 将 webhook 事件转发到您的应用程序。
stripe listen -f https:///stripe/webhook
变更日志
请参阅变更日志以获取有关最近更改的更多信息。
测试
composer test
贡献
有关详细信息和一个待办事项列表,请参阅contributing.md。
安全
如果您发现任何与安全相关的问题,请通过电子邮件 author@email.com 而不是使用问题跟踪器。
鸣谢
许可证
MIT。有关更多信息,请参阅许可证文件。