regiosoft / stripe-bundle
一个简单的用于 Stripe API 的 Symfony 扩展包。
1.3.6
2022-07-29 16:32 UTC
Requires
- php: >=7.1
- stripe/stripe-php: ^7.27
- symfony/config: ^3.0 || ^4.0
- symfony/dependency-injection: ^3.0 || ^4.0
- symfony/framework-bundle: ^3.0 || ^4.0
- symfony/http-foundation: ^3.0 || ^4.0
- symfony/http-kernel: ^3.0 || ^4.0
- symfony/options-resolver: ^3.0 || ^4.0
- symfony/validator: ^3.0 || ^4.0
This package is auto-updated.
Last update: 2024-09-29 05:56:36 UTC
README
一个简单的用于 Stripe Api 的 Symfony 扩展包。
仅支持 SMS/WhatsApp!
设置
步骤 1: 使用 composer 下载 RegiosoftStripeBundle
在 composer.json 中添加 Stripe 扩展包
{ "require": { "regiosoft/stripe-bundle": "^1.0" } }
现在运行以下命令让 composer 下载扩展包
$ php composer.phar update "regiosoft/stripe-bundle"
步骤 2: 启用扩展包
在 kernel 中启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Regiosoft\StripeBundle\RegiosoftStripeBundle() ); }
步骤 3: 添加配置
# app/config/config.yml regiosoft: stripe: stripe_private_key: %stripe_private_key%
用法
使用服务
<?php $stripeClient = $this->get('stripe_client'); ?>
##示例
###创建客户 & 订阅
<?php $customer = $stripeClient->createCustomer($token, $email, $name, $phone); // Store customer information $subsciption = $stripeClient->createSubscription($customerId, $planId); // Store subscription information ?>