flux-se / payum-stripe-bundle
Payum Stripe网关包
Requires
- flux-se/payum-stripe: ^2.0
- payum/payum-bundle: ^2.4
- symfony/config: ^4.4|^5.4|^6.0
- symfony/dependency-injection: ^4.4|^5.4|^6.0
- symfony/http-kernel: ^4.4|^5.4|^6.0
Requires (Dev)
- php-http/guzzle6-adapter: ^2.0
- phpstan/phpstan: ^1
- phpunit/phpunit: ^8|^9
- symplify/easy-coding-standard: ^11
- vimeo/psalm: ^4.3
This package is auto-updated.
Last update: 2024-08-27 15:03:41 UTC
README
Payum Stripe结账会话网关包
此包旨在为Payum添加一个新的网关,以支持Stripe结账会话和Stripe JS网关,通过symfony包实现
更多信息请参阅https://stripe.com/docs/payments/checkout
安装
使用Composer安装
composer require flux-se/payum-stripe-bundle
选择php-http/client-implementation中的一个,最常用的是php-http/guzzle6-adapter
composer require php-http/guzzle6-adapter
配置
API密钥
在你的Stripe账户上获取你的publishable_key
和secret_key
https://dashboard.stripe.com/test/apikeys
Webhook密钥
然后获取一个配置了至少两个事件的webhook_secret_key
payment_intent.canceled
checkout.session.completed
要填写的是名为payum_notify_do_unsafe
的路由,以下是一个示例
https://localhost/payment/notify/unsafe/stripe_checkout_session
https://dashboard.stripe.com/test/webhooks
测试或开发环境
Stripe在其服务器上触发Webhook事件到你的服务器。如果服务器处于私有网络中,Stripe将无法访问你的服务器。
Stripe提供了一个替代方法来捕获这些Webhook事件,你可以使用Stripe CLI
: https://stripe.com/docs/stripe-cli 点击链接并安装Stripe CLI
,然后使用以下命令行获取你的Webhook密钥
首先登录到你的Stripe账户(每90天需要登录一次)
stripe login
然后开始监听两个必需的事件,将请求转发到本地服务器
stripe listen \ --events checkout.session.completed,payment_intent.canceled \ --forward-to https://localhost/payment/notify/unsafe/stripe_checkout_session
将--forward-to参数值替换为你需要的正确值。
Payum
# config/packages/payum.yaml payum: gateways: stripe_checkout_session: factory: stripe_checkout_session publishable_key: sk_test_secretkey secret_key: pk_test_publishablekey webhook_secret_keys: - whsec_test_webhookkey stripe_js: factory: stripe_js publishable_key: sk_test_secretkey secret_key: pk_test_publishablekey webhook_secret_keys: - whsec_test_webhookkey
要设置支付方式,你可以将payment_method_types
添加到网关配置中。此数组可以包含你想要支持的多个网关。完整列表请见此处。默认的payment_method_types是['card']。
使用方法
请参阅此处文档:https://github.com/FLUX-SE/PayumStripe/blob/master/README.md
更多
Sylius插件