prometee / payum-stripe-checkout-session-bundle
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-06-27 14:37:45 UTC
README
Payum Stripe 结账会话网关软件包
本软件包旨在为 Payum 添加新的网关,以支持通过 symfony-bundle 的 Stripe 结账会话和 Stripe JS 网关。
更多信息请参阅 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
需要填写的 URL 是名为 payum_notify_do_unsafe
的路由,以下是一个示例
https://localhost/payment/notify/unsafe/stripe_checkout_session
https://dashboard.stripe.com/test/webhooks
测试或开发环境
Webhook 由 Stripe 在其服务器上触发,发送到您的服务器。如果服务器位于私有网络中,则 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 插件