randomstate/mint
Laravel & Stripe 的样板化账单集成
v0.2.1
2020-03-08 15:43 UTC
Requires
- moneyphp/money: ^3.3
- randomstate/stripe: ^1.2
Requires (Dev)
- laravel/laravel: ^6.12
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
- vlucas/phpdotenv: ^3.3
Suggests
- ext-intl: *
This package is auto-updated.
Last update: 2024-08-30 01:28:54 UTC
README
安装
使用 composer 需要此库
composer require randomstate/mint
数据库迁移
Mint 为它使用的模型提供了默认的迁移。这些迁移会自动注册到 Laravel 中。您需要运行 php artisan migrate
来初始化这些表。
库假设您的应用程序使用一个包含 Stripe 客户端 ID 的 users
表。如果您需要自定义此设置,请首先发布迁移。
php artisan vendor:publish
配置
账单模型
将 Mint Billable 特性添加到您的 User 模型中。这将使它能够访问 Mint 为每个客户提供的流畅接口。如果您正在对组织或团队收费,发布并自定义客户迁移以指向适当的表,并将 Billable 特性添加到您的 org/team 模型中。
use RandomState\Mint\Mint\Billable; class User extends Authenticatable { use Billable; }
API 密钥
将您的 Stripe API 密钥添加到 .env 文件中
STRIPE_SECRET_KEY= STRIPE_WEBHOOK_SECRET=