prometee/payum-stripe-checkout-session-bundle

此软件包已被 弃用 且不再维护。作者建议使用 flux-se/payum-stripe-bundle 软件包。

Payum Stripe 网关软件包

安装数量: 4,171

依赖项: 0

建议者: 0

安全: 0

星标: 21

关注者: 3

分支: 6

开放问题: 0

类型:symfony-bundle

v2.0.1 2022-11-04 16:54 UTC

This package is auto-updated.

Last update: 2024-06-27 14:37:45 UTC


README

Latest Version on Packagist Software License Build Status Quality Score

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_keysecret_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 CLIhttps://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 插件

https://github.com/FLUX-SE/SyliusPayumStripePlugin